GStreamer Daemon - New Clock

From RidgeRun Developer Connection
Jump to: navigation, search


Previous: MP4 Video Recording Index Next: Slow Motion




This wiki shows how to use the bus_<action> to read the bus in the pipeline, with the bus_filter command we can filter the new_clock messages then use the bus_read to read them.

Example

The following example is a bash script that demonstrates the simple slow motion playback.

 1 #!/bin/bash
 2 
 3 # Absolute path to the video location
 4 VIDEO=$1
 5 
 6 # Graceful cleanup upon CTRL-C
 7 trap "gstd-client pipeline_delete p; exit" SIGHUP SIGINT SIGTERM
 8 
 9 # Make sure there is no pipeline with this name already
10 gstd-client pipeline_delete p
11 
12 gstd-client pipeline_create p playbin uri=file://$VIDEO
13 
14 # Filter only a new-clock
15 gstd-client bus_filter p new_clock
16 
17 # Play the pipeline
18 gstd-client pipeline_play p
19 
20 # Waiting until bus read a message error 
21 gstd-client bus_read p


The output of the command bus_read should be as follows:

{
  "code" : 0,
  "description" : "Success",
  "response" : {
    "type" : "new-clock",
    "source" : "p",
    "timestamp" : "99:99:99.999999999",
    "seqnum" : 95411
}
}


To run the script you will need an existing video. You may use the video recording simple example to quickly use Gstd to record one. To run the new-clock script, type

./new-clock.sh /tmp/video.mp4


Previous: MP4 Video Recording Index Next: Slow Motion