mcmtroffaes / ffmpeg-msvc-build

Script for building ffmpeg with msvc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio only FFmpeg flavor

CyberSinh opened this issue · comments

Hi,

Would it be possible for you to release a flavor of FFmpeg (LGPL, shared, MSVC, x64) with just audio-related features enabled?

Many programs that use FFmpeg don't care about the video features (codec, parser,...) and would appreciate to have much lighter DLLs to distribute (and with less dependencies).

Thanks in advance!

That's a reasonable request. The intention of this repository is:

  1. To enable the latest git version of ffmpeg to be built with vcpkg. A few additional patches are carried to enable this.
  2. Do full feature testing for windows, linux, and osx (far more in-depth compared to what upstream vcpkg continuous integration is testing).
  3. Provide a few lightweight builds for convenience. Given that there are so many different combinations of features that might make sense for specific purposes, and also given the limitations of testing with appveyor (a full regression test takes currently 25 hours...), I've decided on an LGPL build with vpx and opus (which are the among the best LGPL codecs), and a few very light features (such as nvcodec).

So, I fear I cannot oblige, however, I'd be very happy to help you to build it yourself with vcpkg. The main issue with vcpkg is that it does not allow disabling specific codecs. The quickest way to build it with vcpkg for your purpose is to edit the portfile directly and to add "--disable-everything" (this seems to be the quickest way to disable all video codecs, I'm not sure if there's a better way...) followed by "--enable-xxx" for every audio codec "xxx" that you wish to enable. There's no configure option to select specifically all audio or all video codecs as far as I know. That's a limitation in the upstream ffmpeg configure file. Anyway, you can add your options by adding a line

set(OPTIONS "${OPTIONS} --disable-everything --enable-xxx  --enable-xxx  --enable-xxx ...")

at this location of the portfile:

https://github.com/microsoft/vcpkg/blob/85a48c1ed558210cab67a03209510c4bf6e5e285/ports/ffmpeg/portfile.cmake#L527

It's probably not the answer that you are looking for, but I hope this helps. Let me know how it goes!

I realized that the readme does not make this very clear, which was entirely on me. I've updated it now with better instructions, see:

https://github.com/mcmtroffaes/ffmpeg-msvc-build/blob/master/README.md

I wonder if I should somehow provide a more convenient mechanism for passing custom configure options. I'm not sure how to go about that, however.

Thank you very much for your answer.

I was actually expecting you would provide a build for this scenario, for convenience (without using vcpkg). ;-)
I understand that you can't provide a build for every specific scenario, but there is no build available for this one on the internet. That would have been a unique added value for this repo.

Today, I compile FFmpeg myself under WSL, with the following "configure" options:
--arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32-

I use the GCC toolchain because MSVC (--toolchain=msvc --arch=x86_64 --target-os=win64 ) does not work properly on my machine because make blocks without any error message at step:
./compat/windows/makedef libavcodec/libavcodec.ver libavcodec/[many_object_file].o > libavcodec/avcodec-58.def

I use the following options to select only audio-related features. Hope this helps someone.

        --enable-shared \
	--disable-static \
	--disable-debug \
	--disable-doc \
\
	--disable-avdevice \
	--disable-swscale \
	--disable-postproc \
	--disable-ffmpeg \
	--disable-ffplay \
\
	--disable-iconv \
	--disable-zlib \
	--disable-bzlib \
	--disable-lzma \
	--disable-sdl2 \
	--disable-schannel \
	--disable-securetransport \
	--disable-xlib \
\
	--disable-muxers \
	--disable-demuxers \
	--disable-hwaccels \
	--disable-d3d11va \
	--disable-nvenc \
	--disable-dxva2 \
	--disable-bsfs \
	--disable-filters \
	--disable-parsers \
	--disable-indevs \
	--disable-outdevs \
	--disable-encoders \
	--disable-decoders \
	--disable-bsfs \
\
	--enable-demuxer=image2 \
	--enable-demuxer=aac \
	--enable-demuxer=ac3 \
	--enable-demuxer=aiff \
	--enable-demuxer=ape \
	--enable-demuxer=asf \
	--enable-demuxer=au \
	--enable-demuxer=avi \
	--enable-demuxer=flac \
	--enable-demuxer=flv \
	--enable-demuxer=matroska \
	--enable-demuxer=mov \
	--enable-demuxer=m4v \
	--enable-demuxer=mp3 \
	--enable-demuxer=mpc* \
	--enable-demuxer=ogg \
	--enable-demuxer=pcm* \
	--enable-demuxer=rm \
	--enable-demuxer=shorten \
	--enable-demuxer=tak \
	--enable-demuxer=tta \
	--enable-demuxer=wav \
	--enable-demuxer=wv \
	--enable-demuxer=xwma \
	--enable-demuxer=dsf \
	--enable-demuxer=dts \
	--enable-demuxer=truehd \
\
	--enable-decoder=aac* \
	--enable-decoder=ac3 \
	--enable-decoder=alac \
	--enable-decoder=als \
	--enable-decoder=ape \
	--enable-decoder=atrac* \
	--enable-decoder=eac3 \
	--enable-decoder=flac \
	--enable-decoder=gsm* \
	--enable-decoder=mp1* \
	--enable-decoder=mp2* \
	--enable-decoder=mp3* \
	--enable-decoder=mpc* \
	--enable-decoder=opus \
	--enable-decoder=ra* \
	--enable-decoder=ralf \
	--enable-decoder=shorten \
	--enable-decoder=tak \
	--enable-decoder=tta \
	--enable-decoder=vorbis \
	--enable-decoder=wavpack \
	--enable-decoder=wma* \
	--enable-decoder=pcm* \
	--enable-decoder=dsd* \
	--enable-decoder=truehd \
	--enable-decoder=mjpeg \
\
	--enable-parser=aac* \
	--enable-parser=ac3 \
	--enable-parser=cook \
	--enable-parser=dca \
	--enable-parser=flac \
	--enable-parser=gsm \
	--enable-parser=mpegaudio \
	--enable-parser=tak \
	--enable-parser=vorbis \

Thanks for sharing. It would definitely be cool if custom configure options could be passed on to the vcpkg build, somehow. I'll have a think about this, maybe open an issue on vcpkg to discuss. For ffmpeg it is definitely a common use case to allow custom builds beyond the default feature set (even if that is already very rich...).

I've opened an issue for custom builds, see #6.

See microsoft/vcpkg#17323

If you are brave, you can try building ffmpeg[core,encoder-all-audio,decoder-all-audio,...] from that PR.