[Libav-user] Synchronization of audio and video streams during muxing
explomaster at gmail.com
Sat Mar 17 18:34:03 EET 2018
Hi, I am rewriting some messy FFMPEG code I wrote a while ago.
My reference is muxing.c
The difference I have is that my audio stream comes from file (AAC) ,while
come from generated pixel frame.
I mostly have it working,but my problem is interleaved packets write.If I
do it like the example,that's
int cc = av_compare_ts(mVideoOutStream.next_pts,
if (mAudioOutStream.st == NULL || cc <= 0)
I am not getting correct results.
The only way it looks fine is if I do it like this:
//Write video frame first ,always!
if(cc > 0)
//write audio packets.
I don't understand why it works only in this case. From what I
understood av_interleaved_write_frame() should take care of the correct
interleaving. But I see that I must write video frames always,and audio
packets only when av_compare_ts is greater than zero.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user