[Ffmpeg-devel] How to reduce the ffmpeg avcodec.dll, avformat.dllsize

Steve Lhomme steve.lhomme
Mon Mar 20 16:14:57 CET 2006

Rich Felker wrote:
> On Mon, Mar 20, 2006 at 09:15:38AM +0100, Steve Lhomme wrote:
>> Jimmy Zha wrote:
>>> Hi,Michel Bardiaux,
>>> 	Thanks for your help:),i have got the lastest CVS version.
>>> 	I figured it out with read the prediscussed in this MailList.Now the 
>>> 	filesize is avcodec.dll(3.53mb),avformat.dll(408K).
>>> 	There are some tips for the future guys :):
>>> 	1. Resolve the "Avcodec.dll staticly linking into the avformat.dll" 
>>> 	problem,you can get the informations by search this MailList. This 
>>> 	"bug" will appear while you compile the FFMpeg in MinGW.This point 
>>> 	can reduce the avformat.dll to the normally size(about 1/10 of 
>>> 	avcodec.dll).
>>> 	2. I use follow configure to compile the project:
>>> --enable-mp3lame --enable-gpl --enable-shared --enable-static 
>>> --enable-memalign-hack --disable-audio-oss --disable-v41 --disable-bktr 
>>> --disable-mpegaudio-hp --disable-dv1394 --disable-network --disable-zlib 
>>> --disable-debug --disable-strip --disable-ffserver --disable-ffplay
>>> 	This point will reduce the avcodec.dll to 3.xx MB.Can anybody give a 
>>> 	better configure:)? I still want to reduce the size.
>>> 	I tried to enable/disable some encoder/decoder, but the effect is 
>>> 	not very good.It just can reduce xx K :( .
>> You'll have to wait until the MinGW gcc is upgraded to gcc4. Because 
>> gcc4 can remove unused code from an exe (and I suppose a DLL too when 
>> it's available). But I don't know if it will happen in the next few 
> I really doubt it. Removing unused code at the linking stage would be
> up to the linker, not the compiler, and it's very difficult for a
> linker to decide if it can remove things.

I consider the linker as part of gcc, but I could be wrong. And the 
option is definitely a gcc feature. Look for the -fssa-dce option. This 
option is not available on MinGW. And it's probably not such a hard 
feature to do, because it's been in MSVC6 for a decade (-opt:ref).

> If code is not being removed by the compiler with some
> encoders/decoders disabled, it's probably because it's accidentally
> being used, due to function pointers in the data segment, etc.

You can disable this option if you write such (weird) code.

More information about the ffmpeg-devel mailing list