Skip to content

Instantly share code, notes, and snippets.

@alexarje
Last active December 19, 2019 17:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexarje/5771fb4ab0a4a0bfe895ae57b5838bb3 to your computer and use it in GitHub Desktop.
Save alexarje/5771fb4ab0a4a0bfe895ae57b5838bb3 to your computer and use it in GitHub Desktop.
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
Copy link

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
Copy link

Thanks works great!

@avatar-lavventura
Copy link

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

@chessset5
Copy link

@paulchabotca
Copy link

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