codexffmpeg icon indicating copy to clipboard operation
codexffmpeg copied to clipboard

Real static libraries?

Open Alex18947 opened this issue 6 months ago • 5 comments

Nice work. Is there any chance to build real static libraries?

The problem with the current shared build is that you have large dll files that you need to copy around even if you need just a small part of ffmpeg. Building real windows static libraries (so large lib files and no dll files) would allow to include the headers, link against the lib files and produce a binary that would be small and would not depend on the large dll files.

(sorry for cross posting this, I also asked this on reddit but I don't see too much activity there)

Alex18947 avatar Jul 22 '25 17:07 Alex18947

I don't know if ffmpeg configuration allows this, but if I did this, what would happen to the size of the ff* binaries in the shared build?

GyanD avatar Jul 23 '25 11:07 GyanD

Well, if there are no dll files, then the ff* binaries would be the same (large) size as in the non shared build. However, the whole point of a real static build are not the binaries, but the ability to link against the static lib files and use just the ffmpeg parts you are interested in ending up with a binary of a reasonable size that does not depend on any large dll files - this is the whole purpose of static linkage on Windows, very beneficial when working with projects with large codebase like ffmpeg or similar.

While many people might like the shared build with dll libaries, I (and many others) would prefer a real static build with lib files only (no exe, no dll), so in fact a third type of build.

Also, I don't think this has to do with ffmpeg configuration (feel free to correct me, if I am wrong), it is a question of the Windows build environment and its configuration to switch to real static libararies output.

Alex18947 avatar Jul 24 '25 09:07 Alex18947

While many people might like the shared build with dll libaries, I (and many others) would prefer a real static build with lib files only (no exe, no dll), so in fact a third type of build.

Exactly. Yours is, in fact, the first request for such a build.

Also, I don't think this has to do with ffmpeg configuration (feel free to correct me, if I am wrong), it is a question of the Windows build environment and its configuration to switch to real static libararies output.

The ffmpeg configure script will hardcode certain compiler and linker flags as well as other parts of the various toolchain commands into the Makefiles depending on specified or detected toolchain+environment. So what you request needs to be enacted via the args to the configure script. Let me see if that's possible.

GyanD avatar Jul 24 '25 11:07 GyanD

Exactly. Yours is, in fact, the first request for such a build.

Strangely enough :). I believe that many use cases justify this type of a build. Imagine you need the ffmpeg's aac decoder for your Win project. Using the aac headers and linking with static libs your final binary will end up containing the aac decoder and some common stuff excluding the remaining 98 percent of ffmpeg. Using the current shared approach you will always depend on a very large dll.

There is also some confusion about the "lib" file extension in Win world. Not all lib files are real static libraries. E.g. the lib files in your shared build are just import lib files which you can link with just as with the static libs but you still need the dll to be around.

Let me see if that's possible.

Thanks. I am sure I wouldn't be the only one who would be happy with this build ;).

Alex18947 avatar Jul 25 '25 11:07 Alex18947

Thanks. I am sure I wouldn't be the only one who would be happy with this build ;).

I second that ;-)

f6fvy avatar Aug 27 '25 23:08 f6fvy