What is the command to cut a portion out of a video and save it using ffmpeg?

I've tried

ffmpeg -t in_movie.avi -ss 00:26:20 -t 00:28:24 out_movie.avi

but that's giving me:

Invalid duration specification for t: in_movie.avi

Please advise.

UPDATE: Molly, that command gives:

FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5+svn20090706-2ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Oct 13 2009 22:15:16, gcc: 4.4.1
Input #0, avi, from 'extras.s01.e01.ws.dvdrip.xvid-m00tv.avi':
  Duration: 00:29:04.04, start: 0.000000, bitrate: 1120 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x368 [PAR 1:1 DAR 40:23], 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 32 kb/s
Output #0, avi, to 'out_movie.avi':
    Stream #0.0: Video: mpeg4, yuv420p, 640x368 [PAR 1:1 DAR 40:23], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream #0.1: Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbitframe=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbitframe=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbit

And then it appears to freeze. I'd appreciate any help.


Solution 1:

you were pretty close :)

the correct syntax would be ffmpeg -i InputFile -ss StartTime -t Duration Outputfile

so try:

ffmpeg -i in_movie.avi -ss 00:26:20 -t 00:28:24 out_movie.avi

Update

this episode is about 40:23 long. -t specifies the duration, not the end time. your command will start recording at 26:20 for 28 minutes and 24 seconds, that would be until 54:44. if you want to record from 26:20 to 28:24 use the switch -t 00:02:04 instead.

ffmpeg -i in_movie.avi -ss 00:26:20 -t 00:02:04 out_movie.avi

now this will give you an AVI clip 2 minutes and 4 seconds long, captured from 26:20 to 28:24