[FFmpeg-devel] ffprobe as library rather than CLI

Tobias Rapp t.rapp at noa-archive.com
Fri May 14 17:40:49 EEST 2021


On 12.05.2021 15:52, Timo Rothenpieler wrote:
> On 12.05.2021 15:19, Samuel Marks wrote:
>> Started hacking around to make it work. So I changed the `main` to a:
>>
>> extern int ffprobe(int argc, char **argv);
>>
>> Then I added a header with a prototype of the same, and started
>> messing with vcpkg + CMake to try and get it to build correctly.
> 
> That's not going to work.
> The whole thing is not designed to be called more than once, and you can 
> be close to certain that it's going to fail miserably and in unexpected 
> ways.
> 
> Use the libraries if you want to integrate ffmpeg functionality into 
> your own application.

Another alternative would be to run ffprobe as a separate process using 
fork() and execv() on Linux, or CreateProcessW() on Windows. Optionally 
you can use pipes to redirect the stdout of ffprobe to your parent 
application.

A quick online search finds this code example for C (have not tested it 
but the general concept looks fine to me):
https://stackoverflow.com/a/83456

Good luck,
Tobias



More information about the ffmpeg-devel mailing list