Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8991133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:39:22+00:00 2026-06-15T22:39:22+00:00

Is LibAV/FFMpeg thread safe? For example. Could I read from a file using AVFormatContext*

  • 0

Is LibAV/FFMpeg thread safe? For example. Could I read from a file using AVFormatContext* in one thread and decode the read packet it in another with simple additions of mutexes or is the thread safetyness of the library a "don’t know don’t care" type deal? I know that libav has basic support for encoder threads but I’m trying more of a blackbox type approach where I break it up into multiple threads (Source -> Decoder -> Filter -> Encoder -> Sink) and trying to understand the complications of such.

Anyone with any experience with ffmpeg and threads and would like to chime in with any other info pertinent to this would also be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:39:23+00:00Added an answer on June 15, 2026 at 10:39 pm

    You can register your own lock manager. The ffmpeg library will control thread safety.

    Example:

    ::av_lockmgr_register(&my_lockmgr_cb);
     
    
     //// ..........
    
    int my_lockmgr_cb(void **mutex, enum AVLockOp op)
    {
      if (NULL == mutex)
        return -1;
    
      switch(op)
      {
       case AV_LOCK_CREATE:
       {
        *mutex = NULL;
        boost::mutex * m = new boost::mutex();
        *mutex = static_cast<void*>(m);
        break;
       }
       case AV_LOCK_OBTAIN:
       {
        boost::mutex * m =  static_cast<boost::mutex*>(*mutex);
        m->lock();
        break;
       }
       case AV_LOCK_RELEASE:
       {
        boost::mutex * m = static_cast<boost::mutex*>(*mutex);
        m->unlock();
        break;
       }
       case AV_LOCK_DESTROY:
       {
        boost::mutex * m = static_cast<boost::mutex*>(*mutex);
        delete m;
        break;
       }
       default:
       break;
      }
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode an MP4 file i've created using mp4creator library. I can't
I'm attempting to using the libav libraries with Qt to decode h.264 UDP video
I am using FFMPEG to transcode a large file to a smaller file. Usually
I am running the example code of the latest FFMpeg-library. I have inserted the
I would like a simple working example of using just libavformat to mux video.
I am running gcc compiler on ubuntu i am using an example to learn
I'm having a bit of trouble trying to encode a video using libav. I
I am trying to compile some simple code using the libav libraries. // Some
I am recording H.264 (640x480 @1fps 10seconds) in avi container using FFMPEG. When I
I use this ffmpeg command to take clips from a large VOB files that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.