from start to the specified time (-t
) parameter:
ffmpeg -t 00:03:59.700 -i video.mp4 -c copy cut.mp4
from the specified time (-ss
) parameter to the end:
ffmpeg -ss 00:01:00.700 -i video.mp4 -c copy cut.mp4
both -ss
and -t
parameter:
ffmpeg -ss 1:00 -i video.mp4 -to 2:00 -c copy cut.mp4
ffmpeg -ss 1:00 -i video.mp4 -to 2:00 -c copy -copyts cut.mp4
#1 cut from 1:00 to 3:00 (of original).
͏#2 cut from 1:00 to 2:00 intended (adding -copyts
to keep original timestamps unmodified).
Adding -c copy
is needed to ensure you're not hurting the quality of your file further by transcoding,
since you're keeping the same format.
Doing -c copy
will copy both the audio codec (acodec) and the video codec (vcodec)
-c copy
is the same as-acodec copy -vcodec copy
-c:a copy
is the same as-acodec copy
-c:v copy
is the same as-vcodec copy
And of course you can specify a codec e.g. -vcodec libx264
or -c:v libx264
The -c
stands for codec. You can alternatively write -codec
e.g. -codec:a copy
.
And if you don't specify e.g. -acodec copy
or -acodec blahblah
or -codec:a ...
, then it will pick some default codec.
You can also say -vn
for no video so it doesn't copy video. Or -an
for no audio.
Also:
The syntax of -acodec
and -vcodec
is deprecated now.
And it's recommended to use the syntax of -c:a
and -c:v
(which are aliases for -codec:a
and -codec:v
)