Encoding and streaming video+audio to UDP

Tim Müller tim at centricular.com
Mon Jul 28 02:54:47 PDT 2014


On Sun, 2014-07-27 at 23:50 -0700, dmitrijs2005 wrote:

> Thank you, Tim, you have been very helpful!
> Well, my last command (with some improvements) looks like this:
> 
> gst-launch-1.0 -e \
> mpegtsmux alignment=7 name=mux ! \
> rndbuffersize max=1316 min=1316 ! \
> udpsink host=127.0.0.1 port=5000 sync=false \
> decklinksrc mode=10 name=src \
> src. ! audio/x-raw ! queue leaky=1 !  audioconvert ! \
> voaacenc bitrate=128 ! aacparse ! mux. \
> src. -v ! videoscale ! videoconvert !  video/x-raw,format=\(string\)I420,
> width=640,height=360 ! queue leaky=1 ! videoconvert ! \
> x264enc bitrate=1000 ! h264parse ! mux.
> 
> But now I'm experiencing issues with audio and video synchronization
> What should I do to improve the situation?

Why are you using leaky queues? That's probably not really what you want
(it probably hacks around another issue, like x264enc having very high
latency by default, which you can circumvent by using x264enc
tune=zerolatency). Although the leaky queues shouldn't affect A/V sync.

First try decoding+outputting the video+audio you capture. If that stays
in sync, then save the tsmux output to a file and try playback of the
file. Also try different encoder/muxer combinations to see if it depends
on the elements used. You could also try adding an 'audiorate' element
before the audio encoder.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list