GStreamer Daemon - Seek

From RidgeRun Developer Wiki
Revision as of 14:12, 29 June 2017 by Acervantes (talk | contribs)

EOS

Home

Flush start/Flush stop

This wiki shows how to send a seek event to a given pipeline. Seek event moves 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 of 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 EOS event is when used along with the EOS bus message to notify the application when the stream is finally closed. Consider, for example, an HD video recording where high amount of data is being written to the file system. If you stop the pipeline after a long running time, it's likely that the tear down will take some time while the data is fully written to its destination. If the application needs to make use of the recording after stopping the pipeline, it would need to wait until the stream is actually closed; otherwise the file may result corrupted. The EOS event and message can indicate when the write back is done.


Gstd Commands:

# Create the pipeline and start recording
pipeline_create p1 v4l2src ! x264enc ! qtmux ! filesink location=/mnt/recording.mp4
pipeline_play p1

# ... wait until recording is no longer required

# Send the EOS
event_eos p1
# Wait for the stream to stop
bus_filter p1 eos
bus_read p1

# Finally stop the pipe
pipeline_stop p1




EOS

Home

Flush start/Flush stop