Ffmpeg: which functions are multithreaded?

I read (somewhere, I don’t remember and did not find it now - maybe the question would be obsolete for me anyway) that some FFmpeg functions are unsafe for calling from multiple threads at the same time.

FFmpeg itself is not multithreaded in the sense that you should not call av_read_frame or avcodec_decode_audio4 in the same context from different threads at the same time, but this is mostly obvious.

But, for example, it seems that avformat_find_stream_info even in individual contexts, is unsafe to be called from different threads at the same time. To make this safe, you will need a global mutex.

Is there a list of features that are not safe?

+7
source share
1 answer

Some discussions I found: here or here

From what I have found so far, it seems that only avcodec_open and avcodec_close are not thread safe.

However, the correct solution is to use av_lockmgr_register to register the mutex handler with FFmpeg, which is then automatically called by FFmpeg in the necessary places. See here or here . Chrome also does this, see here .

+9
source

All Articles