[Libav-user] Is libav thread-safe?

Paul B Mahol onemda at gmail.com
Wed Oct 9 15:52:14 CEST 2013

On 10/9/13, James Board <jpboard2 at yahoo.com> wrote:
>>Well, yes, you can call C from a C++ app. You need to mark the headers as C
>> when you include >them, but that's about it.
> Well, thanks for the help, but actually this isn't true.  I tried this with
> the demuxing.c example and that didn't work.
>>It sounds like you're trying to solve a problem that you don't have yet.
>  Start with the basics - just >getting going from a cold start in ffmpeg
> is enough trouble for most people, without trying to get >clever.
> Actually I have already wasted several weeks or months of coding time doing
> what you suggested: assume ffmpeg/libav works the way you want it, then
> start coding.  I think it's better to ask up front if libav is threadsafe
> before I spend a week implementing a multi-threaded app and then find out it
> can't possibly work because ffmpeg and libav are not thread-safe.
> I want to have multiple threads decoding different parts of the AVI file
> concurrently.  No encoding will occur.  Seems like it should be
> thread-safe.  But I'd like to know for sure before I start coding.  That's
> all.  Ask questions first, code later.  That stops me from complaining when
> libav doesn't do what I want.  I'll just choose another route.

If you use different AVCodecContext it should be fine, otherwise it will crash.

More information about the Libav-user mailing list