Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

I have tried to cut video with the following command

ffmpeg -i "Вспомнить все (Total Recall, 1990).avi"  -ss 01:07:29 -to 01:08:05 fight.avi


Input #0, avi, from '╨Т╤Б╨┐╨╛╨╝╨╜╨╕╤В╤М ╨▓╤Б╨╡ (Total Recall, 1990).avi':
    encoder         : VirtualDubMod (build 2540/release)
    artist          : Menen
  Duration: 01:53:33.69, start: 0.000000, bitrate: 3660 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 704x384 [SAR 1:1 DAR 11:6], 2295 kb/s, 23.98 fps, 23.98 tbr, 23.
98 tbn, 23.98 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:2: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
    Stream #0:3: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
File 'fight.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'fight.avi':
    IART            : Menen
    ISFT            : Lavf55.43.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 704x384 [SAR 1:1 DAR 11:6], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc
      encoder         : Lavc55.67.100 mpeg4
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp
      encoder         : Lavc55.67.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame=  863 fps= 20 q=31.0 Lsize=    2690kB time=00:00:36.00 bitrate= 612.1kbits/s
video:2061kB audio:563kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.500957%

The resulting video has obviously worse quality, with apparent big MPEG squares visible


How to avoid?


Even if re-encoding, then why so drastical change? Can we re-encode so that it will be nearly invisible degrading of quality?


I guess if I use -codec copy then I will be unable to cut at precise moment. Moment precision is a priority. So I agree with quality loss but it should not be so drastical.

share|improve this question
I don't think ffmpeg supports this, but you can get nearly the best of both options by using the original stream (-codec copy) from the nearest keyframe, and re-encoding only the frames between the cut-point and that keyframe. This only works if you have an encoder that can produce output compatible with the original stream, but you can use a high bitrate for the short segment to avoid quality loss. –  Peter Cordes Apr 16 at 8:14

2 Answers 2

Re-muxing only

Use stream copy mode to just re-mux instead of re-encode:

ffmpeg -ss 01:07:29 -i input -codec copy -map 0 -to 01:08:05 fight.avi
  • Using -ss as an input option can be faster than using it as an output option, but it may not be as accurate.

  • -codec copy will stream copy (no re-encoding). Default behavior, if -codec copy is omitted, is to re-encode, and as you've noticed the default encoding settings for most encoders are not optimal (they used to be a decade ago).

  • Default stream selection is to select only one stream per stream type (video, audio, subtitles, data, etc). -map 0 will ensure all streams are copied in case there are multiples of each type. That being said, your input only has two different streams, so it is actually not needed here.

  • Development of ffmpeg is very active, so it is important to use a recent build if possible. See the FFmpeg Download page for several options.

If you must re-encode


You can target a "visually lossless" quality level using the encoder libx264 with the -crf option. CRF is just about as close as you can get to a "constant quality" option: 0 is lossless (but usually results in huge files), ~18 is usually considered to be visually lossless or nearly so, 23 is the default, and 51 is worst.


The encoding speed to compression (quality per file size) ratio. Basically use the slowest preset you have patience for: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow.

ffmpeg -i input -codec:v libx264 -crf 23 -preset medium -ss 01:07:29 -to 01:08:05 output

Also see

share|improve this answer

You are re-encoding the video rather than cutting out a portion of the stream. Any re-encode is going to produce quality loss, particularly when you cut the data rate to less than 1/11th of the original data rate.

If you want to cut out a portion of the video, you need to use a tool like VirtualDUB to actually extract a portion of the actual video stream and put it in a new container without re-encoding. Note that there will be limitations to where you can cut like this since you will need to start at the beginning of a group of pictures.

share|improve this answer
Where am I cutting data rate to 1/11th? –  Dims Jun 19 '14 at 17:00
Your input stream is 2295 kb/s. Your output stream is 200 kb/s. It is probably a default setting since you aren't specifying a bitrate. –  AJ Henderson Jun 19 '14 at 17:02
Can I just conserve bitrate? –  Dims Jun 19 '14 at 17:03
I mean that copy operation may cut at inprecise moments –  Dims Jun 19 '14 at 17:04
So I agree with reencoding if small decreasing of quality –  Dims Jun 19 '14 at 17:04

Your Answer


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.