GStreamer Daemon - Seek

From RidgeRun Developer Wiki
(Redirected from Gstd-1.0 - Seek)



Previous: EOS Index Next: Flush start/Flush stop




This wiki shows how to send a seek event to a given pipeline. Seek event moves the current playing position to a new one, sometimes it is important to measure the time needed to seek to different points in a video file.

Sending an Seek event

A new Seek event is sent to a pipeline using the command shown below.

event_seek pipeline rate=1.0 format=3 flags=1 start-type=1 start=0 end-type=1 end=-1 
       Creates a new Seek event and sends it to pipeline.

For more information on the seek arguments go to gst_element_seek.

For example:
Gstd Commands:

pipeline_create p1 videotestsrc ! autovideosink
pipeline_play p1
event_seek p1 1.0 0

will respectively

  1. Create a pipeline p1
  2. Put it to playing
  3. Send a Seek event to it

The event_seek command will typically fail for any of the following:

  • No pipeline was given
  • The given pipeline doesn't exist
  • Wrong seek event property

Alternatively, a pipeline can be created using the low level CRUD syntax:
Gstd Commands:

create /pipelines/p1/event seek rate=1.0 format=3 flags=1 start-type=1 start=0 end-type=1 end=-1

Example Application

A very useful application of the seek event is when a video is needed to playback in an interval, for several seconds. This example shows how to set the start time and the end time of the playback, the seek event takes the time in nanoseconds, for this example the playback start at 5s and ends in 10s.


Gstd Commands:

# Create the pipeline 
pipeline_create p1 playbin uri=file:///tmp/video.mp4

# Play the pipeline
pipeline_play p1

# Send the seek event. Play the pipeline from the second 5 to 10
event_seek p1 1.0 3 1 1 5000000000 1 10000000000

API Summary

High Level Command Low Level CRUD Description
event_seek <pipe> <rate=1.0> <format=3> <flags=1> <start-type=1> <start=0> <end-type=1> <end=-1> create /pipelines/<name>/event_seek <rate=1.0> <format=3> <flags=1> <start-type=1> <start=0> <end-type=1> <end=-1> Sends a seek event to an element


Previous: EOS Index Next: Flush start/Flush stop