m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.53k stars 264 forks source link

building or locating some DLLs for other uses; eg ffms, fftw3, mediainfo #2453

Open hydra3333 opened 1 year ago

hydra3333 commented 1 year ago

Hello. I like building the 64bit static version to ensure it's an all-in-one standalone solution.

Having said that, I also need a few DLLs for other uses, eg ffms, fftw3, mediainfo (for use with vapoursynth).

I looked for them after a build and could not find any of those DLLs.

Is there any way to build these as a part of a static ffmpeg build process, or even somehow just build those alone ?

Thanks

LigH-de commented 1 year ago

When the suite builds a static ffmpeg, there is no need for building separate DLLs, instead there are Linux ELF related *.a libraries built to be linked. You could try to configure the suite to build both static and dynamic versions of ffmpeg, then it may produce both; but as static is preferred, chances are that the dynamic version fails as it is not tested that often.

media-autobuild_suite.ini ffmpegB2=4

hydra3333 commented 1 year ago

OK thanks. I build in a windows sandbox, so everything is lost afterward apart from the files I save such as media-autobuild_suite.ini etc.

I guess I could build static, save files, close sandbox, open new sandbox and build dynamic and see what gives.

Cheers

L4cache commented 1 year ago

Manually build them is enough if you aren't after the freshest codes, well, kind of, because for building ffms2 I had to use that bulky visual studio to build the dll that vapoursynth can use, I tried many times with m-ab-s msys2 environment in the past but had no success (I can build the indexer exe but not dll, what the...), but I'll keep try it I think.

hydra3333 commented 1 year ago

but I'll keep try it I think.

I'd certainly appreciate it if you did.

L4cache commented 1 year ago

I tried it a few times again. Now I know how to build a functional ffms2 plugin for VapourSynth, well, kind of. (just noticed I said it again😂, but that's fair because I have to manually edit some config) I did it all manual but it's probably easy to integrate with m-ab-s.

I quickly realized that simply configure ffms2 with --enable-shared would build the ffms2 dll, but it failed to load into VapourSynth, then I just abandoned it for a long time, today I ran some dependency walk with CFF Explorer and found that it actually dynamically links libgcc_s_seh-1.dll which prevents it to be loaded, I have to edit the config.status replace -lgcc_s with -lgcc_eh before running make to get rid of it (or quite the opposite, embrace it, I mean statically link it) There should be a better way I guess

My steps:

  1. build and install dav1d meson setup build -Ddefault_library=static && cd build && ninja install
  2. build and install ffmpeg ./configure --disable-encoders --disable-muxers --disable-filters --enable-libdav1d --prefix=/mingw64 && make install -j16 (please change -j16 accordingly)
  3. apply m-ab-s ffms2 patch
  4. configure ffms2 ./autogen.sh --enable-avisynth --enable-shared
  5. edit config.status sed -i 's/-lgcc_s/-lgcc_eh/g' config.status
  6. build ffms2
  7. strip it?
  8. test it

If you don't care about av1 decoding you can skip that first step and don't enable it in ffmpeg. I also added a patch by quietvoid which addresses some av1 related problem https://github.com/quietvoid/ffms2/commit/7fb91709ea194de3e8815728a88ccb9395706108 , but I don't know how it will affect decoding of other formats.

hydra3333 commented 1 year ago

Thank you :)