GStreamer Daemon - Slow Motion

From RidgeRun Developer Wiki
(Redirected from Gstd-1.0 - Slow Motion)



Previous: New Clock Index Next: Reverse Playback




For the slow motion example we will use the seek gstd event, with that event we can control the video speed using the rate property, also we can control the beginning and ending of the video pipeline stream. To get the playback in slow motion, the rate of the seek event should be in the following interval:

0 < rate < 1 

Example

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

#!/bin/bash

# Absolute path to the video location
VIDEO=$1

# Graceful cleanup upon CTRL-C
trap "gstd-client pipeline_delete p; exit" SIGHUP SIGINT SIGTERM

# Make sure there is no pipeline with this name already
gstd-client pipeline_delete p

gstd-client pipeline_create p playbin uri=file://$VIDEO

# Pipeline play 
gstd-client pipeline_play p

#Play the video from the second 5s to the second 10s in slow-motion 
#using seek event with 0.5 rate 

sleep 5
gstd-client event_seek p 0.5 3 1 1 5000000000 1 10000000000

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

./simple-slow-motion.sh /tmp/video.mp4


Previous: New Clock Index Next: Reverse Playback