Can we limit max fps by using FFMPEG?
Asked Answered
K

1

6

I want to limit max fps when I process a video.
For example: set limit up to 30 frames per second.
If I process a video with 24 fps then I don't change fps but if I process the video with 60 fps then I change fps to 30.
Can it be done by using only FFmpeg (with filters or something else)?
I think that it can be done by using filter like this:

-filter:v "fps=fps='min($CURRENT_FPS,30)'"

But I don't know is it possible to get current fps from an expression.

Krahmer answered 6/11, 2015 at 22:29 Comment(1)
Did you find a solution for this?Enfleurage
A
0

create a sh-file, like RunMe.sh, replace input and output with filenames and run it.

#!/bin/bash

#replace input and output with filenames
i="input"
o="output"

#write framerate into variable r and reset r to 30 if greater
if [ $(echo $($ffmpeg -i "$i" 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p") | awk  '{printf "%.0f\n", $1}';) -gt 30 ];then r="-r 30";else r=""; fi

#encoding
nice -n -20 ffmpeg -i $i $r $o
Arnelle answered 21/4 at 11:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.