GstKinesisWebRTC: Getting Started - GStreamer Pipelines

From RidgeRun Developer Wiki



Previous: Getting Started/GstKinesisWebrtc Credentials Setup Index Next: Getting Started/C Example Application




Before running any of the following pipelines you need to set up the credentials using the environment variables or adding the element properties to the kinesiswebrtcbin element.

Setup

In order to test the below pipelines, after completing the AWS registration process and Keys generation, you can use the following web page to run tests: https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html. Make sure you complete the following:

  • Use same region you used in the AWS account setup
  • Add your Access Key ID and Secret Access Key
  • Add channel name and make sure it matches with the element channel property.
  • Depending on your use case, select Video only, Audio only, or both.
  • Let STUN/TURN NAT Traversal option as default.
  • Keep Use trickle ICE selected.
  • You are ready to run the pipelines below, depending on the video, and audio selection. For example, by running a pipeline with a video sender component, you will see something like this:

kinesiswebrtcbin as Master:

Figure 1. Kinesis demo page example connected as viewer

kinesiswebrtcbin as Viewer:

Figure 1. Kinesis demo page example connected as master


Before running the pipelines, make sure you have the credentials and channel properly set up as follows. Please recall to use a custom channel name to avoid conflict with other WebRTC tests running with the same AWS instance.

export AWS_ACCESS_KEY_ID=<Your AWS account access key>
export AWS_SECRET_ACCESS_KEY=<Your AWS account secret key>
export SIGNALING_CHANNEL=<Your channel name>
export CHANNEL_ROLE=<master|viewer>

For RidgeRun engineers only, AWS credentials and keys for testing can be found here.

Notice that when on Viewer mode, if you're kinesiswebrtcbin is sending data the pipeline will throw an error if the Master disconnects.

X86 (PC)

The pipelines in this section use software based elements to capture and encode.

Send Audio Only

gst-launch-1.0  audiotestsrc is-live=TRUE ! queue leaky=2 max-size-buffers=400 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE

Send Video Only

gst-launch-1.0 videotestsrc is-live=true ! queue ! video/x-raw,width=640,height=480,framerate=30/1 ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1  ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE

Send Audio and Video

gst-launch-1.0 videotestsrc is-live=true ! queue ! video/x-raw,width=640,height=480,framerate=30/1 ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1  ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin audiotestsrc is-live=TRUE ! queue leaky=2 max-size-buffers=400 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! bin.

Receive Video Only

gst-launch-1.0 kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin  bin.videosrc_0 !  queue ! vp8dec ! queue ! videoconvert ! ximagesink async=false

Send-Receive Audio and Video

gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1  ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin alsasrc !  queue ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! bin. bin.audiosrc_0 ! queue ! opusparse ! opusdec ! queue !  pulsesink sync=false async=false bin.videosrc_0 ! queue ! vp8dec ! queue ! videoconvert ! ximagesink sync=false async=false

NVIDIA Jetson Nano

The pipelines in this section use NVIDIA hardware accelerated elements to capture and encode.

Send Audio Only

gst-launch-1.0 alsasrc device=hw:2,0 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue !  kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin

Send Video Only

gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin

Send Audio and Video

gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin alsasrc device=hw:2,0 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! bin.

Send-Receive Audio and Video

gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin alsasrc device=hw:2,0 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! bin.  bin.videosrc_0 !  queue ! vp8dec ! queue ! nvvidconv ! nvoverlaysink async=false bin.audiosrc_0 ! queue ! opusparse ! opusdec ! queue ! audioconvert ! audioresample !  "audio/x-raw, layout=(string)interleaved, rate=(int)44100, format=(string)S16LE, channels=(int)2" !  alsasink device=hw:2,0 async=false

Troubleshooting

If there is no video from the app side (if the pipeline does not connect to the viewer), please check that the region property of the element matches the region in the signaling channel site. The default region of the element is us-west-1, thus, if the signal channel has us-east-1 and the pipeline uses the default region, then the connection is not going to work. But, if both are set to stream under the us-west-1 region, then the connection will be successful.



Previous: Getting Started/GstKinesisWebrtc Credentials Setup Index Next: Getting Started/C Example Application