25

I need a program to cut videos (extract a sub-video from them), but I absolutely need there will be no quality losses at all from the original.

As long as I don't need to do anything more (like editing, resizing, rotating, adding subtitles, colorize etc.), I prefer this program to be very easy to manage. Ideal case would be just setting start capture, end capture, and a button to split.

I have tested Allok Video Splitter, but I am sure there are some (not much, but they exist) degradations in video quality (audio keeps OK, or so it seems), even when I set the program to maximum quality.

Open source method preferred.
Command-line methods accepted.
Windows or Linux platform, please. I have no Mac. No problem to do this on Android, as long as the main feature (no quality loss) remains.

2

5 Answers 5

23

I would suggest using the command line and ffmpeg as in:

ffmpeg -ss start_time -i input_file .ext -t duration -vcodec copy -acodec copy output_file .ext

  • .ext must be a supported video type and the same in both cases note there should be no space between the name and .ext it is only there above to get the bold and italic to work.
  • -ss should be before the input file, this allows the last keyframe before your start time to be selected and must be before -t
  • Where both start_time and duration can be either a number of seconds, minutes:seconds, hours:minutes:seconds and both minutes & seconds limited to 2 digits in any colon format and any seconds can have .milliseconds attached.
  • -vcodec copy -acodec copy informs ffmpeg that you would like exactly the same video and audio encoding, i.e. no loss of quality.

Also note that since ffmpeg works in what is known as a pipeline the order of most options is very significant so if your output file name occurs before some of your options they will be assumed to be options for the next stage in the pipeline and so will not affect your output image. This is done so that you can specify on a single command line one input file and several output files with different options so that you could, for example, generate a sequence of 10 second clips each 5 minutes apart ready to recombine them.

This solution is:

  • Free/Gratis
  • Open Source
  • No change in quality unless you ask for it
  • If you need to you can change format, resolution, order, add still frames, just about anything.
  • Windows, Linux & Mac
  • You do need to find your times for splitting and make a note of them manually but that shouldn't be too much of a stretch.

There are a number of GUI front ends available for ffmpeg, and a lot of programs that don't mention that all they really do is provide one, but why bother for a simple operation like this.

Example command that worked for the OP:

ffmpeg -i OriginalVideo.flv -ss 1:00 -t 3:00 -vcodec copy -acodec copy OutputFile.flv

Thanks to Sopalajo de Arrierez for taking some time to experiment and posting what worked for them.

13
  • Thanks, @Steve, but what do you mean when you say «input_file and output_file both have the same name»? That is not possible. Did you mean «same extension»? Commented Oct 16, 2015 at 15:46
  • @SopalajodeArrierez - exactly that - I'll edit. Commented Oct 16, 2015 at 15:47
  • Tested ffmpeg.exe -i "PathToFile.flv" -ss 01:00 "PathToNewFile.flv" -t 01:00 from Windows 7 in order to extract from minute 1 to minute 2 of a .flv video. The result file has a great quality loss, easy to perceive at first sight. Commented Oct 16, 2015 at 20:56
  • 1
    Another suggestion, Steve: as stated here trac.ffmpeg.org/wiki/Seeking , it has worked better for me to specify -ss timestart before -i input_file.ext, because it sets (or so I understand) the beginning of the generated video to the nearest keyframe found before your specified timestamp. If later specified, the first second(s) of your resulting video could have some delay. More info here: stackoverflow.com/questions/14005110/… . Tested on .flv and .mp4 files. Commented Oct 17, 2015 at 15:32
  • 1
    Works very good, except that audio gets out of sync. Is there a solution to this?
    – bytecode77
    Commented Nov 13, 2016 at 21:06
7

What you're looking for is AviDemux.

AviDemux is an open-source GUI video processing software made in Linux which also has releases for Windows (x86 and x64), it also has a command-line version called avidemux_cli.exe which comes inside the package.

It can perform re-conversion of various formats and also it can perform copy/cut/paste operations with no re-conversion, this means 0% quality is lost during the procedure because is just a remux operation.

It has a very user-friendly UI, and works perfect for cut/split a video once or at various points, as I said, with no reconversion unless you specify the opposite.

AviDemux interface

I love AviDemux, you will love it too. Download it here:

http://fixounet.free.fr/avidemux/download.html

5
  • Tested latest v2.6.10 64 bits to extract 4 minutes from a 5 minutes .flv video: the result is a .avi file that has the audio but no video at all. Commented Oct 16, 2015 at 21:16
  • @Sopalajo de Arrierez If you are working with an FLV video then try select the FLV Muxer instead of AVI Muxer in the "Output Format" list. Commented Oct 17, 2015 at 4:09
  • fosshub.com/Avidemux.html/avidemux_2.6.13_win64.exe doesn't work
    – user4951
    Commented Sep 3, 2016 at 17:49
  • Same issue as @SopalajodeArrierez. Matched audio/video codecs input and output.
    – Hellreaver
    Commented Feb 12, 2018 at 19:15
  • Use up and down to move between keypoints and select segments for deletion with ctrl+pgup/down to allow Avidemux to save without reencoding.
    – Nakilon
    Commented Dec 24, 2020 at 5:05
3

I would like to complete the other answers by referring this solution of mine on another thread that seems to solve the audio sync and beginning of frames frozen issues for ffmpeg :

The key frame issue

The (curious) solution is just on typing the -ss parameter before the -i one.

2

I suggest VideoReDo for Windows. You mark start and end and click cut. When your done cutting click save and save it in the orginal format.

8
  • 1
    Would this tool really convert without any loss at all? All I have tested for now (ffmpeg included) degradate the quality. Commented Oct 16, 2015 at 21:17
  • The only true way to edit is to convert it to an uncompressed AVI. Then as long as it remains so it will never degrade. However, except the file size to increase by a factor of 100x.
    – cybernard
    Commented Oct 16, 2015 at 21:59
  • 1
    "True way to edit?". I don't need to edit the video. The question is about just cutting. Commented Oct 16, 2015 at 22:00
  • Let me rephrase. The only way to get 100% loss less cuts in AVI uncompressed. 99.9% of compression techniques use parts of the data from the previous frame in the next frame. When you cut a chunk out the 2 frames, 1 on either side of the edit, are modified and a tiny amount of loss occurs. Only single frame compression methods will be 100% unmodified. As far those techniques were lost to time. However, uncompressed AVI is just that uncompressed, and each frame is independent of each other so when you cut it no loss occurs, and its uncompressed so no loss there either.
    – cybernard
    Commented Oct 17, 2015 at 0:01
  • ffmpeg has dozens of settings and you can get results with the correct settings. However, a very tiny amount is lost at the cut points, unless you have loss less or uncompressed files. If you convert your file to AVI uncompressed and save it that way when your done any video editor can edit it 100% loss less.
    – cybernard
    Commented Oct 17, 2015 at 0:04
0

I suggest Losless-cut. It uses keyframe cutting.

(+) Windows

(+) Linux

(-) Android

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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