[FFmpeg-trac] #692(undetermined:open): Audio is not in sync with video, webcam capturing

FFmpeg trac at avcodec.org
Sat Sep 1 03:20:27 CEST 2012


#692: Audio is not in sync with video, webcam capturing
-------------------------------------+-------------------------------------
             Reporter:  burek        |                    Owner:
                 Type:  defect       |                   Status:  open
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:  v4l2 alsa    |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  1
-------------------------------------+-------------------------------------

Comment (by ewhac):

 I'm seeing the same problem, using a Pinnacle Dazzle DVC-100.  Audio and
 video recorded from the device using ffmpeg are out of sync.  However,
 they are out of sync differently depending on the order in which you
 specify the inputs on the command line.

 I tried two invocations:

 {{{
 ffmpeg  -f alsa -i hw:1,0  -f v4l2 -i /dev/video0  -acodec mp2 -b:a 384k
 -vcodec mpeg2video -b:v 8000k -f mpegts badsync-av.mpg -report
 }}}

 This first one specifies the audio input on the command line first.  In
 the [http://ewhac.org/vid/badsync-av.mpg final file], the audio is very
 late relative to the video.

 {{{
 ffmpeg  -f v4l2 -i /dev/video0  -f alsa -i hw:1,0  -acodec mp2 -b:a 384k
 -vcodec mpeg2video -b:v 8000k -f mpegts badsync-va.mpg -report
 }}}

 This second one specifies the video input on the command line first.  In
 the [http://ewhac.org/vid/badsync-va.mpg final file], the audio is
 slightly early relative to the video.

 All other arguments are identical.  I've attached the -report logs to this
 bug.

 Based on this behavior, I would guess that the input streams are not being
 synchronized/flushed before writing of the output file begins.  In other
 words, stale data is accumulating in the FIFO of one device while the next
 one is being opened.  In the case of a V4L2 device, this can take non-
 trivial time, allowing large amounts of audio data to accumulate.

 Hopefully this was of some help to someone.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/692#comment:15>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list