[英]ffmpeg - how can I scale the video while perserving the total frames in it?
I have a video with a size of 515 x 755
, that I would like to resize proportionally to 206 x 302
(so, factor is 2.5
). 我有一个尺寸为
515 x 755
的视频,我想按比例调整为206 x 302
大小(因此,系数为2.5
)。
In this video, I have the total of 588 frames, and I use ffmpeg
to scale it, with this command . 在此视频中,我总共有588帧,并使用
ffmpeg
对此命令进行缩放。
ffmpeg -i video.mp4 -vf scale=206:-1 xRotation_206.mp4
And I use this to check how many frames are there in the video, based on this answer . 然后我根据此答案检查视频中有多少帧。
ffmpeg -i video.mp4 -map 0:v:0 -c copy -f null - 2>&1 | awk '/frame=/ {print $2}'
The original video frames is good (588 frames). 原始视频帧很好(588帧)。 But, after resizing with the command above, my converted video now has 604 frames.
但是,使用上面的命令调整大小后,我转换后的视频现在具有604帧。
The question is, how can I resize the video by preserving the total frames in it? 问题是, 如何通过保留视频中的总帧来调整视频大小? It doesn't really have to be
ffmpeg
approach, and any suggestion is appreciated. 并非必须是
ffmpeg
方法,任何建议都值得赞赏。
FFmpeg, by default, generates constant frame-rate MP4s, so if your original video is variable-frame rate then ffmpeg will drop or duplicate frames to generate a constant frame rate output. FFmpeg默认情况下会生成恒定帧率的MP4,因此,如果您的原始视频是可变帧率的,则ffmpeg将丢弃或复制帧以生成恒定帧率的输出。
To avoid that, use 为避免这种情况,请使用
ffmpeg -i video.mp4 -vf scale=206:-1 -vsync passthrough xRotation_206.mp4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.