GstKinesisWebRTC/Getting Started/GStreamer Pipelines: Difference between revisions

From RidgeRun Developer Wiki
(Created page with "<noinclude> {{GstKinesisWebRTC/Head|previous=|next=|}} </noinclude> Before running any of the following pipelines you need to set up the credentials using the environment var...")
 
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
{{GstKinesisWebRTC/Head|previous=|next=|}}
{{GstKinesisWebRTC/Head|previous=Getting Started/GstKinesisWebrtc Credentials Setup|next=Getting Started/C Example Application|metakeywords=kinesiswebrtcbin, AWS credentials, AWS registration}}
</noinclude>
</noinclude>


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.
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 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''':
[[File:kinesiswebrtc_example.png|thumb|center|800px|Figure 1. Kinesis demo page example connected as viewer]]
 
'''kinesiswebrtcbin as Viewer''':
[[File:kinesiswebrtc_example_viewer.png|thumb|center|800px|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.
 
<syntaxhighlight lang='bash'>
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>
</syntaxhighlight>
 
For RidgeRun engineers only, AWS credentials and keys for testing can be found [https://intranet.ridgerun.com/wiki/index.php/Internal_Kinesis_WebRTC_credentials 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) ==
== X86 (PC) ==
Line 11: Line 43:
=== Send Audio Only ===
=== Send Audio Only ===
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
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=test-ridgerun
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
</syntaxhighlight>
</syntaxhighlight>


Line 17: Line 49:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
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=test-ridgerun
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
</syntaxhighlight>
</syntaxhighlight>


Line 23: Line 55:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
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=test-ridgerun 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.  
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.  
</syntaxhighlight>
</syntaxhighlight>


Line 29: Line 61:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 kinesiswebrtcbin channel=test-ridgerun name=bin  bin.videosrc_0 !  queue ! vp8dec ! queue ! videoconvert ! ximagesink
gst-launch-1.0 kinesiswebrtcbin channel=$SIGNALING_CHANNEL channel-role=$CHANNEL_ROLE name=bin  bin.videosrc_0 !  queue ! vp8dec ! queue ! videoconvert ! ximagesink async=false
</syntaxhighlight>
</syntaxhighlight>


Line 35: Line 67:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 v4l2src ! videoconvert ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1  ! queue ! kinesiswebrtcbin channel=test-ridgerun 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 bin.videosrc_0 ! queue ! vp8dec ! queue ! videoconvert ! ximagesink sync=false
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
</syntaxhighlight>
</syntaxhighlight>


Line 45: Line 77:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 alsasrc device=hw:2,0 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue !  kinesiswebrtcbin channel=test-ridgerun name=bin  
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  
</syntaxhighlight>
</syntaxhighlight>


Line 51: Line 83:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=test-ridgerun name=bin
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
</syntaxhighlight>
</syntaxhighlight>


Line 57: Line 89:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=test-ridgerun name=bin alsasrc device=hw:2,0 ! audioconvert ! audioresample ! opusenc ! audio/x-opus,rate=48000,channels=2 ! queue ! bin.   
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.   
</syntaxhighlight>
</syntaxhighlight>


Line 63: Line 95:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
gst-launch-1.0 nvarguscamerasrc !  video/x-raw\(memory:NVMM\),width=1280,height=720,framerate=30/1 ! queue ! nvv4l2vp8enc ! queue ! kinesiswebrtcbin channel=test-ridgerun 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
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
</syntaxhighlight>
</syntaxhighlight>
== 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.


<noinclude>
<noinclude>
{{GstKinesisWebRTC/Foot||}}
{{GstKinesisWebRTC/Foot|Getting Started/GstKinesisWebrtc Credentials Setup|Getting Started/C Example Application}}
</noinclude>
</noinclude>

Latest revision as of 23:52, 21 March 2024



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