简体   繁体   中英

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.

The first problem I am having is that when I use the ffdshow codec rev 3556 with VDub it just outputs a broken video. 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

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

2) There's still I-frames every 10 or so frames

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.

Try using the -keyint flag. I believe you can sent a minimum GOP length (key interval length).

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM