Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using ffmpeg to cut out a section of a large file like this:

ffmpeg -i input.wmv -ss 60 -t 60 -acodec copy -vcodec copy output.wmv

The -ss part works fine but the -t is ignored. It correctly removes the initial specified seconds specified with -ss but then keeps going to the end of the input with the copy.

Is there a way to use ffmpeg to cut off the end of a video without recoding it?

share|improve this question
this syntax is correct. – jiggunjer Dec 8 '15 at 7:03

You can use the -ss option to specify a start timestamp, and the -t option to specify the encoding duration. The timestamps need to be in format or in seconds.

The following would clip the first 30 seconds, and then clip everything that is 10 seconds after that:

ffmpeg -i input.wmv -ss 00:00:30.0 -c copy -t 00:00:10.0 output.wmv
ffmpeg -i input.wmv -ss 30 -c copy -t 10 output.wmv

Note that -t is an output option and always needs to be specified after -i.

Some tips:

  • If you use -ss after -i, you get more accurate seeking at the expense of a slower execution altogether. You can also put -ss before -i. See also: Seeking with FFmpeg

    • This is no longer true as of FFmpeg 2.1; the location of -ss will not affect the accuracy of the encode. However, there will still be some other differences in your encode as noted at the link above.
  • You can use -to instead of -t to specify the timestamp to which you want to cut. So, instead of -i <input> -ss 30 -t 10 you could also do -i <input> -ss 30 -to 40 to achieve the same thing.

  • If your ffmpeg does not support -c, or -to, it is likely very outdated. Compile a new version yourself or download a static build from their homepage. It's really not complicated.

share|improve this answer
@Mondain Actually, you get more accuracy putting the -ss after. And slhck mentions this here… also in ffmpeg documentation for -ss it mentions a difference between putting it before or after. – barlop Oct 11 '13 at 0:38
+1 I came here to figure out how to ignore everything after the first 35 seconds, thanks: ffmpeg -i input.wmv -c copy -t 35 output.wmv – karlphillip Sep 5 '14 at 19:20
This does not work for me (mp4). It just produces a 5 second black screen: frame= 150 fps=0.0 q=-1.0 Lsize= 264kB time=00:00:09.97 bitrate= 216.6kbits/s – clocksmith May 15 '15 at 18:42
This produced 3-4 s black screen in the beginning of my video clip. Chris's modification with omitting -c copy removed the initial black screen, see his answer for details. – cheflo Apr 16 at 22:32

As other people mentioned, putting -ss before (much faster) or after (more accurate) the -i makes a big difference. The section "Fast And Accurate Seeking" on the ffmpeg seek page tells you how to get both, and I have used it, and it makes a big difference. Basically you put -ss before AND after the -i, just make sure to leave enough time before where you want to start cutting to have another key frame. Example: If you want to make a 1-minute clip, from 9min0sec to 10min 0sec in Video.mp4, you could do it both quickly and accurately using:

ffmpeg -ss 00:08:00 -i Video.mp4 -ss 00:01:00 -t 00:01:00 -c copy VideoClip.mp4

The first -ss seeks fast to (approximately) 8min0sec, and then the second -ss seeks accurately to 9min0sec, and the -t 00:01:00 takes out a 1min0sec clip.

Also note this important point from that page: "If you use -ss with -c:v copy, the resulting bitstream might end up being choppy, not playable, or out of sync with the audio stream, since ffmpeg is forced to only use/split on i-frames."

This means you need to re-encode the video, even if you want to just copy it, or risk it being choppy and out of sync. You could try just -c copy first, but if the video sucks you'll need to re-do it.

share|improve this answer
the same warning applies to -c:a copy for this way of seeking. – jiggunjer Dec 8 '15 at 4:10
The best answer, this way worked the best for me. – Ondra Žižka Mar 24 at 11:04


Open the file in a media player that will frame by frame advance and play an AVISynth file with data such as:

DirectShowSource(("C:\Downloads\Video\Do you want him.flv"), Pixel_Type="yuy2").Crop(0,0,-0,-0)
Subtitle("C:\Downloads\Video\Do you want him.flv", font="Arial", size=24, text_color=$ff0000, align=3)
ShowFrameNumber(scroll=true, x=336, y=27, font="Arial", size=24, text_color=$ff0000)
ShowTime(x=398, y=44, font="Arial", size=24, text_color=$ff0000)

Then cut with the EXACT time format:

ffmpeg -i "Path\do you want him.flv"        \
       -ss 00:00:05.240 -to 00:00:08.360    \
       -vcodec libx264 -acodec libvo_aacenc \
       "Path\Do you want him1.flv"


ffmpeg -i "Path\do you want him.flv"        \
       -ss 00:00:10.240 -to 00:00:14.360    \
       -vcodec libx264 -acodec libvo_aacenc \
       "Path\Do you want him2.flv"

Now make a txt file with the video files with contents like:

file 'C:\Downloads\Video\Do you want him1.flv'
file 'C:\Downloads\Video\Do you want him2.flv'

Run ffmpeg:

ffmpeg -f concat -i FileList.txt -c copy "Path\NewName_joined.flv"


I wrote a program but need have to 10 reputation to show it.

share|improve this answer
Now you have over 10 reputation, so - go ahead :) – Ondra Žižka Mar 24 at 11:02
I just upped this answer so you get some more rep, if you wouldn't mind showing the program now ? – Danijel-James W May 30 at 11:32
Would love to see the code. – Shane Jul 12 at 14:42

I found that -ss combined with -c copy resulted in a half-second chop at the start.

To avoid that, you have to remove the -c copy (which admittedly will do a transcode).

share|improve this answer

For me -t option didn't work, but -vframes worked. I prefer using #frames, since I would rather cut at I-Frames and I found out GOP for video using ffprobe.

The command line that worked for me is:

ffmpeg -ss 60s -i input.wmv -vframes 1800 -acodec copy -vcodec copy output.wmv

By the way, putting -ss in the front of -i makes a big difference in execution time.

share|improve this answer
Actually -vframes (or -frames:v) should come after -i because it's an output option. – slhck Nov 20 '13 at 12:55

You must log in to answer this question.

protected by Community Jan 4 at 6:50

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .