Thanks for this very helpful video. You skipped the "make install" step in your video. I was wondering why I didn't get an "installed" directory. Luckily, I'm following along with the linked script. :)
Thank you! I tried to follow the CompilationGuide and could not get it to work with Linux Subsystem for Windows. I followed your video to a t and it finally worked.
I need to use the ffmpeg libraries as either a dll or a static lib but I keep getting a dependency error on the following dll ext-ms-win-oobe-query-l1-1-0.dll
has this error when CC=cl "../../sources/x264/config.guess: line 1: syntax error near unexpected token `newline'", noticed the link to config.guess to run with Curl is not available anymore. Is there a updated link to download and update the config.guess?
Hi, in your configure file you put a cpu arch for w86_64, can we go further and make a build optimized for specified simd like sse 4.1 4.2 avx for exemple ? Or make a build for a specific cpu live ivy bridge?
Hi! This has been an amazing and helpful guide and I would like to ask if there is a reference guide to build ffmpeg with x265 using this way of compilation? Also is this build C++ compatible? Thank you!!
Everything in C is also C++ compatible after all. It may not be the most optimized and you don't take advantage of all the benefits C++ can give, but you have something runnable in the end
Hi, I have a question for you, if I want to enable ffplay during build ffmpeg, you said need install SDL lib first, Which command should I use? i tried the following command "pacman -S mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_mixer mingw64/mingw-w64-x86_64-SDL2_image mingw64/mingw-w64-x86_64-SDL2_ttf mingw64/mingw-w64-x86_64-SDL2_net" but it does not work.
Hi! Thanks for watching and for following the guide! I guess it requires something more, I am not sure if one or more of the packets you mentioned aree enough for FFplay to be compiled. I would like to make a video on that!
Amazing guide, could you make one for GCC compiling directly in MinGW64, perhaps you can add that into your git repo as well. Also, it would be nice if the script included cleaning for re-compiling.
Hi, excellent tutorial, thx. But I have a (probably stupid) question. I hoped that compiling ffmpeg would also generate the libraries for Windows. If I want to decode H264 frames in a Windows application (developed using Visual Studio), I need to make calls to methods like av_malloc() and av_frame_alloc() but without the library, how can it work ? Unless I missed something at some point of course and I'm quite sure you're going to tell me where ;o))
Hi and thanks for watching! Here we compiled statically, where all the necessary libraries are incorporated in the application. If you want only the dynamic libraries (as DLLs on Windows), there is the possibility to generate them by putting the right flags (they should be --disable-static --enable-shared --disable-programs) in the ./configure process. Good luck!
i tried to build it with mingw-w64 gcc compiler, and the configuration worked fine. this is my config: CC=gcc ../FFmpeg-master/configure --prefix=../build --shlibdir=../build/shared --enable-gpl --enable-nonfree --enable-shared --disable-programs --target-os=mingw32 --arch=x86_64 when i did the make -j 6, it gave an error about missing or non existing file. it seems dat my make doesnt support absolute paths, and it is trying to use the current path and then using the path provided in the include of the make generated by configure, leading to missing files. i tried to replace it by the relative path and it worked, but then the FFmpeg makefile failed due to the same reason. the error is this: Makefile:1: /c/Users/username/Downloads/FFmpeg-master/Makefile: No such file or directory make: *** No rule to make target '/c/Users/username/Downloads/FFmpeg-master/Makefile'. Stop. any idea why my make is not taking the paths as absolute, and consequently messing up the compilation? NOTE: im using the mingw make, v 4.4.1
Hi, thank you very much for share this. Just one comments when i am following your steps. If move the link.exe from msys2 and save it to another name, my system cannot find the link command anymore, then I need add the MSVC link to the PATH via run command from msys2 like this "export PATH=/c/...MSVC.../.../x64:$PATH". Wish this can help someone who watch this video and have the same issue as me.
I'm from Brazil, great work, I need to stream with HE-AAC, but when using ffmpeg it return - Unknown encoder 'libfdk_aac' -, does this example above also work for this encoder? thank you
Nice to meet you! Thanks for watching! I guess because this was not compiled and included in the compilation. For more about this, there is my Linux compiling video as well, where there is libdfk_aac included ruclips.net/video/PJ6y-r_buUI/видео.html
I have a question, may anyone help me?: How can I include the built headers and libs with make install-headers and make install-libs for compiling C programs which uses functions like av_register_all()?
Thanks for the video! If I want to generate videos in C++, what can I do after the compilation process? How can I use FFmpeg libs in Visual Studio? Thanks!
Thanks for watching! In this case, the procedure is a bit different: we should include the libraries and link them (statically or dynamically? This is something to decide before) and then use them with the proper calls. There is a video I would like to do. Stay tuned!
@@devstefit you can simply rename the *.a libs to *.lib i have done this and it works. However, i had to use these two disable flags: --disable-schannel --disable-mediafoundation in order for my program to build successfully after i included the newly renamed *.lib files! Also you need to know which header files you need in order to build correctly :)
@@devstefit Great, thank you very much! It would be even better if you could make a tutorial of doing a simple video encoding. You would start from a RPG linear colorspace pixels (0 to 255, 8 bits per color channel) and you'd finish with a .mp4 x264 video in YCbCr color space with 4:2:0 chroma subsampling, for example. I hope you like the idea.
@@vaguelobster356 That's nice! Thanks for sharing your tip! I would like to investigate a bit more about this, I don't know why you need these two flags. I will make a tutorial about how to build a program of ours with the FFmpeg libraries. Stay tuned!
When I add a reference to the project, I get this prompt: “Please make sure that the file is accessible and that it is a valid assembly or COM component.”. How should I solve the problem?
Hi! In C# there is this Github project developed by Microsoft github.com/Microsoft/FFmpegInterop I did not investigate so much. I've been hearing it for a long time, but did not dive into it yet...
I think --toolchain was suppressed. The two dashes were erased during the typing. Also the parameter --arch=x86_64 may be replaced for --arch=x64 to enforce 64 bits only.
hi m getting this error CC=cl ../../ffmpegsources/x264/configure --prefix=../../installed --enable-static with this command Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer
There are other people having the same problem, the info is reported in another comment in this video. You should use the following command to open msys2: c:\msys64\msys2_shell.cmd -use-full-path
Hi, I would be glad if you could help me with this one: After executing line: CC=cl PKG_CONFIG_PATH=../installed/lib/pkgconfig ../../sources/ffmpeg/configure --prefix=../../installed --toolchain=msvc --arch=x86_64 --enable-yasm --enable-asm --disable-shared --enable-static --enable-libx264 --enable-gpl --enable-nonfree --enable-debug --extra-ldflags="-LIBPATH:../../installed/lib" --extra-cflags="-I../../installed/include/" I received an error: ERROR: x264 not found using pkg-config Found info somewhere to use this: pacman -S mingw-w64-x86_64-libx264 After executing above command I closed msys prompt, opened it again and execute the first line. Same error about x264 is still present.
Hi, thank you so much friend . but I met a problem after this step "CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static ", the config.log file gives me some error tips , but I don't know how to fix them. Can someone help me , thanks a lot. checking whether _MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324) is true... yes checking whether defined(_M_AMD64) || defined(_M_X64) is true... yes checking for -lshell32... no Failed commandline was: -------------------------------------------------- cl conftest.c -I. -I$(SRCPATH) -nologo -GS- -DHAVE_STRING_H -I$(SRCPATH)/extras -link shell32.lib conftest.c LINK : fatal error LNK1181: failed to open “shell32.lib” -------------------------------------------------- Failed program was: -------------------------------------------------- int main (void) { return 0; } -------------------------------------------------- checking whether rc.exe works... no Failed commandline was: -------------------------------------------------- rc.exe -foconftest.o conftest.rc ../../sources/x264/configure: line 248: rc.exe: command not found -------------------------------------------------- Failed program was: -------------------------------------------------- 0 RCDATA {0} -------------------------------------------------- checking whether !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) is true... no -------------------------------------------------- conftest.c conftest.c(1): fatal error C1083: failed to open : “winapifamily.h”: No such file or directory -------------------------------------------------- Failed program was: -------------------------------------------------- #include #if !(!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) #error #endif -------------------------------------------------- x264 configure script Command line options: "--prefix=../../installed" "--enable-static" checking whether cl works... no Failed commandline was: -------------------------------------------------- cl conftest.c -I. -I$(SRCPATH) -nologo -GS- -DHAVE_STRING_H -I$(SRCPATH)/extras -link conftest.c LINK : fatal error LNK1104: failed to open “LIBCMT.lib” -------------------------------------------------- Failed program was: -------------------------------------------------- int main (void) { return 0; } -------------------------------------------------- DIED: No working C compiler found.
Hi! Oh, I am glad you solved the problem yourself. This was blocking me also when I started dealing with developing Windows programs. Good work! And thanks for watching!
Hey Hi. I really appreciate that you are working on ffmpeg transparently. Can you please help me out with this. Iam getting this Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer while doing CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static --extra-cflags="-MTd -Zi -Od"
Hi! Thank you very much! Really appreciated! Maybe it requires an update (Visual Studio 2013 is rather old and does not support some flags). I also see that you put all the flags in --extra-cflags. The -Od and -Zi flags should go into the --opt-flags, otherwise it doesn't work (the compiling process will overwrite them). Good luck!
@@devstefit Hey Thanks for the response. I tried what you have mentioned but couldn't able to resolve it. Infact I am able to get the same issue even if i use this CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static without any debug flags. And I tried installing Visual Studio 2013 too. But couldn't able to install it in present version of windows itseems. Any other workaround?
Sorry, I saw you were referring to x264 and not to FFmpeg, the thing I was saying is not valid, the flags you were using in the beginning were correct. I think it is a compiler version check done by the x264 configure script (available here code.videolan.org/videolan/x264 ): if you inspect line 614 it performs this kind of check. For more reference about the Visual Studio versions, I found this reference dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
I've managed to solve it thanks to the log hint. In x64 Native prompt, you can't just write c:\msys64\msys2_shell.cmd, you need to write c:\msys64\msys2_shell.cmd -use-full-path
Thanks so much! Straightforward, well-explained guide
Please tell me which is better Windows ffmpeg.exe .
Cross compiling from Linux or
Building with Toolchain inside Windows itself ?
Thanks for this very helpful video. You skipped the "make install" step in your video. I was wondering why I didn't get an "installed" directory. Luckily, I'm following along with the linked script. :)
Thank you! I tried to follow the CompilationGuide and could not get it to work with Linux Subsystem for Windows. I followed your video to a t and it finally worked.
I'm glad it worked for you. I really appreciate that!
I need to use the ffmpeg libraries as either a dll or a static lib but I keep getting a dependency error on the following dll ext-ms-win-oobe-query-l1-1-0.dll
has this error when CC=cl "../../sources/x264/config.guess: line 1: syntax error near unexpected token `newline'", noticed the link to config.guess to run with Curl is not available anymore. Is there a updated link to download and update the config.guess?
Bel video, complimenti, erano giorni che stavo cercando di capire come installare ffmpeg per poterlo importare in un progetto MVS
Hi, in your configure file you put a cpu arch for w86_64, can we go further and make a build optimized for specified simd like sse 4.1 4.2 avx for exemple ? Or make a build for a specific cpu live ivy bridge?
Hi! This has been an amazing and helpful guide and I would like to ask if there is a reference guide to build ffmpeg with x265 using this way of compilation? Also is this build C++ compatible? Thank you!!
Everything in C is also C++ compatible after all. It may not be the most optimized and you don't take advantage of all the benefits C++ can give, but you have something runnable in the end
Hi, I have a question for you, if I want to enable ffplay during build ffmpeg, you said need install SDL lib first, Which command should I use? i tried the following command "pacman -S mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_mixer mingw64/mingw-w64-x86_64-SDL2_image mingw64/mingw-w64-x86_64-SDL2_ttf mingw64/mingw-w64-x86_64-SDL2_net" but it does not work.
Hi! Thanks for watching and for following the guide! I guess it requires something more, I am not sure if one or more of the packets you mentioned aree enough for FFplay to be compiled. I would like to make a video on that!
Amazing guide, could you make one for GCC compiling directly in MinGW64, perhaps you can add that into your git repo as well.
Also, it would be nice if the script included cleaning for re-compiling.
I get a system error: "libbz2-1dll was not found" when running the compiled file in another device.
Hi, excellent tutorial, thx. But I have a (probably stupid) question. I hoped that compiling ffmpeg would also generate the libraries for Windows. If I want to decode H264 frames in a Windows application (developed using Visual Studio), I need to make calls to methods like av_malloc() and av_frame_alloc() but without the library, how can it work ? Unless I missed something at some point of course and I'm quite sure you're going to tell me where ;o))
Hi and thanks for watching! Here we compiled statically, where all the necessary libraries are incorporated in the application. If you want only the dynamic libraries (as DLLs on Windows), there is the possibility to generate them by putting the right flags (they should be --disable-static --enable-shared --disable-programs) in the ./configure process.
Good luck!
i tried to build it with mingw-w64 gcc compiler, and the configuration worked fine. this is my config:
CC=gcc ../FFmpeg-master/configure --prefix=../build --shlibdir=../build/shared --enable-gpl --enable-nonfree --enable-shared --disable-programs --target-os=mingw32 --arch=x86_64
when i did the make -j 6, it gave an error about missing or non existing file. it seems dat my make doesnt support absolute paths, and it is trying to use the current path and then using the path provided in the include of the make generated by configure, leading to missing files. i tried to replace it by the relative path and it worked, but then the FFmpeg makefile failed due to the same reason.
the error is this:
Makefile:1: /c/Users/username/Downloads/FFmpeg-master/Makefile: No such file or directory
make: *** No rule to make target '/c/Users/username/Downloads/FFmpeg-master/Makefile'. Stop.
any idea why my make is not taking the paths as absolute, and consequently messing up the compilation?
NOTE: im using the mingw make, v 4.4.1
Hi, thank you very much for share this. Just one comments when i am following your steps. If move the link.exe from msys2 and save it to another name, my system cannot find the link command anymore, then I need add the MSVC link to the PATH via run command from msys2 like this "export PATH=/c/...MSVC.../.../x64:$PATH". Wish this can help someone who watch this video and have the same issue as me.
Hi! Thank you very much for the tip! I hope it can be useful for somebody
i am getting an error in config.guess - ; syntax error near unexpected token ' newline'
config.sub missing argument. any ideas?
Same here, do you manage to find reason of that. I guess that config.guess is already different file for time of demo...
I'm from Brazil, great work, I need to stream with HE-AAC, but when using ffmpeg it return - Unknown encoder 'libfdk_aac' -, does this example above also work for this encoder? thank you
Nice to meet you! Thanks for watching!
I guess because this was not compiled and included in the compilation. For more about this, there is my Linux compiling video as well, where there is libdfk_aac included ruclips.net/video/PJ6y-r_buUI/видео.html
I have a question, may anyone help me?: How can I include the built headers and libs with make install-headers and make install-libs for compiling C programs which uses functions like av_register_all()?
Thanks for the video! If I want to generate videos in C++, what can I do after the compilation process? How can I use FFmpeg libs in Visual Studio? Thanks!
Thanks for watching!
In this case, the procedure is a bit different: we should include the libraries and link them (statically or dynamically? This is something to decide before) and then use them with the proper calls. There is a video I would like to do. Stay tuned!
@@devstefit you can simply rename the *.a libs to *.lib i have done this and it works. However, i had to use these two disable flags: --disable-schannel --disable-mediafoundation in order for my program to build successfully after i included the newly renamed *.lib files! Also you need to know which header files you need in order to build correctly :)
@@devstefit Great, thank you very much! It would be even better if you could make a tutorial of doing a simple video encoding. You would start from a RPG linear colorspace pixels (0 to 255, 8 bits per color channel) and you'd finish with a .mp4 x264 video in YCbCr color space with 4:2:0 chroma subsampling, for example. I hope you like the idea.
@@vaguelobster356 That's nice! Thanks for sharing your tip! I would like to investigate a bit more about this, I don't know why you need these two flags. I will make a tutorial about how to build a program of ours with the FFmpeg libraries. Stay tuned!
@@jordanrodrigues1824 Wow, that's a super nice idea! It is on my list, bear in mind this may take a lot of time and so expect a long video!
Thanks!
Thank you very much for sharing, could you explain how to add the reference of ffmpeg dynamic library under c # of VS2022 in detail?
When I add a reference to the project, I get this prompt: “Please make sure that the file is accessible and that it is a valid assembly or COM component.”. How should I solve the problem?
Hi! In C# there is this Github project developed by Microsoft github.com/Microsoft/FFmpegInterop
I did not investigate so much. I've been hearing it for a long time, but did not dive into it yet...
Thanks man.
Most welcome pal!
Thanks for watching!
I think --toolchain was suppressed. The two dashes were erased during the typing. Also the parameter --arch=x86_64 may be replaced for --arch=x64 to enforce 64 bits only.
Thanks for the corrections!
@@devstefit No Sir. Thank you for the video.
@@ChopterManhi, can we compile forcing using simd sse avx and others?
Hi your video is really helpful, i need to install ffplay too kindly help me i tried but failes
804! (or 805 idk how this platform works anymore)
hi m getting this error
CC=cl ../../ffmpegsources/x264/configure --prefix=../../installed --enable-static
with this command
Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer
There are other people having the same problem, the info is reported in another comment in this video.
You should use the following command to open msys2: c:\msys64\msys2_shell.cmd -use-full-path
Hi, I would be glad if you could help me with this one:
After executing line:
CC=cl PKG_CONFIG_PATH=../installed/lib/pkgconfig ../../sources/ffmpeg/configure --prefix=../../installed --toolchain=msvc --arch=x86_64 --enable-yasm --enable-asm --disable-shared --enable-static --enable-libx264 --enable-gpl --enable-nonfree --enable-debug --extra-ldflags="-LIBPATH:../../installed/lib" --extra-cflags="-I../../installed/include/"
I received an error:
ERROR: x264 not found using pkg-config
Found info somewhere to use this:
pacman -S mingw-w64-x86_64-libx264
After executing above command I closed msys prompt, opened it again and execute the first line. Same error about x264 is still present.
Hi, thank you so much friend .
but I met a problem after this step "CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static ",
the config.log file gives me some error tips , but I don't know how to fix them. Can someone help me , thanks a lot.
checking whether _MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324) is true... yes
checking whether defined(_M_AMD64) || defined(_M_X64) is true... yes
checking for -lshell32... no
Failed commandline was:
--------------------------------------------------
cl conftest.c -I. -I$(SRCPATH) -nologo -GS- -DHAVE_STRING_H -I$(SRCPATH)/extras -link shell32.lib
conftest.c
LINK : fatal error LNK1181: failed to open “shell32.lib”
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main (void) { return 0; }
--------------------------------------------------
checking whether rc.exe works... no
Failed commandline was:
--------------------------------------------------
rc.exe -foconftest.o conftest.rc
../../sources/x264/configure: line 248: rc.exe: command not found
--------------------------------------------------
Failed program was:
--------------------------------------------------
0 RCDATA {0}
--------------------------------------------------
checking whether !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) is true... no
--------------------------------------------------
conftest.c
conftest.c(1): fatal error C1083: failed to open : “winapifamily.h”: No such file or directory
--------------------------------------------------
Failed program was:
--------------------------------------------------
#include
#if !(!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
#error
#endif
--------------------------------------------------
x264 configure script
Command line options: "--prefix=../../installed" "--enable-static"
checking whether cl works... no
Failed commandline was:
--------------------------------------------------
cl conftest.c -I. -I$(SRCPATH) -nologo -GS- -DHAVE_STRING_H -I$(SRCPATH)/extras -link
conftest.c
LINK : fatal error LNK1104: failed to open “LIBCMT.lib”
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main (void) { return 0; }
--------------------------------------------------
DIED: No working C compiler found.
um..., the problem is because I run "msys2_shell.cmd" straightly without first running x64 Native Tools Command Prompt
Hi! Oh, I am glad you solved the problem yourself. This was blocking me also when I started dealing with developing Windows programs. Good work! And thanks for watching!
Hey Hi. I really appreciate that you are working on ffmpeg transparently. Can you please help me out with this.
Iam getting this
Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer
while doing CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static --extra-cflags="-MTd -Zi -Od"
Hi! Thank you very much! Really appreciated!
Maybe it requires an update (Visual Studio 2013 is rather old and does not support some flags). I also see that you put all the flags in --extra-cflags. The -Od and -Zi flags should go into the --opt-flags, otherwise it doesn't work (the compiling process will overwrite them). Good luck!
@@devstefit Hey Thanks for the response.
I tried what you have mentioned but couldn't able to resolve it.
Infact I am able to get the same issue even if i use this CC=cl ../../sources/x264/configure --prefix=../../installed --enable-static without any debug flags. And I tried installing Visual Studio 2013 too. But couldn't able to install it in present version of windows itseems. Any other workaround?
Sorry, I saw you were referring to x264 and not to FFmpeg, the thing I was saying is not valid, the flags you were using in the beginning were correct. I think it is a compiler version check done by the x264 configure script (available here code.videolan.org/videolan/x264 ): if you inspect line 614 it performs this kind of check.
For more reference about the Visual Studio versions, I found this reference dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
I'm with the same problem. Did you manage to solve it?
I've managed to solve it thanks to the log hint. In x64 Native prompt, you can't just write c:\msys64\msys2_shell.cmd, you need to write c:\msys64\msys2_shell.cmd -use-full-path