<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Yurii,<div><br></div><div>In the mean time it occurred to me precisely this approach. It seems to be working! :)</div><div><br></div><div>Thank you very much for your reply</div><div><br></div><div>Best,<br><br><div dir="ltr">--<div>Nuno Santos</div></div><div dir="ltr"><br><blockquote type="cite">No dia 11/12/2021, às 18:12, Yurii Monakov <monakov.y@gmail.com> escreveu:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="auto">You can derive your video pts from audio pts by rescaling and call av_interleaved_write_frame. Mixer will do the rest.</div><div dir="auto"><br></div><div dir="auto">Yurii</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пт, 10 дек. 2021 г. в 12:23, Nuno Santos <<a href="mailto:nuno.santos@imaginando.pt">nuno.santos@imaginando.pt</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I’m generating a visual feed that is reacting to audio. Both audio and video are being generated in real time, each in its own thread.<br>
<br>
While the audio generation is always steady, video generation is not precise and can have fluctuations.<br>
<br>
While the muxing example provides a good start on how to use ffmpeg for audio and video muxing, it doesn’t cover synchronisation aspects since the video and the audio are generated in the same loop, on demand, without any possible fluctuation.<br>
<br>
I’m trying to achieve perfect synchronisation between audio and video but I feel I’m navigating uncharted terrains here.<br>
<br>
Some problems that I have identified but don’t have a proper solution at the moment:<br>
<br>
- the audio buffer can start having samples sooner than the video buffer of vice-versa. Ideally the first frame of video should match the first frame of audio. <br>
- I’m already rescaling the video pts and dts to adjust the video generation fluctuations but audio is always a fixed value and cannot fluctuate<br>
<br>
Are there examples that show how to achieve this? What are the best practices? <br>
<br>
Thank you!<br>
<br>
Best regards,<br>
<br>
Nuno<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<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".<br>
</blockquote></div></div>
<span>_______________________________________________</span><br><span>Libav-user mailing list</span><br><span>Libav-user@ffmpeg.org</span><br><span>https://ffmpeg.org/mailman/listinfo/libav-user</span><br><span></span><br><span>To unsubscribe, visit link above, or email</span><br><span>libav-user-request@ffmpeg.org with subject "unsubscribe".</span><br></div></blockquote></div></body></html>