[Libav-user] reduce dll size

Camera Man i.like.privacy.too at gmail.com
Tue Mar 4 05:24:39 CET 2014

On 03/04/2014 12:58 AM, YIRAN LI wrote:

>  Hi,
>  I'm building ffmpeg dlls for Windows using MingW, and the dlls I got
>  seems quite large. libavcodec 8 MB and libavformat 1.5 MB.
>  Firstly may I know, since ffmpeg is built into several dlls, is it
>  possible that same code got built into each dll so that there're
>  some unnecessary waste? Is it possible to build all code into
>  one dll?

As far as I know there isn't really any waste, and while it is always 
possible to build everything into one dll, that is not supported by the 
existing configure/make system.

If you configure to only use parts you need (decoders/encoders/parsers), 
the .dlls may be much smaller. However, if you care so much about 
distribution size, you are probably better off using static linking. You 
would still need to configure only the decoders/encoders you need. And 
you must also abide by the licenses of the code you use (e.g. libx264 is 
GPL, meaning that your software must be GPL if you use it; some ffmpeg 
is LGPL, meaning that if you do a static link you will need to LGPL your 
code as well).

>  Second, is there any option I can use to reduce the size of the
>  dlls?

UPX is useful for this - both for .dlls and for .exes; though note that 
if you do use upx, then mutliple processes will not share their 
read-only memory sections -- e.g. if you have 40MB code (happens with 
some C++ code bases...), and you use UPX and run 10 copies, it will take 
400MB of RAM; if you don't use UPX, that code will only take ~40MB of 
ram no matter how many copies you run.

Do remember the license issues though.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140304/a3e55cbc/attachment.html>

More information about the Libav-user mailing list