[FFmpeg-user] force_key_frames

Claudiu Rad jazzman at misalpina.net
Mon Feb 2 08:26:28 CET 2015

On 2/2/2015 9:04 AM, Anatol wrote:
> Your cmd-line forces only one kf at "00:00:02.333".
> You should either explicitly write down ALL kf's that u want -
> "2,4,6,8,...3600",
> or use an equation - 'expr:gte(t,n_forced*2)', this one for 2 sec gop

how can keyframes be inserted if he '-vcodec copy'?

> On Mon, Feb 2, 2015 at 8:14 AM, Jean-Georges Fritsch <
> jgfritsch-at-yahoo.com at ffmpeg.org> wrote:
>> Hello I have been trying to use ffmpeg (version 2.5.3) to insert key frame
>> in am H.264/mpeg transport stream. But no key frame gets inserted.
>> Here is the command line:ffmpeg  -i input.ts -force_key_frames:v 70
>> -acodec copy -vcodec copy -async 1 -y output.tsor
>> ffmpeg  -i input.ts -force_key_frames:v 00:00:02.333 -acodec copy -vcodec
>> copy -async 1 -y output.ts

if you stream copy (-vcodec copy) your video stream, without 
decoding/encoding process you can't change anything in the stream 
configuration. you have to reencode in order to force keyframes.
for a more useful -force_key_frames usage than your example, Anatol gave 
you already some examples.

>> Let me know what I am doing wrong. BTW I see the output stream contains
>> PAT/PMT before every frame. Is is the expected behavior?
>> Thx,
>> JGF

More information about the ffmpeg-user mailing list