Difference between revisions of "GstSEIMetadata/Examples/Latency Measurement Example"

From RidgeRun Developer Connection
Jump to: navigation, search
m
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
{{GstSEIMetadata/Head|previous=Examples/C Example|next=Performance|keywords=}}
+
{{GstSEIMetadata/Head|previous=Examples/C Example|next=Performance|metakeywords=}}
 
</noinclude>
 
</noinclude>
  
 
=GstSEI Latency Measurement Example=
 
=GstSEI Latency Measurement Example=
GstSEI also includes some examples of how can be used the element, the latency measurement example uses the seimetatester element to insert the time when the buffer flow for the element, insert that time as metadata with the seiinject, and send the buffer with UDP and in receiver gets the buffer by UDP, take the metadata with seiextract and compares the actual time when the buffer flow for the receiver and the time in the metadata.
+
GstSEI includes a number of examples to illustrate how to use the element; the latency measurement example makes use of the seimetatester element to insert the time when the buffer flows to the element, insert that time as metadata with the seiinject, and sends the buffer through UDP. The receiver side gets the buffer via UDP, extracts the metadata with seiextract and compares the actual time when the buffer flow for the receiver and the time in the metadata.
  
 
==Pipelines==
 
==Pipelines==
The example uses the following pipeline template for the sender:
+
The example uses the following template pipeline for the sender:
 
<pre>
 
<pre>
 
v4l2src device=%s ! videoconvert ! tee name=t ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=15  \
 
v4l2src device=%s ! videoconvert ! tee name=t ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=15  \
Line 16: Line 16:
 
</pre>
 
</pre>
  
And for the receiver use the following pipeline template:
+
The receiver uses the following template pipeline:
 
<pre>
 
<pre>
 
udpsrc address=%s port=%s  !                                                                                  \
 
udpsrc address=%s port=%s  !                                                                                  \
Line 24: Line 24:
 
</pre>
 
</pre>
  
=How to used=
+
=How to use=
After installing the element with the steps of [https://developer.ridgerun.com/wiki/index.php?title=GstSEIMetadata/Getting_Started/Building_GstSEIMetadata Building GstSEIMetadata], also this example is going to be installed in the system.
+
Once the element has been installed as described at [https://developer.ridgerun.com/wiki/index.php?title=GstSEIMetadata/Getting_Started/Building_GstSEIMetadata Building GstSEIMetadata], the following example will be installed in the system as well.
  
First, it's necessary to run the sender example like the following.
+
First step, run the sender example as described below:
  
 
<pre>
 
<pre>
Line 36: Line 36:
 
</pre>
 
</pre>
  
The sender gives three following inputs.
+
The sender provides three possible inputs:
  
* source_device_path: The camera source path that is going to be used. (default: /dev/video0)
+
* source_device_path: The camera source path to be used. (default: /dev/video0)
* receiver_ip: The IP for the device where the receiver is going to run. (default: 127.0.0.1)
+
* receiver_ip: The receiver side IP address. (default: 127.0.0.1)
* receiver_port: The port for the device where the receiver is going to run. (default: 5555)
+
* receiver_port: The receiver side port. (default: 5555)
  
After running the sender a window is going to open like the following.
+
Executing the example should display a window like the following:
  
 
[[File:gst-sei-latency-sender.png|600px|thumb|center|Latency Measurement Sender]]
 
[[File:gst-sei-latency-sender.png|600px|thumb|center|Latency Measurement Sender]]
  
Now in the receiver device, it's necessary to run the receiver command like is showed in the sender output. In this case, like the following.
+
Now, on the receiver device, it's necessary to run the receiver command like it's showed in the sender output. In this case:
 
<pre>
 
<pre>
 
maumontero@maumontero-Inspiron-5577:~ $ gstsei_latency_measurement_receiver 127.0.0.1 5555
 
maumontero@maumontero-Inspiron-5577:~ $ gstsei_latency_measurement_receiver 127.0.0.1 5555
 
</pre>
 
</pre>
  
Finally, after running the receiver command the output should look like the following.
+
Finally, after running the receiver command the output should look similar to:
  
 
[[File:gst-sei-latency-reciever.png|600px|thumb|center|Latency Measurement Receiver]]
 
[[File:gst-sei-latency-reciever.png|600px|thumb|center|Latency Measurement Receiver]]
  
Also, the demo lets you increase or decrease the delay, by clicking the sender window and using the up/down arrow keys, the time that we increase or decrease is going to affect the receiver delay like the following.
+
The demo allows to increase or decrease the delay, by clicking the sender window and using the up/down keys, the modified time will affect the receiver delay:
  
 
[[File:gift_latency.gif|800px|center|frame]]
 
[[File:gift_latency.gif|800px|center|frame]]

Latest revision as of 12:58, 7 March 2023


Previous: Examples/C Example Index Next: Performance





GstSEI Latency Measurement Example

GstSEI includes a number of examples to illustrate how to use the element; the latency measurement example makes use of the seimetatester element to insert the time when the buffer flows to the element, insert that time as metadata with the seiinject, and sends the buffer through UDP. The receiver side gets the buffer via UDP, extracts the metadata with seiextract and compares the actual time when the buffer flow for the receiver and the time in the metadata.

Pipelines

The example uses the following template pipeline for the sender:

v4l2src device=%s ! videoconvert ! tee name=t ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=15  \
! seimetatester ! seiinject !                                                                                   \
queue name=%s min-threshold-time=0000000000 max-size-buffers=0 max-size-bytes=0 max-size-time=0                 \ 
! rtph264pay ! udpsink host=%s port=%s t. ! queue !                                                             \
textoverlay name=%s text=\"Added delay: 0 ms\"! queue ! xvimagesink sync=false async=false

The receiver uses the following template pipeline:

udpsrc address=%s port=%s  !                                                                                   \
application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,packetization-mode=1,profile-level-id=640014 \
 ! rtph264depay ! queue ! seiextract name=%s ! avdec_h264 ! textoverlay name=%s !                              \
xvimagesink sync=false async=false

How to use

Once the element has been installed as described at Building GstSEIMetadata, the following example will be installed in the system as well.

First step, run the sender example as described below:

maumontero@maumontero-Inspiron-5577:~ $ gstsei_latency_measurement_sender 
gstsei_latency_measurement_sender can run with the following parameters: ./gstsei_latency_measurement_sender source_device_path receiver_ip receiver_port 
Running sender with: ./gstsei_latency_measurement_sender /dev/video0 127.0.0.1 5555
Run gstsei_latency_measurement_receiver with: ./gstsei_latency_measurement_receiver 127.0.0.1 5555

The sender provides three possible inputs:

  • source_device_path: The camera source path to be used. (default: /dev/video0)
  • receiver_ip: The receiver side IP address. (default: 127.0.0.1)
  • receiver_port: The receiver side port. (default: 5555)

Executing the example should display a window like the following:

Latency Measurement Sender

Now, on the receiver device, it's necessary to run the receiver command like it's showed in the sender output. In this case:

maumontero@maumontero-Inspiron-5577:~ $ gstsei_latency_measurement_receiver 127.0.0.1 5555

Finally, after running the receiver command the output should look similar to:

Latency Measurement Receiver

The demo allows to increase or decrease the delay, by clicking the sender window and using the up/down keys, the modified time will affect the receiver delay:

Error creating thumbnail: Unable to save thumbnail to destination


Previous: Examples/C Example Index Next: Performance