Skip to content

Instantly share code, notes, and snippets.

@alexarje
Last active Dec 19, 2019
Embed
What would you like to do?
Trim video using ffmpeg
ffmpeg -i input.mp4 -ss 01:10:27 -to 02:18:51 -c:v copy -c:a copy output.mp4
@chessset5

This comment has been minimized.

Copy link

@chessset5 chessset5 commented Nov 22, 2018

What would you do if you want to copy more than one Audio track?
The clip i am try to cut has 5 stereo audio tracks and I want all of them to appear in the new cut file, I know its possible but I have forgotten the commands to do so.

@avatar-lavventura

This comment has been minimized.

Copy link

@avatar-lavventura avatar-lavventura commented Apr 30, 2019

Thanks works great!

@avatar-lavventura

This comment has been minimized.

Copy link

@avatar-lavventura avatar-lavventura commented Apr 30, 2019

@chessset5:
fmpeg -i input.mkv -q:a 0 -map a sample.mp3

@chessset5

This comment has been minimized.

Copy link

@chessset5 chessset5 commented May 4, 2019

@paulchabotca

This comment has been minimized.

Copy link

@paulchabotca paulchabotca commented Jun 7, 2019

If you use the ss parameter before input param, the process will happen even faster, as you will be seeking rather than decoding. Placing ss after the input results in the same effect but...

"Here, the input will be decoded (and discarded) until it reaches the position given by -ss. This will be done very slowly, frame by frame. As of FFmpeg 2.1, the main advantage is that when applying filters to the output stream, the timestamps aren't reset prior to filtering (i.e. when ​burning subtitles into a video, you don't need to modify the subtitle timestamps), but the drawback is that it will take a lot of time until it finally reaches that time point. The bigger the seeking time is, the longer you will have to wait."

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment