<div dir="ltr"><div dir="ltr"><div dir="ltr">I can only respond to question (1), and the answer is yes, but you must define your own lock manager. See <a href="https://stackoverflow.com/questions/13888915/thread-safety-of-libav-ffmpeg">https://stackoverflow.com/questions/13888915/thread-safety-of-libav-ffmpeg</a> for more details. There are a few particular methods that have thread safety concerns. IIRC, writing frames is one. Opening a codec is also not thread safe: <a href="https://stackoverflow.com/questions/15366441/ffmpeg-which-functions-are-multithreading-safe">https://stackoverflow.com/questions/15366441/ffmpeg-which-functions-are-multithreading-safe</a></div><div dir="ltr"><br></div><div>HTH,</div><div>Michael</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 27, 2019 at 5:55 AM BIGLER Don (Framatome) <<a href="mailto:don.bigler@framatome.com">don.bigler@framatome.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_7927211256229812534WordSection1">
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif">All,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif">I am writing an application that displays, encodes, and muxes live video using libav as the backend. The audio and video encoding occurs asynchronously in the background,
each in its own thread, such that the encoded packets arrive to the av_interleaved_write_frame() function call at different times. H.264 video encoding by itself works fine. However when I add audio, the audio is out of sync from the video even though the
audio and video pts are in sync (from avdevice using the matroska muxer). The cause of the problem is not clear to me. Specifically, here are my questions:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="gmail-m_7927211256229812534MsoListParagraph"><u></u><span style="font-size:10pt;font-family:Arial,sans-serif"><span>1.<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:10pt;font-family:Arial,sans-serif">Can the av_interleaved_write_frame() function handle multithreaded asynchronous calls for audio and video streams?
<u></u><u></u></span></p>
<p class="gmail-m_7927211256229812534MsoListParagraph"><u></u><span style="font-size:10pt;font-family:Arial,sans-serif"><span>2.<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:10pt;font-family:Arial,sans-serif">The transcoding example uses a filter graph using buffer/abuffer filters. My current implementation does not use the buffer/abuffer filters because I am not applying
any filters before encoding. Are they required for my situation?<u></u><u></u></span></p>
<p class="gmail-m_7927211256229812534MsoListParagraph"><u></u><span style="font-size:10pt;font-family:Arial,sans-serif"><span>3.<span style="font:7pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:10pt;font-family:Arial,sans-serif">The encoding happens randomly within the stream such that the first pts received by the muxer is not zero. Is this required?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif">I will greatly appreciate any assistance!<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif">Don Bigler<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif"><u></u> <u></u></span></p>
</div>
</div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>