8

This question already has an answer here:

I am trying to cut a long video into several small pieces. Any recommended tools can do the task?

marked as duplicate by David Foerster, Eric Carvalho, Kevin Bowen, WinEunuuchs2Unix, TheWanderer Oct 29 '16 at 1:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @DavidFoerster IMHO - This seems to be specific to cutting into segments as opposed to a general video editing question.. – Elder Geek Oct 27 '16 at 18:43
  • @ElderGeek video editing software is generally used to cut portions of video and move them around. Exporting clips is just one extra step. – TheWanderer Oct 29 '16 at 1:01
  • @Zacharee1 I would agree that cutting and moving is part of video editing. Adding and adjusting sound tracks is also a part. The accepted answer here for cutting a video into clips is better suited to the particular question posed than any of the others in the generic answer marked as a duplicate. Installing a full blown video editing suite seems overkill for the task at hand since ffmpeg accurately handles timecodes with the -ss and -t switches. I don't believe that any of the video editing suites is better suited to this task. – Elder Geek Oct 30 '16 at 15:49
  • 1
    Voting to reopen as I don't see this task as well suited to the video editing suites in th marked duplicate answer. – Elder Geek Oct 30 '16 at 15:52
  • In that case, the question would be too broad imo @elder – TheWanderer Oct 30 '16 at 16:36
18

I found ffmpeg could do the task. To install the ffmpeg sudo apt-get install ffmpeg To copy a specific short duration from the video file.

ffmpeg -i original.mp4 -ss 00:01:52 -c copy -t 00:00:10 output.mp4

  • -i:input file. The file name of the original video clip.
  • -ss:start timestamp. In my case I tried to copy the new video from the original video started after 1 minute and 52 seconds.
  • -t:indicating the duration of the new video clip, in my case, 10 seconds.

  • Not sure parameter -c for, maybe the action? If some1 knows, let me know plz.


Reference:
- Cut video by using ffmpeg
- ffmpeg seeking in subsection [cut small sections]

  • 3
    -c indicates the codec to use (in this case copy as is without re-encoding) – Elder Geek Oct 27 '16 at 18:42
  • 1
    For me it created audio mp4 file. – expert Oct 7 '18 at 16:05
  • Thanks, but any solution for some fraction of a second? -ss 00:00:07:35 is invalid. – SYK Nov 22 '18 at 7:50
3

Kdenlive, a non-linear video editor.

Install with:

$ sudo apt install kdenlive

You can see others by running Ubuntu Software and typing video editor in the search area.

1

Avidemux is good for quickly cutting video. Despite the name, it handles MPEG-4 video standards fine (as well as any other modern format like MKV).

It's not a non-linear editor, meaning that once you've made some cuts you can't go back and change earlier ones, and you can't re-order segments or insert new segments (although you can join videos by adding new clips at the end). It's great for simple tasks like trimming the start and end and maybe commercial breaks.

It can do what you want without issues - just select the segment to output, export it, then select the next part, and so on. If your selections fall on GOP boundaries (ie I-frames) then you can do it losslessly - without re-encoding, using "copy" as the video/audio codecs.

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