0
0
mirror of https://gist.github.com/1f8fdd96ead3829465897e413188190a.git synced 2025-07-04 21:13:55 +00:00
This commit is contained in:
Nuno Pereira 2023-10-04 01:27:18 +01:00 committed by GitHub
parent b235ce2756
commit 7866b741bb

View File

@ -5,10 +5,9 @@ Full documentation: https://ffmpeg.org/ffmpeg.html
``` ```
ffmpeg -i input.mkv ffmpeg -i input.mkv
``` ```
track indexes are zero-based. track indexes are zero-based.
### Types ### Track types
``` ```
v - video v - video
a - audio a - audio
@ -19,12 +18,12 @@ m - metadata
``` ```
--- ---
### Pick tracks ### Pick tracks
syntax #### syntax
``` ```
ffmpeg -i input.mkv -map 0:type -map 0:type -c copy output.mkv ffmpeg -i input.mkv -map 0:type -map 0:type -c copy output.mkv
ffmpeg -i input.mkv -map 0:type:index -map 0:type:index -c copy output.mkv ffmpeg -i input.mkv -map 0:type:index -map 0:type:index -c copy output.mkv
``` ```
#### examples: #### examples
pick all video tracks, second audio track and third subtitle track: pick all video tracks, second audio track and third subtitle track:
``` ```
ffmpeg -i input.mkv -map 0:v -map 0:a:1 -map 0:s:2 -c copy output.mkv ffmpeg -i input.mkv -map 0:v -map 0:a:1 -map 0:s:2 -c copy output.mkv
@ -35,18 +34,18 @@ ffmpeg -i "$i" -map 0:v:0 -map 0:a:0 -map 0:s:0 -map 0:t -c copy
``` ```
--- ---
### Omit tracks (negative mapping) ### Omit tracks (negative mapping)
syntax #### syntax
``` ```
ffmpeg -i input.mkv -map 0 -map -0:type:index -c output.mkv ffmpeg -i input.mkv -map 0 -map -0:type:index -c output.mkv
``` ```
#### examples: #### examples
keep all tracks except first audio and first subtitle tracks: keep all tracks except first audio and first subtitle tracks:
``` ```
ffmpeg -i input.mkv -map 0 -map -0:a:0 -map -0:s:0 -c output.mkv ffmpeg -i input.mkv -map 0 -map -0:a:0 -map -0:s:0 -c output.mkv
``` ```
--- ---
### Extract subtitle track ### Extract subtitle track
syntax #### syntax
``` ```
ffmpeg -i input.mkv -map 0:m:key:value -c:s copy|format output.srt ffmpeg -i input.mkv -map 0:m:key:value -c:s copy|format output.srt
``` ```