Increasing playback speed without duplicating and dropping frames

Hi,
I have a pipeline that decodes from a 4K 25fps mp4 file. I would like to increase playback speed like 2x. I have achieved this by using ‘videorate rate’ element. But as far as I understand it is dropping frames to adjust speed. I have no experience and technical background about this topic so I am just wondering If I can decode 50 fps - decoding original frames not duplicating or dropping - from a 25 fps video source since I have the video file recorded. Or do I need to use interpolation to achieve it. If that is the case how can I do that in gstreamer.

Thanks.

For playback purpose, its best to use a seek event with the desired rate.

https://gstreamer.freedesktop.org/documentation/tutorials/basic/playback-speed.html

If you do need to change the rate faster, consider using instant rate switching, which is a relatively new mode. Following this tutorial, use the seek flag GST_SEEK_FLAG_INSTANT_RATE_CHANGE. When this complete, you will be able to adjust the rate by sending instant rate event (see gst_event_new_instant_rate_change_request() which can be sent just like seek event assuming you have setup the right trick mode).

Thank you very much for your answer.

I could make it work with the tutorial you have provided. But I would like to ask some questions. I am new to gstreamer and cannot understand the documentation exactly.

  1. How instant rate changing is different?
  2. How does changing playback speed with seek event works exactly. I am not sure if it speeds the whole pipeline using original frames or is it skipping frames or dropping frames, what is under the hood?

Thank you for your time.

  1. Instant rate change will modify the playback rate without flushing the pipeline. Originally the rate was bound to issuing a flush seek. Due to the nature of codecs, the time between this flush and the next frames that can be displayed is noticeable. Instant rate let you change the playback rate without issuing a seek, so without resetting the pipeline. This is slightly complicated in GStreamer since every elements needs to be aware of the playback rate.

  2. One of the seek parameter is the playback rate, issueing a seek dispatches the new rate to the pipeline. Element will then create a GstSegment with the appropriate rate and push that through the pipeline internally. Note that the links points to internal design notes, which are meant for GStreamer developers.

I understand now.
Thank you very much I appreciate your help.