Jump to content

GstWebRTC - GstWebRTC Examples

From RidgeRun Developer Wiki

GstWebRTC Basics


Home

GstWebRTC Pipelines



Only Audio

Opus

Unidirectional

The following pipeline will send periodic ticks:

gst-launch-1.0  webrtcsink start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web audiotestsrc is-live=true wave=8 ! audioconvert ! audioresample \
! queue ! opusenc ! rtpopuspay ! web.audio


The following pipeline will receive the periodic ticks:

gst-launch-1.0 webrtcsrc start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web web.audio ! rtpopusdepay ! opusdec ! audioconvert ! \
alsasink async=false

When executing the two previous pipelines, you should be able to listen the ticks in the receiving computer.

Bidirectional

The following pipeline will send a white noise audio stream and receive the ticks audio stream sent by the next pipeline. This pipeline starts the call.

gst-launch-1.0 webrtcbin start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web audiotestsrc is-live=true wave=5 ! audioconvert ! \
audioresample ! queue ! opusenc ! rtpopuspay ! web.audio_sink web.audio_src ! rtpopusdepay ! \
opusdec ! audioconvert ! alsasink sync=false async=false

The following pipeline will send ticks audio stream and receive the white noise audio stream sent by the previous pipeline. This pipeline joins the call.

gst-launch-1.0 webrtcbin start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web audiotestsrc is-live=true wave=8 ! audioconvert ! \
audioresample ! queue ! opusenc ! rtpopuspay ! web.audio_sink web.audio_src ! rtpopusdepay ! \
opusdec ! audioconvert ! alsasink sync=false async=false

When executing the two previous pipelines, you should be able to listen the ticks and the white noise.

Only Video

H264

Unidirectional

The following pipeline will send a color bars h264 video stream:

gst-launch-1.0 webrtcsink start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
x264enc key-int-max=2 ! rtph264pay ! queue ! web.video

The following pipeline will receive the video stream and display it:

gst-launch-1.0 webrtcsrc start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web web.video ! rtph264depay ! avdec_h264 ! videoconvert \
! ximagesink async=true

You should be able to see a video pattern similar to Fig.1.

Fig.1 Snapshot of video received

Bidirectional

In this example two identical pipelines send a video stream and receive each other video stream. The following pipeline starts the call:

gst-launch-1.0 webrtcbin start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
x264enc key-int-max=2 ! rtph264pay ! queue ! identity silent=false ! web.video_sink web.video_src \
! rtph264depay ! avdec_h264 ! videoconvert ! ximagesink async=true

The following pipeline joins the call:

gst-launch-1.0 webrtcbin start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
x264enc key-int-max=2 ! rtph264pay ! queue ! identity silent=false ! web.video_sink web.video_src \
! rtph264depay ! avdec_h264 ! videoconvert ! ximagesink async=true

You should be able to see two windows with a video pattern similar to Fig.1.

Vp8

Unidirectional

The following pipeline will send a color bars vp8 video stream:

gst-launch-1.0 webrtcsink start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
vp8enc ! rtpvp8pay ! queue ! identity ! web.video

The following pipeline will receive the video stream and display it:

gst-launch-1.0 webrtcsrc start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web web.video ! rtpvp8depay ! vp8dec ! videoconvert ! \
ximagesink async=true

You should be able to see a video pattern similar to Fig.1.


Bidirectional

In this example two identical pipelines send a video stream and receive each other video stream. The following pipeline starts the call:

gst-launch-1.0 webrtcbin start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
vp8enc ! rtpvp8pay ! queue ! identity silent=false ! web.video_sink web.video_src ! rtpvp8depay ! \
vp8dec ! videoconvert ! ximagesink async=true

The following pipeline joins the call:

gst-launch-1.0 webrtcbin start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
vp8enc ! rtpvp8pay ! queue ! identity silent=false ! web.video_sink web.video_src ! rtpvp8depay \
! vp8dec ! videoconvert ! ximagesink async=true

You should be able to see two windows with a video pattern similar to Fig.1.

Audio and Video

Opus + H264

Unidirectional

The following pipeline will send periodic ticks and a video stream:

gst-launch-1.0  webrtcsink start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! x264enc key-int-max=2 ! \
rtph264pay ! web.video audiotestsrc is-live=true wave=8 ! audioconvert \
! audioresample ! queue ! opusenc ! rtpopuspay ! web.audio


The following pipeline will receive the video stream and the ticks and do the playback:

gst-launch-1.0 webrtcsrc start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web web.video ! rtph264depay ! avdec_h264 ! videoconvert ! \
ximagesink async=false web.audio ! rtpopusdepay ! opusdec ! audioconvert ! alsasink async=false

When executing the two previous pipelines, you should be able to listen the ticks in the receiving computer and see a video pattern similar to Fig.1.

Bidirectional

The following pipeline starts a call, sends white noise audio stream and a color bar video stream, and receives audio and video streams.

gst-launch-1.0 webrtcbin start-call=true signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
x264enc key-int-max=2 ! rtph264pay ! queue ! identity silent=false ! web.video_sink web.video_src \
! rtph264depay ! avdec_h264 ! videoconvert ! ximagesink async=true audiotestsrc is-live=true wave=5 \
! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay ! web.audio_sink web.audio_src ! \
rtpopusdepay ! opusdec ! audioconvert ! alsasink async=false

The following pipeline joins the call, sends ticks audio stream and a color bar video stream, and receives audio and video streams.

gst-launch-1.0 webrtcbin start-call=false signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web videotestsrc is-live=true ! queue ! videoconvert ! \
x264enc key-int-max=2 ! rtph264pay ! queue ! identity silent=false ! web.video_sink web.video_src \
! rtph264depay ! avdec_h264 ! videoconvert ! ximagesink async=true web.audio_src ! rtpopusdepay ! \
opusdec ! audioconvert ! alsasink async=false audiotestsrc is-live=true wave=8 ! audioconvert ! \
audioresample ! queue ! opusenc ! rtpopuspay ! web.audio_sink

After executing the two previous pipelines you should be able to see two windows with a pattern like Fig.1, and hear white noise and ticks audio streams.



GstWebRTC Basics


Home

GstWebRTC Pipelines


Cookies help us deliver our services. By using our services, you agree to our use of cookies.