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

Matthew Morgan lytithwyn at gmail.com
Fri Nov 11 22:05:15 CET 2011

On Thu 10 Nov 2011 12:15:09 PM EST, Matthew Morgan wrote:
> On Thu 10 Nov 2011 11:40:03 AM EST, Carl Eugen Hoyos wrote:
>> Matthew Morgan<lytithwyn<at> gmail.com> writes:
>>> I mainly just need to know if it is possible using ffmpeg (and if so,
>>> how) to trim everything off the beginning of a video file up to the
>>> first keyframe.
>> This is nowadays FFmpeg's default.
>> The reason this was changed where many reports like yours, I am not 
>> sure if the
>> discussion is completely over, but for the moment FFmpeg tries to 
>> skip the
>> initial non-key frames.
>> There probably are videos for which this does not work, but testing (and
>> reporting) about this is very welcome! Please consider opening a 
>> report on
>> http://avcodec.org/trac/ffmpeg if your problem is reproducible with 
>> current git
>> head.
>> Carl Eugen
> So ffmpeg skips them by default? That's actually really great news for 
> me. Does this behavior happen with '-acodec copy -vcodec' copy as well?
> My idea is to just run the file through an ffmpeg conversion and let 
> it trim the initial non-key frames off. I'll going ahead and build 
> from git-head and file a report if it doesn't work.
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.


More information about the ffmpeg-user mailing list