GstWebRTC - H264-Opus Examples

From RidgeRun Developer Wiki
Revision as of 15:38, 8 August 2017 by Jcaballero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Audio + Video


Home

Vp8 + Opus



This page presents the GstWebRTC H264 and Opus video and audio examples with the OpenWebRTC signaler.

Unidirectional Elements

Example

In this example we use webrtcsink to send a video stream and an audio stream, and we use webrtcsrc to receive the video and audio streams.

Send Pipeline

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

gst-launch-1.0  webrtcsink start-call=true signaler=GstOwrSignaler 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

Receive Pipeline

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

gst-launch-1.0 webrtcsrc start-call=false signaler=GstOwrSignaler 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.

Fig.1 Snapshot of video received



Bidirectional Element

Example

In this example we use two webrtcbins, each send a video stream and an audio stream, and receives each other video and audio streams.

Send-Receive Pipeline

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=GstOwrSignaler 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

Send-Receive Pipeline

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=GstOwrSignaler 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

When executing the two previous pipelines, you should be able to listen the ticks and whitenoise audio streams and see two windows with video patterns similar to Fig.1.


Example

In this example we use two webrtcbins, one sends an audio stream and receives a video stream and the other receives an audio stream and sends a video stream.

Send-Receive Pipeline

The following pipeline sends an audio stream and receives a video stream, also starts the call.

gst-launch-1.0 webrtcbin start-call=true signaler=GstOwrSignaler signaler::server_url=http://webrtc.ridgerun.com:8080 \
signaler::session_id=1234ridgerun name=web web.video_src ! rtph264depay ! avdec_h264 ! \
videoconvert ! ximagesink async=true audiotestsrc is-live=true wave=8 \
! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay ! web.audio_sink

Send-Receive Pipeline

The following pipeline sends a video stream and receives an audio stream, also joins the call.

gst-launch-1.0 webrtcbin start-call=false signaler=GstOwrSignaler 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.audio_src ! rtpopusdepay ! opusdec ! audioconvert ! alsasink async=false

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


Example

In this example we use two webrtcbins, one sends an audio stream and receives a video and audio streams and the other receives an audio stream and sends a video and audio streams.

Send-Receive Pipeline

The following pipeline sends an audio stream and receives a video and audio streams, also starts the call.

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

Send-Receive Pipeline

The following pipeline sends video and audio streams and receives an audio stream, also joins the call.

gst-launch-1.0 webrtcbin start-call=false signaler=GstOwrSignaler 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\
 audiotestsrc is-live=true wave=5 ! audioconvert ! audioresample ! queue ! opusenc ! \
rtpopuspay ! web.audio_sink web.audio_src ! rtpopusdepay ! opusdec ! audioconvert \
! alsasink async=false

When executing the two previous pipelines, you should be able to listen the ticks and white noise audio streams and see a video pattern similar to Fig.1.



Audio + Video


Home

Vp8 + Opus