Changing Playback rate with Gstreamer?

Tobias Rapp t.rapp at noa-archive.com
Fri Oct 6 07:16:47 UTC 2023


Hi,

just want to add that the "gst-play-1.0" tool which is distributed with 
the library allows to change the playback rate while playing using the 
+/- keys. Internally it uses a seek event sent to the playbin element, 
as mentioned by Michael. For an implementation example you can take a 
look at function "play_do_seek" in gst-play.c 
<https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-base/tools/gst-play.c>.

Regards, Tobias


On 05/10/2023 16:55, Michael Gruner via gstreamer-devel wrote:
> Hi Will
>
> Yes the videorate can do what you want. Set the “rate” property to 2.0
>
> Videorate serves two purposes:
> 1. control the framerate but maintain the playback speed (most 
> documented usage)
> 2. vary the playback speed (using the rate property)
>
> If you want more flexibility than videorate can offer you will need to 
> send a seek event. This allows you to, not only to increase/decrease 
> the speed, but also to start from a certain point, go backwards and 
> many other trick modes.
>
> Trickmodes 
> <https://gstreamer.freedesktop.org/documentation/additional/design/trickmodes.html?gi-language=c#client-side-backwards-trickmode>
> gstreamer.freedesktop.org 
> <https://gstreamer.freedesktop.org/documentation/additional/design/trickmodes.html?gi-language=c#client-side-backwards-trickmode>
> 	favicon-180.png 
> <https://gstreamer.freedesktop.org/documentation/additional/design/trickmodes.html?gi-language=c#client-side-backwards-trickmode> 
>
>
> <https://gstreamer.freedesktop.org/documentation/additional/design/trickmodes.html?gi-language=c#client-side-backwards-trickmode>
>
>
> Michael
>
>> On 5 Oct 2023, at 07:57, Will McElderry via gstreamer-devel 
>> <gstreamer-devel at lists.freedesktop.org> wrote:
>>
>> Hi All,
>>
>>
>> I'm wondering if there is a way to change the playback display period 
>> rate of an input stream.
>>
>>
>> For example, I'd like to convert:
>>
>>   file1.mp4  with 1000 frames, plays back @10 fps = 100 seconds long
>>
>> Into
>>
>>   file1_fast.mp4  with 1000 frames, plays back @20 fps = 50 seconds long
>>
>>
>> I can do it with ffmpeg in various ways as detailed here:
>>
>> https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
>>
>> Are there any simple pipelines elements that can do that?
>>
>>
>> (NB: I believe the videorate plugin does not do what I want. Please 
>> flag if you know otherwise!)
>>
>>
>> Thanks!
>>
>>
>> Will.
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20231006/bc2e8153/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: favicon-180.png
Type: image/png
Size: 14295 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20231006/bc2e8153/attachment-0001.png>


More information about the gstreamer-devel mailing list