Playing and streaming, is it possible?

Paulo Paiva paivalhao at gmail.com
Thu Jun 2 08:28:18 PDT 2011


On 06/02/2011 03:58 PM, Jose Antonio Santos Cadenas wrote:
> Hi,
>
> 2011/6/2 Paulo Paiva<paivalhao at gmail.com>:
>> Hello all!
>>
>> I'm struggling here trying to play the video acquired from the web-cam and
>> stream it simultaneously but it isn't working. Here goes my pipeline
>> (inspired in the examples given):
>>
>> #!/bin/sh
>>
>> # Destination of the stream
>> DEST=127.0.0.1
>>
>> # Tuning parameters to make the sender send the streams out of sync. Can be
>> used
>> # ot test the client RTCP synchronisation.
>> VOFFSET=0
>> AOFFSET=0
>>
>> # Video setup
>> VELEM="v4l2src "
>> VCAPS="video/x-raw-yuv,width=352,height=288,framerate=20/1"
>> VSOURCE="$VELEM ! $VCAPS ! queue ! ffmpegcolorspace"
>> VENC="x264enc tune=zerolatency byte-stream=true bitrate=550 threads=0
>> speed-preset=3"
>>
>> # Video transmission setup
>> VRTPSINK="udpsink port=5000 host=$DEST ts-offset=$VOFFSET name=vrtpsink"
>> VRTCPSINK="udpsink port=5001 host=$DEST sync=false async=false
>> name=vrtcpsink"
>> VRTCPSRC="udpsrc port=5005 name=vrtpsrc"
>>
>> # Audio setup
>> AELEM="pulsesrc"
>> ASOURCE="$AELEM ! queue ! audioconvert"
>> AENC=" faac! rtpmp4apay"
>>
>> # Audio transmission setup
>> ARTPSINK="udpsink port=5002 host=$DEST ts-offset=$AOFFSET name=artpsink"
>> ARTCPSINK="udpsink port=5003 host=$DEST sync=false async=false
>> name=artcpsink"
>> ARTCPSRC="udpsrc port=5007 name=artpsrc"
>>
>> # Pipeline construction
>> gst-launch -v gstrtpbin name=rtpbin             \
>>      $VSOURCE ! tee name=v ! autovideosink v. ! $VENC ! rtph264pay !
>> rtpbin.send_rtp_sink_0   \
>>          rtpbin.send_rtp_src_0 ! $VRTPSINK       \
>>          rtpbin.send_rtcp_src_0 ! $VRTCPSINK     \
>>            $VRTCPSRC ! rtpbin.recv_rtcp_sink_0   \
>>      $ASOURCE ! $AENC ! rtpbin.send_rtp_sink_1   \
>>          rtpbin.send_rtp_src_1 ! $ARTPSINK       \
>>          rtpbin.send_rtcp_src_1 ! $ARTCPSINK     \
>>            $ARTCPSRC ! rtpbin.recv_rtcp_sink_1
>>
>> Has all can see I got a tee after the acquisition, after that autovideosink
>> in order to displays and I pass on the video flux for streaming.
>>
>> The output of execution is:
>>
>> $ sh v4l2server.sh
>> Setting pipeline to PAUSED ...
>> /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: actual-buffer-time = 47551927
>> /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: actual-latency-time = 9977
>> /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0.GstPad:src: caps =
>> audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16,
>> depth=(int)16, rate=(int)44100, channels=(int)1,
>> channel-positions=(GstAudioChannelPosition)<
>> GST_AUDIO_CHANNEL_POSITION_FRONT_MONO>
>> ERROR: Pipeline doesn't want to pause.
>> ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not
>> negotiate format
>> Additional debug info:
>> gstbasesrc.c(2811): gst_base_src_start ():
>> /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
>> Check your filtered caps, if any
>> Setting pipeline to NULL ...
>> /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0.GstPad:src: caps = NULL
>> Freeing pipeline ...
>>
>> The last message makes suggestion to look at the caps, but removing the tee
>> element and the autovideosink it works.
>>
>> Any ideas/suggestions  would be great!!
> Have you tried using a queue on each tee branch as is recomended on
> tee documentation page?
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-tee.html#gstreamer-plugins-tee.description
>
> Regards
Thanks for the quick reply Jose Cadenas!

Well after doing a easier version of what I'm trying to do, just record 
and play, I came up with the solution (lines changed):

VCAPS="video/x-raw-yuv,width=352,height=288,framerate=20/1 ! tee name=v"

gst-launch -v gstrtpbin name=rtpbin             \
     $VSOURCE ! $VENC ! rtph264pay ! rtpbin.send_rtp_sink_0 \
         rtpbin.send_rtp_src_0 ! $VRTPSINK       \
         rtpbin.send_rtcp_src_0 ! $VRTCPSINK     \
           $VRTCPSRC ! rtpbin.recv_rtcp_sink_0   \
           v. ! queue ! ffmpegcolorspace ! autovideosink    \
     $ASOURCE ! $AENC ! rtpbin.send_rtp_sink_1   \
         rtpbin.send_rtp_src_1 ! $ARTPSINK       \
         rtpbin.send_rtcp_src_1 ! $ARTCPSINK     \
           $ARTCPSRC ! rtpbin.recv_rtcp_sink_1

Cheers all!
Paulo Paiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110602/3d690fc9/attachment.html>


More information about the gstreamer-devel mailing list