[FFmpeg-devel] questions about multi-thread issues for ffmpeg

Ronald S. Bultje rsbultje at gmail.com
Thu Sep 8 12:56:07 EEST 2016

Hi Andrew,

On Thu, Sep 8, 2016 at 3:59 AM, qw <applemax82 at 163.com> wrote:

> I have made one simple transcoding program by using ffmpeg lib, where
> several av transcoding tasks are done in one process and each task
> corresponds to one thread.
> But some ffmpeg function will report error, and sometimes the multi-thread
> version of transcoding program will crash abnormally.
> For example, av_guess_format("mp4", NULL, NULL) returns error accidentally
> with several concurrent tasks. And transcoding program will crash, when
> calling av_interleaved_write_frame ().

Have you tried running this under valgrind? It is typically very helpful to
see what causes the crash.

does ffmpeg support multi-thread in this case? If not, which ffmpeg
> functions should be synchronized by application developer?

Yes, ffmpeg supports multi-threading (internally), it is tested
continuously and is considered very safe.

Can you show some code? I'm wondering if your use is unusual.


More information about the ffmpeg-devel mailing list