[FFmpeg-user] trouble with -vcodec copy

Arlo Leach lists at arlomedia.com
Thu Nov 17 20:53:40 CET 2011


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

> Keyframe seeking can occur if you ask it (ie you put -ss before -i).

I think this helps answer my question about the few seconds of blank video when using -vcodec copy. When I changed my sample extraction command from 

ffmpeg -i band_formatted.mp4 -f mp4 -vcodec copy -acodec copy -ss 30 -t 30 -y band_formatted_sample.mp4


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. 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.

So I think those two changes are my solution. Does that sound right?



Arlo Leach

More information about the ffmpeg-user mailing list