Cut a Video using ffmpeg

To cut a video using ffmpeg, use

ffmpeg -ss 00:17:00 -i IN_FILE.avi -t DURATION_IN_SECONDS -acodec copy -vcodec copy -async 1 OUT_FILE.avi

To cut a video and encoding it

ffmpeg -ss 00:17:00 -i IN_FILE.avi -t DURATION_IN_SECONDS -crf 25.0 -c:v libx264 -c:a aac -ar 48000 -b:a 160k -coder 1 -threads 0 OUT_FILE.mp4

DURATION_IN_SECONDS specify duration of new clip. If you specify 60, it will cut 60 seconds of video start from time specified in -ss. In this cause, from 00:17:00 to 00:18:00.

For more info, see “Cutting small sections” part of ffmpeg documentation.

https://trac.ffmpeg.org/wiki/Seeking

ffmpeg -ss 00:34:00 -t 00:02:00 -i IN_FILE.wmv -crf 25.0 -c:v libx264 -c:a libfaac -ar 48000 -b:a 160k -coder 1 -threads 0 OUT_FILE.mp4

In this example

-ss 0:34:00 -t 0:02:00

Means cut video from 00:34:00 to 00:36:00

If you want to cut a video from time 01:00:00 to 01:20:00, use

-ss 01:00:00 -t 00:20:00

10-Apr-2013 This command works great, i tested on many videos.

Cut video with avconv

avconv -y -ss 00:04:00 -i BootstrapWebDesign-03.mov -t 00:00:30 -crf 25.0 -c:v libx264 -c:a libvo_aacenc -ar 48000 -b:a 160k -coder 1 -threads 0 1.mp4

Cut video with mencoder

mencoder -ss 01:00:00 -endpos 00:00:30 -ovc copy -oac copy 1.avi -o 2.avi

-ss = start time in hh:mm:ss format

-endpos = Duration in hh:mm:ss format

Example

Following with create a video “out.avi” from MSFT.avi from 00:24:00 to 00:25:00

mencoder -ss 00:24:00 -endpos 00:01:00 -ovc copy -oac copy MSFT.avi -o out.avi

21 April 2011 verified and working

See ffmpeg

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *