[FFmpeg-trac] #8443(undetermined:new): A/V drift when reencoding NTSC

FFmpeg trac at avcodec.org
Thu Dec 26 03:00:43 EET 2019

#8443: A/V drift when reencoding NTSC
             Reporter:               |                     Type:  defect
  madscientist159                    |
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:

 I have been having significant difficulty with A/V sync drift in ffmpeg
 (live streaming applications), which unfortunately do not lend themselves
 well to debugging by most ffmpeg developers.  In the process of debugging
 the live stream, I was able to reproduce the A/V sync problems with the
 attached input file, which was specifically built to find A/V desync

 The input file is very simple.  It is a 24000/1001 (NTSC) MPEG2 sync check
 file, with every 24th frame showing a coinciding tone and white flash.
 This file was assembled by mencoder, and I have verified that the audio
 tones are sent exactly once every 1.001 seconds in the output file.

 The ffmpeg command below simply overlays the audio waveform back over the
 video frames.  If ffmpeg was processing this input file correctly, each
 white frame should have the audio tone starting at exactly the same
 position.  Unfortunately, as you can see, the audio tone in fact drifts
 significantly (in fact it often ends up in the adjacent frame).  In
 addition to this obvious desync with ~4.004s periodicity, there is a very
 slight continual desync of the audio even when only looking at the output
 every 4.004s.  Interestingly, 4.004s is the normal self-sync period for
 audio and video frames in NTSC content, indicating something may be wrong
 with how the underlying A/V frames ('''not''' video frames!) are handled /
 decoded / encoded.

 How to reproduce:
 % ffmpeg -y -copyts -i sample.mpeg -filter_complex "[0:a]
 [waveview]; [0:v][waveview] overlay=0:H/2" --acodec copy -f dvd

 ffmpeg built from GIT master

 Note that the attached segment file was trivially reduced with dd, as the
 original file is far too large to attach.  This should not affect the
 results given that this is a transport stream file.

Ticket URL: <https://trac.ffmpeg.org/ticket/8443>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list