使用 ffmpeg 改变帧率 [英] Using ffmpeg to change framerate

查看:90
本文介绍了使用 ffmpeg 改变帧率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将视频剪辑(MP4、yuv420p)从 30 fps 转换为 24 fps.帧数是正确的,所以我的输出应该从 30fps 的 20 分钟变为 24fps 的 25 分钟.其他一切都应该保持不变.

I am trying to convert a video clip (MP4, yuv420p) from 30 fps to 24 fps. The number of frames is correct so my output should change from 20 minutes at 30fps to 25 minutes at 24fps. Everything else should remain the same.

尽我所能尝试使用 ffmpeg 转换帧速率但更改帧数以保持相同的持续时间或更改持续时间而不改变帧速率.

Try as I might everything I try with ffmpeg converts the frame rate but changes the number of frames to keep the same duration or changes the duration without altering the framerate.

所以我通常会尝试这样的事情;

So I have been typically trying things like;

ffmpeg -y -r 30 -i seeing_noaudio.mp4 -r 24 seeing.mp4

(我在 Windows 上这样做,但通常会在 linux 上).这会转换帧率但会丢帧,因此总持续时间不变.

(I'm doing this on windows but normally would be on linux). That converts the framerate but drops frames so the total duration is unaltered.

或者我已经尝试过

ffmpeg -y -i seeing_noaudio.mp4 -filter:v "setpts=1.25*PTS" seeing.mp4

改变持续时间但不改变帧率.

Which changes the duration but not the framerate.

当然,我应该能够使用单个 ffmpeg 命令来完成此操作,而无需重新编码,甚至有些人建议返回原始原始帧.

Surely I should be able to do this with a single ffmpeg command without having to reencode or even as some people suggested going back to the original raw frames.

请帮忙

推荐答案

使用重新编码:

ffmpeg -y -i seeing_noaudio.mp4 -vf "setpts=1.25*PTS" -r 24 seeing.mp4

无需重新编码:

第一步 - 将视频提取到原始比特流

First step - extract video to raw bitstream

ffmpeg -y -i seeing_noaudio.mp4 -c copy -f h264 seeing_noaudio.h264

使用新的帧率重新混合

ffmpeg -y -r 24 -i seeing_noaudio.h264 -c copy seeing.mp4

这篇关于使用 ffmpeg 改变帧率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆