GstSEIMetadata - Examples - Latency Measurement Example

From RidgeRun Developer Wiki


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:


Previous: Examples/C Example Index Next: Performance