GStreamer RTP Streaming

显示  仅  | 搜索替代 

GStreamer RTP Streaming

GStreamer RTP Streaming


  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_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_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 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_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_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 pipeline

gst-launch -v gstrtpbin name=rtpbin $STREAM_AV

标签 (3)
标记 (2)

What version of the BSP was this tested on ? I get a "no element name gstrtpbin" error when using the im6 as as receiver. BSP 4.1.0

You need to include that element, which is inside the gst-plugin-good plugin.

See RTP Streaming using gstreamer fails - gstrtpbin element missing . Appears to have been some form of conflict

Anyone having any luck in getting the PC-to-iMX streaming to work ? I'm getting about 0.8 fps with the 4.1.0 BSP

What would be the recommended way to drop frame rate by half, or scale from 1080 to 720 before encoding?  Preferably, an approach which leverages hardware accelerators. 

Hi Leonardo,

I am trying to use above gstreamer commands with imx6 and I am getting this error - erroneous pipeline: no element "amrnbenc"

I am using Yocto 1.6. Can you tell me how to fix this ?


     I want to build the iMX-to-Android phone RTP streaming video transmission based on UDP protocol. Have you tried this? Some advise ?


     Thanks !



‎04-24-2013 10:56 AM