How to control the frame rate in a gstreamer pipeline?
Asked Answered
X

2

8

I have astream encoded in 60fps, but my gstreamer pipeline is playing it in fps, so the video appears to be very slow. I have created a gstreamer pipeline as

appsrc name=src ! video/x-h264 ! decodebin ! autovideosink sync=false

The appsrc will push buffers into the decoder. Now I want to force some frame rate for the video that I am playing. I tried inserting a videorate in between decodebin and autovideosink. But it didnt work. Then I inserted framerate=30/1 for forcing the framerate as 30fps.. But that also didnt work; So how to force the framerate for the decoder in gstremer pipeline ?

Xanthous answered 19/11, 2013 at 11:43 Comment(0)
A
8

Without seeing the other pipelines you have tried, I came up with this:

gst-launch-1.0 filesrc location=movie.avi ! decodebin ! \
videorate ! "video/x-raw,framerate=5/1" ! autovideosink

movie.avi contains a 30fps video which is then fixed to 5fps before being displayed.

Abell answered 23/2, 2014 at 11:53 Comment(5)
Would you explain why do we need double quotatopm in framerate parameter?Heracliteanism
I don't think you need them, I just add them.Abell
Humm...I am confused. Do you mean I need "video/x-raw,framerate=5/1" or video/x-raw,framerate=5/1 is also fine?Heracliteanism
Yes, I think it doesnt matterKentigera
It's not strictly necessary, but sometimes caps filters have parentheses in them (ex: video/x-raw(memory:NVMM)) so you either need to escape them \( \) or put the caps filter in quotes. I tend to wrap my caps filters in quotes for this reason, but if there are no objectionable characters in your launch string, it's fine to omit the quotes.Neely
V
0

As another answer said, add element videoscale after decodebin and add capfilter to specify framerate.

Add property max-rate to videoscale works as well.

gst-launch-1.0 filesrc location=movie.avi ! decodebin ! \
videorate max-rate=5 ! autovideosink
Vehicle answered 11/12, 2023 at 16:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.