[FFmpeg-user] trouble with -vcodec copy

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Nov 18 22:03:59 CET 2011


Arlo Leach <lists <at> arlomedia.com> writes:

> ffmpeg -i band_formatted.mp4 -f mp4 -vcodec copy -acodec copy -ss 30 -t 30 -y
band_formatted_sample.mp4
> 
> to 
> 
> ffmpeg -ss 30 -t 30 -i band_formatted.mp4 -f mp4 -vcodec copy -acodec copy -y
band_formatted_sample.mp4
> 
> I started getting more than 30 seconds of video, but no blank video. It looks
> like the start of the extraction moves forward to the next earlier keyframe
> and starts from there instead of the requested location.

Yes, but I suspect you don't see the "blank video" with MPlayer (or ffplay), but
QuickTime does not want to display the initial non-key frames that are copied
with the first of your command lines (that asks ffmpeg to seek to exactly 30
seconds, no matter if there is a key frame or not). The second command line asks
to seek to approximately 30 seconds (depending on where a keyframe - or whatever
FFmpeg believes is a keyframe - can be found).

> So I might get a 34-second sample instead of a 30-second sample.
> 
> I also found that if I added the -g flag in my original conversion command, I
> could write more keyframes into the full video and increase the accuracy of
> my sample timing. That only created a slight increase in the
> file size of my full video, which in my application is a good tradeoff.

I don't think -g has any effect with -vcodec copy. (But if you mean you first
encode the sample and cut it later, than more keyframes of course increase the
seeking accuracy.)

Carl Eugen



More information about the ffmpeg-user mailing list