Audio lags video for avi movie

William Salibrici bsalibrici at latticeinc.com
Thu Jun 9 21:36:55 UTC 2016


I have the following recording pipeline [in C code] which runs ok on my windows 7 x86system. The recording captures audio and video from my computer's mic and camera and creates a movie file. The appsrc is running in push mode and the video buffer timestamps are correct. Each video buffer timestamp matches the moment this data has been captured according to the pipeline clock, minus the configured base time. The directsoundsrc element is providing the clock for the pipeline.

 appsrc is-live=TRUE ! videoconvert ! vp8enc ! queue !

 mux. directsoundsrc device-name="Microphone Array" !

 audioconvert ! audio/x-raw,format=S16LE,rate=8000,channels=1 !

opusenc ! queue ! mux. oggmux name=mux !

 filesink location=C:/movie.ogg

I use the following pipeline with the launch tool for playback and all is well. Audio and video are in sync.

 filesrc location=C:/movie.ogg do-timestamp=TRUE !

 oggdemux name=demux demux. ! queue ! vp8dec ! videoconvert !

 d3dvideosink demux. ! queue ! opusdec ! audioconvert ! directsoundsink

The problem occurred when I changed the recording pipeline [in C code] to use different video encoding, no audio encoding [for smallest audio latency], and a different muxer. Notice I kept the audio format caps filter the same. Recording runs ok but playback has the audio lagging the video by a small amount [a few seconds] that appears to be constant. Playback using the standard windows media player has the same result.

 appsrc is-live=TRUE ! videoconvert ! openh264enc ! h264parse ! queue !

 mux. directsoundsrc device-name="Microphone Array" !

 audio/x-raw,format=S16LE,rate=8000,channels=1 !

audioconvert ! mux. avimux name=mux !

 filesink location=C:/movie.avi

Here is the playback pipeline [using the launch tool] for the second recording:

filesrc location=C:/movie.avi ! avidemux name=demux demux. !

video/x-h264,stream-format=byte-stream,alignment=au ! h264parse !

queue ! openh264dec ! videoconvert ! d3dvideosink demux. !

queue ! audioconvert ! directsoundsink

Here are my two questions for the second record pipeline where audio lags video:

  1.  What is causing the audio to lag the video?
  2.  What would be the best way to add a fixed latency to the video leg in the recording pipeline so that audio and video are in sync for playback? My customer application requires the standard windows media player for playback so I can't tweak the playback properties.

I'm using GStreamer 1.6.4 with your windows pre-built binaries.
Thank you,
Bill Salibrici
Lattice Incorporated
http://www.latticeinc.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160609/65ec804f/attachment.html>


More information about the gstreamer-devel mailing list