4 ms·
FFMpeg does have an API. It ships a few libraries (libavcodec, libavformat, and others) which expose a C api that is used in the ffmpeg command line tool. They
by codys 1y ago
FFMpeg does have an API. It ships a few libraries (libavcodec, libavformat, and others) which expose a C api that is used in the ffmpeg command line tool.
They publish doxygen generated documentation for the APIs, available here: https://ffmpeg.org/doxygen/trunk/ https://ffmpeg.org/doxygen/trunk/
- zahlman 1y agoDon't know how I overlooked that, thanks. Maybe because the one Python wrapper I know about is generating command lines and making subprocess calls.
- Wowfunhappy 1y agoThey're relatively low level APIs. Great if you're a C developer, but for most things you'd do in python just calling the command line probably does make more sense.
- f1shy 1y agoIt could even make sense in C. In some circumstances, I wouldn’t feel bad for cutting that corner.
- 1718627440 1y agoYes, that's what I did some time ago. I already want concurrency and isolation, so why not let the OS do that. Also I don't need to manage resources, when ffmpeg already does that.
- kaladin-jasnah 1y agoAs someone that used these APIs in C, they were not very well-documented nor intuitive, and oftentimes segfaulted when you messed up, instead of returning errors—I suppose the validation checks sacrifice performance for correctness, which is undesirable. Either way, dealing with this is not fun. Such is the life of a C developer, I suppose....
- javier2 1y agoIf you are processing user data, the subprocess approach makes it easier to handle bogus or corrupt data. If something is off, you can just kill the subprocess. If something is wrong with the linked C api, it can be harder to handle predictably.
- astrange 1y agoAlso because you can apply stricter sandboxing/jail/containerization to the process.
- ansk 1y agoFor future reference, if you want proper python bindings for ffmpeg* you should use pyav. * To be more precise, these are bindings for the libav* libraries that underlie ffmpeg