Coding a certain MP4 GOP with FFMPEG

2019-04-14 16:27发布

问题:

I have a .y4m video file, and I want to convert it to .mp4 using FFmpeg. The problem is that I want a certain kind of GOP, this one: IBBPBBPBBPBB. But what I get, when I set the GOP size to 12 (-g 12) is IPPPPPPPPPPP. I've also tried using the -bf 8 option, but I get results like IPBBB... and the video doesn't play right.

Could you please tell me how to get the exact IBBPBBPBBPBB GOP using FFmpeg?

Thanks for your help

回答1:

I think you want something to the effect of :

-g 12 -bf 2 sgop

The -g flag sets the GOP size (as you already mentioned), the -bf 2 says that 2 B-frames should be inserted between each set of P-frames, and the sgop strictly enforces the GOP size.