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

Marco Sieber l-spy at web.de
Thu Jul 17 14:36:18 CEST 2014


   >Are you manipulating the timebase and the DTS / PTS from the input before you give it to the encoding / muxing functions?
   >Are you passing the proposed DTS / PTS from the ffmpeg encoding functions to the muxer, or are you manipulating them in between?

Thank you for posting. 

The worst thing about this is testing to wait for transcoder and then watch at least 4min-5min... its not feeling like development.

Yes i adjust the timebase, i had to.. for some clips the timebase looked rly weird .. the Input Stream and InputCodecContex values, like 1/25000 for both stream and codec, i changed it for output 1/25 for codec and stream get changed to 1/90000, it was a trial&error attempt which made it feel better. But the decoding function still gets these 1/25000.

But anyway, with the transcode example, there is the same problem and its only what its already does with time_base,pts and dts.
I would guess that there is 1s up to 2s between audio and video when it starts to get out of sync.

In my own Transcoder i increment the frame pts with +1, each loop, for video and audio. And then rescaling it with av_rescale_q_rnd after encoding is done, so before i write the frames/packet i scale the pts/dts for that i use codeccontext timebase and stream timebase, tried other things too but didnt change anything. Thats all i do with pts/dts. And the pts/dts incrementation for video and audio doesn't look wrong to me.

+512 for video (0:00:00.040000) 25fps,90khz 
+1024 for audio (or sometimes less), 48khz

And in ffprobe the incremntation is always the same... the only thing i noticed with ffprobe it starts with audio frames and the start time is different from the orginal source (1 audioframe length).









More information about the Libav-user mailing list