ffmpeg – Is it possible to redirect the messages libffmpeg prints to stderr?

I’m writing a program that uses libffmpeg to do some transcoding internally, but I find it has a tendency to print a lot of things to the process’s stderr. I want to redirect those messages somewhere more intelligent.

To be clear, I am NOT talking about spawning the ffmpeg executable as a subprocess and redirecting its stdio! That is trivial in any programming language. I’m using ffmpeg as a C library (well, Rust bindings around a C library in my case) and I’m wondering if libffmpeg provides a hook for writing to stderr that I can override.

If no such hook exists, would my best bet be to fork a child process with stdio redirection and only use libffmpeg from that subprocess? That feels really hacky to me, especially since it would be really nice to not have to send the results libffmpeg spits out across a process boundary.

Read more here: Source link