Skip to content

Instantly share code, notes, and snippets.

@uwe-schwarz
Last active April 2, 2019 07:44
Show Gist options
  • Select an option

  • Save uwe-schwarz/52340cff9102d7aec79f921fa35a8bac to your computer and use it in GitHub Desktop.

Select an option

Save uwe-schwarz/52340cff9102d7aec79f921fa35a8bac to your computer and use it in GitHub Desktop.
ffmpeg examples

analyze file

ffprobe file 2>&1 | grep Stream

    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x802 [SAR 1:1 DAR 960:401], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default) (forced)
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:3(ger): Subtitle: subrip (default) (forced)

remove german audio track

ffmpeg -i file -c:v copy -c:a copy -c:s copy -map 0:0 -map 0:2 -map 0:3 out

convert audio track to aac 2.0 256kbit

ffmpeg -i file -c:v copy -c:s copy -c:a aac -ab 256k -ac 2 out

generate new file starting at position "seconds"

ffmpeg -i file -c:v copy -c:a copy -c:s copy -ss seconds out

switch tracks (german and english audio track)

ffmpeg -i file -c:v copy -c:a copy -c:s copy -map 0:0 -map 0:2 -map 0:1 -map 0:3 out

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