[Ffmpeg-devel] Audio-video sync problem when transcoding to xvid in AVI

Harikrishnan Varma hvarma
Tue Mar 14 01:13:56 CET 2006


Hi,
 When using ffmpeg to transcode certain vob files to xvid, the
audio-video tracks of the encoded file were out of sync. This happened
irrespective of whether the audio or video stream was used for syncing.

Investigating specific clips, I noticed that a lot of contigous frames
were being dropped (in ffmpeg.c:do_video_out()) after the point of SCR
reset and resulting PTS rewind in the input vob. Since frame dropping
didn't happen at all SCR reset points, it seemed to be the magnitude of
the negative PTS delta that was causing this to happen. 
When the delta threshold to update input_files_ts_offset in ffmpeg.c was
changed, it stopped dropping frames.

The following condition:
if(ABS(delta) > 10LL*AV_TIME_BASE && !copy_ts)
Was changed to:
if(ABS(delta) > 1LL*AV_TIME_BASE && !copy_ts)

As a result of this, input_files_ts_offset was updated, which meant
get_sync_ipts() called from do_video_out() had updated values after the
SCR reset (PTS rewind)

Why was a factor of 10 used for comparing the delta magnitude?

Regards,
 Harikrishnan






More information about the ffmpeg-devel mailing list