[FFmpeg-user] fixing videos that don't start with keyframes

Matthew Morgan lytithwyn at gmail.com
Tue Nov 15 15:40:14 CET 2011

>> Just to follow up on this, ffmpeg *is* successfully removing the leading
>> non-key frames.  This does *not* seem to be the case when using '-acodec
>> copy -vcodec copy' (which doesn't surprise me).  I just ran something like
>> 'ffmpeg -i my_video.mpg -target ntsc-dvd my_fixed_video.mpg' and the leading
>> non-key frames were gone.
> with -ss 0 it "might" skip to the first keyframe with vcodec copy.  Maybe?
> -r
Alas but no, that doesn't work either.  The skip happens, but it's not seeking to the first keyframe after the skip like it usually would.  I don't know whether it's because keyframe-seeking gets disabled with codec copy or  if it's the fact that these input files are a little weird.  I found that if I get rid of the codec copy commands and try to do a skip of 60 seconds (long enough to make it obvious), I get:

ffmpeg -i M2U00108.MPG -ss 60 -target ntsc-dvd -y m2u00108_copy.mpg
[mpeg2video @ 0x8cd99c0] warning: first frame is no keyframe
     Last message repeated 1 times
[buffer @ 0x8cd9980] Buffering several frames is not supported. Please consume all available frames before adding a new one.
     Last message repeated 1791 times  0kB time=10000000000.00 bitrate=   0.0kbits/s

And after that it starts encoding.

I also find that with these input files if I don't specify "-target ntsc-dvd" the output file has no audio.  If I run "ffmpeg -i" on that output file it *says* there's audio, but mplayer says there isn't and I only get video during playback.

More information about the ffmpeg-user mailing list