1

I want to link ffmpeg libraries to my project as static.

When I compile ffmpeg as shared its libraries via vcpkg. size of libavcodec and other libraries are conceivable.

But when install with this command:

 ./vcpkg.exe install ffmpeg[core,avcodec,swscale,swresample,avformat]:x64-windows-static --recurse

All static libraries sizes are larger than the shared version. Also, debug and release libraries sizes are same.

I think vcpkg compile only debug mode when it is specified as static.

How can I prevent this?

Or How can disable this in vcpkg?

hrn
  • 48
  • 6
  • static libraries being larger than shared libaries is normal. https://stackoverflow.com/questions/9688200 – UmNyobe Jan 11 '22 at 08:36
  • There is little nuance, debug library size is the same with release files. BTW, I have added that detail. – hrn Jan 11 '22 at 08:47
  • shared libavcodec only contains libavcodec objects. static libavcodec also contains third party libraries e.g. libx265 – Gyan Jan 11 '22 at 13:32

1 Answers1

0

I think vcpkg compile only debug mode when it is specified as static.

that is not the case but looking at the portfile it seems like optimization might not be enabled unless the ffmpeg makefile enables them.

All static libraries sizes are larger

this is normal especially since all libraries (debug&release) are build with debug symbols (/Z7) and are built with static CRT. So unless you strip them or have your own triplet with a custom toolchain you won't get small libraries.

Alexander Neumann
  • 1,479
  • 8
  • 17
  • As far as I understand, it includes media foundation and its dependencies. Alright, does compile as static cause conflict in the client machine? – hrn Jan 12 '22 at 06:16