I need to trim the just the first 1 or 2 seconds off of a series of FLV recordings of varying, unspecified lengths. I've found plenty of resources for extracting a specified duration from a video (e.g. 30 second clips), but none for continuing to the end of a video.

Both of these attempts just yield a copied version of the video, sans desired trimming:

ffmpeg -ss 2 -vcodec copy -acodec copy -i input.flv output.flv

ffmpeg -ss 2 -t 120 -vcodec copy -acodec copy -i input.flv output.flv

The thought on the second one was: perhaps if I specified a length beyond what was possible, it'd just go to the end. No dice.

I know it's not an issue with codecs or using seconds instead of timecode since the following worked a charm:

ffmpeg -ss 2 -t 5 -vcodec copy -acodec copy -i input.flv output.flv

Any other ideas? I'm open to using other (Windows-based) command line tools, however am strongly favoring ffmpeg since I'm already using it for thumbnail creation and am familiar with it.

If it helps, my videos will all be under 2 minutes.


I've switched over to using Mencoder (http://www.mplayerhq.hu/) since it looks like ffmpeg won't accomplish this without some additional hackery.

The Mencoder syntax to accomplish what I set out to do is:

mencoder.exe -ss 2 -oac copy -ovc copy input.flv -o output.flv
  • So which do you prefer; the mencoder example, above; or the ffmpeg example, below? – voices Apr 28 '17 at 0:10


ffmpeg -i input.flv -ss 2 -vcodec copy -acodec copy output.flv

I think the input parameter is supposed to be first.

  • Thanks for the response. The parameter ordering I used above provides the same result, so I don't think it's the order. After giving up on ffmpeg, my keyframe interval was causing issues with other tools. After revisiting this just now, it was the keyframe interval after all. It was set to 5 seconds before and I've since set it to 1 second. At 5 seconds, both your command and the ones I tried above yielded black space at the beginning (3 seconds worth, unsurprisingly). At 1 second, it works as expected. – marcelebrate Apr 12 '11 at 17:05
  • This works for mp3's too – geotheory Jul 11 '15 at 16:00
  • 4
    As explained in FFmpeg Seeking, using -ss as an input parameter (before -i) while copying, or even transcoding with an older version of FFmpeg, employs keyframe seeking. This is much faster, but sacrifices accuracy. If you use it as an output parameter, the process is potentially much slower (the input is decoded frame by frame even for the discarded parts), but accurate. Even though the question is old, I think this should be the accepted answer. – Jonathan Y. Aug 8 '15 at 23:08

Turns out this command will trim the video from 2 seconds on, as expected:

ffmpeg -i input.flv -ss 2 -vcodec copy -acodec copy output.flv

The issue was with the keyframe interval in input.flv. It was set to 5 seconds, which yielded 3 seconds worth of black frames at the beginning of the video (5 - 2 = 3). I've since changed my keyframe interval to 1 second, though 2 seconds would probably also yield the desired results in my case.

UPDATE: Updated ordering of -i and -ss parameters per Dave's answer, which I've accepted for credit.

  • 2
    I was having this issue as well. This post did it for me. I bit the bullet and stopped trying to use -vcodec copy -acodec copy for all my editing commands. Re-encoding prevented the black frames from the beginning of my video or not cutting at the right spot (the difference of a second without re-encoding was translating to almost a 5 second difference in the video). So, I ended up replacing -vcodec copy with -vcodec libx264 -crf 0. – Hendy Oct 25 '13 at 4:54
  • 2
    I just encountered this same thing. I discovered that I cannot just -vcodec copy because the slice doesn't start on a keyframe. I was getting a still image or black image for N seconds until the next keyframe. If I actually re-encode, rather than copy, it works as expected. So even though my input and output are both H264, I still needed to re-encode (using -vcodec libx264 instead of -vcodec copy). – Karl Wilbur Mar 25 '16 at 22:50
  • Daves answer is the correct one as of the latest version of ffmpeg. The -i should come before the -ss. – Arete Jan 5 at 21:25

Use -ss and -to before -i like this:

ffmpeg -ss 00:01:10 -to 00:02:10 -i input -c copy output

Updating this answer, as of 2019 the command is now:

ffmpeg -i input.flv -ss 2 -c copy output.flv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.