GStreamer Daemon - Slow Motion
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.
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 # Pipeline play
15 gstd-client pipeline_play p
16
17 #Play the video from the second 5s to the second 10s in slow-motion
18 #using seek event with 0.5 rate
19
20 sleep 5
21 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