FFMPEG + libx264 Compiling On Windows With MSVC: The Complete Walkthrough

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 59

  • @codedeus
    @codedeus Год назад +1

    Thanks so much! Straightforward, well-explained guide

  • @Gaamaa-oz5ef2lf3n
    @Gaamaa-oz5ef2lf3n 2 месяца назад

    Please tell me which is better Windows ffmpeg.exe .
    Cross compiling from Linux or
    Building with Toolchain inside Windows itself ?

  • @hutprancer
    @hutprancer Месяц назад

    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. :)

  • @johntaylor7020
    @johntaylor7020 Год назад

    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.

    • @devstefit
      @devstefit  Год назад

      I'm glad it worked for you. I really appreciate that!

  • @asujeepboy
    @asujeepboy 11 месяцев назад

    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

  • @bciKuanLi
    @bciKuanLi 2 месяца назад

    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?

  • @MadCray34
    @MadCray34 Год назад

    Bel video, complimenti, erano giorni che stavo cercando di capire come installare ffmpeg per poterlo importare in un progetto MVS

  • @pulp2560
    @pulp2560 11 месяцев назад

    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?

  • @garfieldlbw
    @garfieldlbw 10 месяцев назад

    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!!

    • @devstefit
      @devstefit  9 месяцев назад

      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

  • @lyshmily
    @lyshmily Год назад +1

    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.

    • @devstefit
      @devstefit  Год назад +1

      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!

  • @alfred.clement
    @alfred.clement Год назад

    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.

    • @alfred.clement
      @alfred.clement Год назад

      I get a system error: "libbz2-1dll was not found" when running the compiled file in another device.

  • @patrickd1477
    @patrickd1477 Год назад +1

    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))

    • @devstefit
      @devstefit  Год назад +1

      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!

  • @DatBoi_TheGudBIAS
    @DatBoi_TheGudBIAS 6 месяцев назад +1

    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

  • @lyshmily
    @lyshmily Год назад +3

    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.

    • @devstefit
      @devstefit  Год назад

      Hi! Thank you very much for the tip! I hope it can be useful for somebody

  • @mikegaming1658
    @mikegaming1658 Год назад

    i am getting an error in config.guess - ; syntax error near unexpected token ' newline'
    config.sub missing argument. any ideas?

    • @ludmilkushinov9652
      @ludmilkushinov9652 Год назад

      Same here, do you manage to find reason of that. I guess that config.guess is already different file for time of demo...

  • @radicalbrothersbr
    @radicalbrothersbr Год назад

    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

    • @devstefit
      @devstefit  8 месяцев назад

      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

  • @alvaroradajczyk2191
    @alvaroradajczyk2191 10 месяцев назад

    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()?

  • @jordanrodrigues1824
    @jordanrodrigues1824 Год назад +1

    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!

    • @devstefit
      @devstefit  Год назад +1

      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!

    • @vaguelobster356
      @vaguelobster356 Год назад +3

      @@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 :)

    • @jordanrodrigues1824
      @jordanrodrigues1824 Год назад +1

      @@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.

    • @devstefit
      @devstefit  Год назад +1

      @@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!

    • @devstefit
      @devstefit  Год назад

      @@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!

  • @wiphuleelasitorn5885
    @wiphuleelasitorn5885 5 месяцев назад

    Thanks!

  • @daoxiaoyue
    @daoxiaoyue Год назад

    Thank you very much for sharing, could you explain how to add the reference of ffmpeg dynamic library under c # of VS2022 in detail?

    • @daoxiaoyue
      @daoxiaoyue Год назад

      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?

    • @devstefit
      @devstefit  Год назад

      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...

  • @VidTekHDRGrading
    @VidTekHDRGrading 8 месяцев назад

    Thanks man.

    • @devstefit
      @devstefit  8 месяцев назад

      Most welcome pal!
      Thanks for watching!

  • @ChopterMan
    @ChopterMan Год назад

    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.

    • @devstefit
      @devstefit  Год назад

      Thanks for the corrections!

    • @ChopterMan
      @ChopterMan Год назад

      @@devstefit No Sir. Thank you for the video.

    • @pulp2560
      @pulp2560 11 месяцев назад

      ​@@ChopterManhi, can we compile forcing using simd sse avx and others?

  • @5168944
    @5168944 Год назад

    Hi your video is really helpful, i need to install ffplay too kindly help me i tried but failes

  • @skeleton_craftGaming
    @skeleton_craftGaming Год назад

    804! (or 805 idk how this platform works anymore)

  • @GurinderjeetKaur-x3p
    @GurinderjeetKaur-x3p Год назад

    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

    • @devstefit
      @devstefit  Год назад

      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

  • @user-uw8cj7oj4g
    @user-uw8cj7oj4g 2 месяца назад

    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.

  • @jammiekatz3816
    @jammiekatz3816 Год назад

    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.

    • @jammiekatz3816
      @jammiekatz3816 Год назад

      um..., the problem is because I run "msys2_shell.cmd" straightly without first running x64 Native Tools Command Prompt

    • @devstefit
      @devstefit  Год назад +1

      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!

  • @threedee42
    @threedee42 Год назад +1

    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"

    • @devstefit
      @devstefit  Год назад

      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!

    • @threedee42
      @threedee42 Год назад

      @@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?

    • @devstefit
      @devstefit  Год назад

      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

    • @jordanrodrigues1824
      @jordanrodrigues1824 Год назад +1

      I'm with the same problem. Did you manage to solve it?

    • @jordanrodrigues1824
      @jordanrodrigues1824 Год назад +2

      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