GStreamer RTP Streaming

Document created by Leonardo Sandoval Gonzalez Employee on Apr 24, 2013Last modified by Leonardo Sandoval Gonzalez Employee on Oct 25, 2013
Version 9Show Document
  • View in full screen mode

Notes:

  1. First run the playback pipeline then the streaming pipeline.
  2. The above example streams H263 video and AMR audio data. Change codec format to your needs.
  3. In case where the iMX is the streaming machine, the audio encoder 'amrnbenc' must be installed before. This scenario has not been tested

 

 

Shell variables and pipelines
Playback machine (receiver)

# On playback machine, set either IMX2PC or PC2IMX variables, then run the pipeline

 

 

## IMX2PC: Case where PC does the playback

    AUDIO_DEC_SINK="rtpamrdepay ! amrnbdec ! alsasink "

    VIDEO_CAPS="\"application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998\""

    VIDEO_DEC_SINK="rtph263pdepay ! ffdec_h263 ! autovideosink"

## End of IMX2PC Settings

 

 

## PC2IMX: Case where iMX does the playback

    AUDIO_DEC_SINK="rtpamrdepay ! mfw_amrdecoder ! alsasink "

    VIDEO_CAPS="\"application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998\""

    VIDEO_DEC_SINK="rtph263pdepay ! vpudec ! mfw_v4lsink "

## End of PC2IMX Settings

 

 

 

PLAYBACK_AUDIO="udpsrc caps=\"application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1\" \

            port=5002 ! rtpbin.recv_rtp_sink_1 \

        rtpbin. ! $AUDIO_DEC_SINK \

     udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \

     rtpbin.send_rtcp_src_1 ! udpsink port=5007 sync=false async=false"

 

 

PLAYBACK_VIDEO="udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \

        rtpbin. ! $VIDEO_DEC_SINK \

        udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \

        rtpbin.send_rtcp_src_0 ! udpsink port=5005 sync=false async=false"

 

 

 

PLAYBACK_AV="$PLAYBACK_VIDEO $PLAYBACK_AUDIO"

 

 

 

# Playback pipeline

gst-launch -v gstrtpbin name=rtpbin $PLAYBACK_AV

Streaming Machine (sender)

# On Streaming machine, set either IMX2PC or PC2IMX variables, then run the pipeline

 

 

## IMX2PC: Case where iMX does the streaming

    IP=x.x.x.x # IP address of the playback machine

    VIDEO_SRC="mfw_v4lsrc"

    VIDEO_ENC="vpuenc codec=h263 ! rtph263ppay "

   AUDIO_ENC="audiotestsrc ! amrnbenc ! rtpamrpay "

## END IMX2PC settings

 

## PC2IMX: Case where PC does the streaming

    IP=y.y.y.y # IP address of the playback machine

    VIDEO_SRC="v4l2src"

    VIDEO_ENC="ffenc_h263 ! rtph263ppay "

    AUDIO_ENC="audiotestsrc ! amrnbenc ! rtpamrpay "

# END PC2PC settings

 

 

STREAM_AUDIO="$AUDIO_ENC ! rtpbin.send_rtp_sink_1 \

        rtpbin.send_rtp_src_1 ! udpsink host=$IP port=5002 \

        rtpbin.send_rtcp_src_1 ! udpsink host=$IP port=5003 sync=false async=false \

        udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1"

 

 

STREAM_VIDEO="$VIDEO_SRC ! $VIDEO_ENC ! rtpbin.send_rtp_sink_0 \

        rtpbin.send_rtp_src_0 ! queue ! udpsink host=$IP port=5000 \

        rtpbin.send_rtcp_src_0 ! udpsink host=$IP port=5001 sync=false async=false \

        udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0"

 

 

STREAM_AV="$STREAM_VIDEO $STREAM_AUDIO"

 

 

# Stream pipeline

gst-launch -v gstrtpbin name=rtpbin $STREAM_AV

1 person found this helpful

Attachments

    Outcomes