To remove a section from the start of a video
Use the –ss (start seek) option before the –i (input filename) parameter. The following would trim the first 35 seconds from the start of the video.:
1 |
avconv –ss 35 –i input_filename.MP4 –codec copy output_filename.MP4 |
Using the –codec copy option means it won’t alter the audio/video streams, and means the operation happens is nearly instantly
To trim the end off a video
Use the –t option to specify the number of seconds you want to trim up to from the start of the video. The following would keep just the first 2 minutes of the video:
1 |
avconv –i input_filename.MP4 –codec copy –t 120 output_filename.MP4 |
To keep just a section from the middle of a video
The two options above can be used in conjuntion, i.e. the following would keep 2 minutes of footage, starting at 35 seconds into the original video:
1 |
avconv –ss 35 –i input_filename.MP4 –codec copy –t 120 output_filename.MP4 |