Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
I'm having this same issue, but only with WMV files. I'm guessing its a bug in the ffmpeg asf/wmv decoder. – Bryce Kahle Nov 2 '10 at 18:30
I found a ffmpeg bug report for this issue. See roundup.ffmpeg.org/issue2034 – Bryce Kahle Nov 2 '10 at 19:10

5 Answers

It needs to be in HH:MM:SS.xxx format. The following worked for me to clip the first 30 seconds, and then clip everything that is 10 seconds after that:

-ss 00:00:30.0 -t 00:00:10.0 

The full command might look like:

ffmpeg -ss 00:00:30.0 -t 00:00:10.0 -i input.wmv -acodec copy -vcodec copy -async 1 output.wmv
share|improve this answer
3  
You can actually use either seconds as @Neil did or the time format you suggested. – Bryce Kahle Nov 2 '10 at 18:50
2  
It's important to note that your "ss" must come before your input "i" or you'll be waiting "ss" worth of time before any processing actually begins. gregoire.org/2009/12/05/fun-with-ffmpeg – Mondain Feb 14 '12 at 18:02

I can cut video files as below:

$ ffmpeg  -t 00:00:10 -vcodec copy -acodec copy -i 5.mpg test.mpg

FFmpeg version 0.6.2, Copyright (c) 2000-2010 the FFmpeg developers
  built on Apr 26 2011 18:20:20 with gcc 4.2.1 (Apple Inc. build 5664)
  configuration: --prefix=/opt/local --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-libvpx --enable-libspeex --enable-nonfree --mandir=/opt/local/share/man --enable-shared --enable-pthreads --disable-indevs --cc=/usr/bin/gcc-4.2 --arch=x86_64
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     1.11. 0 /  1.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[mpeg @ 0x12180c800]max_analyze_duration reached
Input #0, mpeg, from '5.mpg':
  Duration: 00:01:32.68, start: 0.500000, bitrate: 1559 kb/s
    Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 384x288 [PAR 1:1 DAR 4:3], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0.1[0x1c0]: Audio: mp2, 44100 Hz, 2 channels, s16, 128 kb/s
Output #0, mpeg, to 'test.mpg':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0: Video: mpeg1video, yuv420p, 384x288 [PAR 1:1 DAR 4:3], q=2-31, 104857 kb/s, 90k tbn, 25 tbc
    Stream #0.1: Audio: mp2, 44100 Hz, 2 channels, 128 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  249 fps=  0 q=-1.0 Lsize=    1672kB time=10.00 bitrate=1369.7kbits/s    
video:1503kB audio:156kB global headers:0kB muxing overhead 0.790309%
share|improve this answer

Does using a unit work? (works here)

ffmpeg -i input.wmv -ss 60s -t 60s -acodec copy -vcodec copy output.wmv
share|improve this answer

what I ended up having to do was put the -t option after the input file: ffmpeg -ss 10s -i input.flv -t 5s output.flv

technically this was avconv not the original ffmpeg but perhaps it works with ffmpeg as well.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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