[Libav-user] Fw: strange H264 audio sync behavior

Marco Sieber l-spy at web.de
Mon Jul 21 11:17:02 CEST 2014


Thank you very much for your patient.

> This is unclear to me: "changed it for output 1/25 for codec and stream get changed to 1/90000"
> Are you setting it now to 1/25 or to 1/90000 ?

Sorry, if i was unclear. I take over the Framerate from InputVideoStream->r_frame_rate and set it to OutputVideoCodec->time_base and OutputVideoStream->r_frame_rate.
Then avformat_new_stream, set the OutputVideoStream->time_base to 1/90000, i guess as default for mp4. But after avformat_write_header, the OutputVideoStream->time_base changes to 1/12800.
And OutputAudioStream->time_base and AudioCodec is 1/48000.


>Why don't you set all to 1/1000, the same value, then it's easy to see if audio and video DTS runs apart after a while.

I can try this and play a little bit but i guess its only for pts/dts, and you cant actually watch the video.


>When you check with ffprobe, do audio and video still have about the same (resulting) DTS/PTS after 5 minutes, or at the end of the movie?

No, but kinda the same duration (only 1 audioframe different), the both Streams has the same length.


>And if that's ok then make sure there are no different values set for timebase or codec parameters in the single streams and in the container. I think that is what >your problem is, why ffplay/VLC stays sync and QT not.

Okay ... hmmm.. but video and audio stream, doesnt they need different timebases? Because, you want video stream with 90khz and audio 48khz?


More information about the Libav-user mailing list