开发者

Asking ffmpeg to extract frames at the original frame rate [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

Improve this question

On the FFmpeg documentation (here, and here) I read that, by default, FFmpeg chooses to extract frames at 25 frames per second (otherwise you can specify a framerate with the -r option)

My problem is that I have a folder with dozens of videos, each of them recorded at different frame rates, so my question is:

Is there a way to ask FFmpeg to extract frames from a video at the "native" frame rate (i.e. the original 开发者_StackOverflowframe rate at which the video was recorded)?

In case it matters, I am working with MP4 files


To get the original frame rate:

ffmpeg -i file.mp4 2>&1 | grep -o '[0-9]\{1,3\}\sfps'

Example Output:

25 fps

You can futher pipe it to sed ... | sed 's/\sfps//' to keep only the 25, and store it into a variable, so you can use that variable to convert the videos e.g. ffmpeg -r $originalFps.

grep -o will extract the match, instead of the whole line containing the match.

[0-9]\{1,3\} will match one to three digits

\sfps will match a white space followed by 'fps'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜