Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Trying to cut a fragment from MKV video, but getting an error.

What can be a reason?

V:\VIDEO>ffmpeg -ss 00:42:35 -t 00:43:05 -i smenia.mkv -map 0:0 -map 0:1 -vcodec copy -acodec copy clientalwaysright.mkv
FFmpeg version SVN-r21566-xuggle-3.4.843, Copyright (c) 2000-2010 Fabrice Bellard, et al.
  built on Jan 31 2010 09:45:05 with gcc 4.2.4 (TDM-1 for MinGW)
  configuration: --prefix=/usr/local --extra-version=xuggle-3.4.843 --extra-cflags=-I/c/hudson/slave/workspace/xuggle_xu
bel/WindowsXP_i386/build/native/i686-pc-mingw32/captive/usr/local/include --extra-ldflags=-L/c/hudson/slave/workspace/xu
JDK5/label/WindowsXP_i386/build/native/i686-pc-mingw32/captive/usr/local/lib --enable-shared --enable-gpl --enable-nonfr
libx264 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libopencor
mrwb --extra-cflags=-mno-cygwin --extra-cflags=-fno-common --extra-ldflags=-mno-cygwin --extra-ldflags=--out-implib --en
ign-hack
  libavutil     50. 8. 0 / 50. 8. 0
  libavcodec    52.49. 0 / 52.49. 0
  libavformat   52.48. 0 / 52.48. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 9. 0 /  0. 9. 0
[matroska @ 0x1f17270]max_analyze_duration reached
[matroska @ 0x1f17270]Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (66893/1395) -> 23.98 (24000/1001)
Input #0, matroska, from 'smenia.mkv':
  Duration: 01:52:36.41, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264, yuv420p, 1280x544, PAR 1:1 DAR 40:17, 24.39 fps, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0.1(rus): Audio: aac, 48000 Hz, stereo, s16
    Metadata:
      description     : rus MVO
    Stream #0.2(rus): Audio: aac, 48000 Hz, stereo, s16
    Metadata:
      description     : rus OVO
    Stream #0.3(eng): Audio: aac, 48000 Hz, stereo, s16
    Stream #0.4(rus): Subtitle: 0x0000
    Stream #0.5(eng): Subtitle: 0x0000
File 'clientalwaysright.mkv' already exists. Overwrite ? [y/N] y
Number of stream maps must match number of output streams
share|improve this question
    
Just curious: Did you get this to work? –  slhck Mar 23 '13 at 16:03
    
Sure, it worked, thanks a lot! :) –  Suzan Cioc Mar 23 '13 at 17:30
add comment

1 Answer 1

up vote 2 down vote accepted

Please download a recent version of FFmpeg. The one you're using is more than three years old, and I'm fairly sure it should just work with a recent build – quite a few things have been changed since then. For Windows, you can use the Zeranoe builds.

You can then simply do:

ffmpeg -ss 00:42:35 -i smenia.mkv -map 0 -c copy -t 00:43:05 clientalwaysright.mkv

It's enough to specify -map 0 to tell FFmpeg to map all streams from the input, including the subtitles. The -c copy option will tell it to do a bitstream copy for video, audio and subtitle streams. No need to explicitly specify the copy codec for each stream anymore.

If you only want to map specific audio and subtitle channels (e.g., first audio and first subtitle stream), doing this should work fine:

ffmpeg -ss 00:42:35 -i smenia.mkv -map 0:v -map 0:a:0 -map 0:s:0 -c copy -t 00:43:05 clientalwaysright.mkv

I moved the -t option after the input, as it's not an input option and should go between -i and your output file name. If you want your cut to be more accurate, consider moving -ss after -i. Refer to the documentation for more.

share|improve this answer
add comment

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.