简体   繁体   English

ffmpeg-如何在保留视频总帧数的同时缩放视频?

[英]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方法,任何建议都值得赞赏。

Here's the sample video that I use: Link 这是我使用的示例视频: 链接

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.

相关问题 如何使用 FFmpeg、无损并保持相同的总帧数来更改视频帧速率? - How can I change a video frame rate with FFmpeg, lossless and keeping the same total number of frames? 如何使用ffmpeg按帧数(包括视频和音频)裁剪视频的一部分? - How can I use ffmpeg to crop a part of a video by frames numbers including video and audio? 如何使用FFMPEG将视频的第一帧转换为I帧,然后将其余部分转换为P帧? - How can I convert the first frame of a video to an I-frame and the rest to P-frames with FFMPEG? 如何使用 ffmpeg 将图像帧转换为视频? - How do I convert image frames into a video using ffmpeg? 如何使用 FFmpeg 从视频中剪切/删除特定的未解码 h.264(关键)帧? - How can I cut/drop specific undecoded h.264 (Key-)frames from a video using FFmpeg? ffmpeg:如何在视频末尾添加边框或黑色? - ffmpeg: How to add frames or black at the end of a video? 如何重新排列AVI视频的帧? - how I can reorder the frames of a avi video? 在ffmpeg中,如何使用scale2ref过滤器缩放dvdsub字幕以匹配视频大小? - In ffmpeg, how do I scale dvdsub subtitles to match video size, using scale2ref filter? 如何缩放嵌入式视频? - How can I scale an embedded video? ffmpeg:如何在视频2的开头添加视频1 - ffmpeg: How can I add video-1 at the beginning of video-2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM