[英]How can I convert the first frame of a video to an I-frame and the rest to P-frames with FFMPEG?
I'd like to try to do some datamoshing like this tutorial . 我想尝试做一些像本教程这样的数据整理。 But I'd like to be able to do it programatically, so instead of vdub and avidemux, I'd like to figure out how to do as many parts of this process as I can with ffmpeg and/or other command-line tools. 但是我希望能够以编程方式进行操作,因此我想找出如何使用ffmpeg和/或其他命令行工具尽可能多地完成此过程,而不是vdub和avidemux。
The first problem I am having is that when I use the ffdshow codec rev 3556 with VDub it just outputs a broken video. 我遇到的第一个问题是,当我将ffdshow编解码器rev 3556与VDub一起使用时,它只会输出损坏的视频。 I feel like I got close to getting what I want, which is frame 0 as an I-frame and all the rest as P-frames with the following command 我觉得我快要得到想要的东西了,使用以下命令将第0帧作为I帧,将其余所有帧作为P帧。
ffmpeg -i input.mp4 -force_key_frames 00:00:00.000 output.avi
There are a couple of problems with this... 这个有几个问题...
1) I get B-frames too, which don't work with that type of data-moshing 1)我也得到了B帧,不适用于这种类型的数据交换
2) There's still I-frames every 10 or so frames 2)每10帧左右仍有I帧
I feel like the problem is that I need to use a certain codec to encode the video in and also that -force_key_frames
probably just enforces the addition of extra keyframe(I-frames) but doesn't prevent other I-frames from being created. 我觉得问题在于我需要使用特定的编解码器对视频进行编码,而且-force_key_frames
可能只是强制添加额外的关键帧(I帧),而不会阻止其他I帧的创建。
Try using the -keyint
flag. 尝试使用-keyint
标志。 I believe you can sent a minimum GOP length (key interval length). 我相信您可以发送最小GOP长度(密钥间隔长度)。
You would need to know how many frames are in your file, and you could try setting your minimum key interval to that length. 您可能需要知道文件中有多少帧,并且可以尝试将最小关键帧间隔设置为该长度。
IE = keyint=[KEY INTERVAL VALUE]:min-keyint=[MINIMUM KEY INTERVAL VALUE]
IE = keyint=[KEY INTERVAL VALUE]:min-keyint=[MINIMUM KEY INTERVAL VALUE]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.