GStreamer Daemon - Slow Motion: Difference between revisions
Acervantes (talk | contribs) No edit summary |
mNo edit summary |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{GStreamer Daemon/Head | previous=New Clock | 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 == | == Example == | ||
Line 12: | Line 14: | ||
# Absolute path to the video location | # Absolute path to the video location | ||
VIDEO=$ | VIDEO=$1 | ||
# Graceful cleanup upon CTRL-C | # Graceful cleanup upon CTRL-C | ||
Line 22: | Line 24: | ||
gstd-client pipeline_create p playbin uri=file://$VIDEO | gstd-client pipeline_create p playbin uri=file://$VIDEO | ||
# | # Pipeline play | ||
gstd-client | 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 | |||
gstd-client | sleep 5 | ||
gstd-client event_seek p 0.5 3 1 1 5000000000 1 10000000000 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
To run the script you will need an existing video. You may use the [[Gstd-1.0 - MP4 Video Recording| video recording simple example]] to quickly use Gstd-1.0 to record one. To run the | To run the script you will need an existing video. You may use the [[Gstd-1.0 - MP4 Video Recording| video recording simple example]] to quickly use Gstd-1.0 to record one. To run the Slow-motion script type | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
./simple- | ./simple-slow-motion.sh /tmp/video.mp4 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | {{GStreamer Daemon/Foot | previous=New Clock | next=Reverse Playback}} |
Latest revision as of 12:39, 3 April 2020
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