RTSP Audio/video streaming using shmsink and shmsrc


i am getting audio and video from v4l2src and alsasrc and encode it and share it over shmsink using below Gstreamer pipeline.

gst-launch-1.0 -v v4l2src do-timestamp=true ! video/x-raw,width=640,height=480,format=I420,framerate=30/1 ! tee name=t ! queue ! shmsink socket-path=/tmp/foo sync=true wait-for-connection=false shm-size=10000000 t. ! queue ! x264enc tune=zerolatency key-int-max=30 ! rtph264pay ! shmsink socket-path=/tmp/test shm-size=10000000 wait-for-connection=false alsasrc ! queue ! audioconvert ! lamemp3enc ! rtpmpapay ! shmsink socket-path=/tmp/audio wait-for-connection=false shm-size=1000000

Then i am opening another terminal for streming video and audio using shmsrc and rtspserver with below pipeline:

./test-launch “( shmsrc socket-path=/tmp/test do-timestamp=true ! application/x-rtp,clock-rate=90000 ! rtph264depay ! rtph264pay name=pay0 pt=96 ! shmsrc socket-path=/tmp/audio do-timestamp=true ! application/x-rtp,media=audio,clock-rate=90000,encoding-name=MPA ! rtpmpadepay ! rtpmpapay name=pay1 pt=97 )”

i am getting video on VLC player but i am not getting audio on vlc player.

i am getting below log on first pipeline when i closed the second pipeline:

WARNING: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Can’t record audio fast enough
Additional debug info:
gstaudiobasesrc.c(869): gst_audio_base_src_create (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0:
Dropped 142884 samples. This is most likely because downstream can’t keep up and is consuming samples too slowly.

what can i change in that pipeline to achieve audio/video streaming with sync.

You may try to replace alsasrc with audiotestsrc and check if the issue is still there. See if the issue is specific to the alsasrc.

Here is a reference pipeline: