Skip to content

Instantly share code, notes, and snippets.

@lox
Created January 24, 2010 00:22
Show Gist options
  • Save lox/284883 to your computer and use it in GitHub Desktop.
Save lox/284883 to your computer and use it in GitHub Desktop.
1) extract tracks from the mkv file
mkvextract tracks <source_file.mkv> 1: <source_file.h264> 2:<source_file.ac3>
2) convert video to be compliant with the ATV
ffmpeg -y -i <source_file.h264> -vcodec libx264 -b <bitrate> -maxrate <max_bitrate> -an -threads 4 -level 31 -g 250 -qmin 10 -qmax 51 -qdiff 4 -subq 6 -flags +loop -flags2 +mixed_refs+wpred -sc_threshold 40 -partitions +parti4x4+partp8x8+partb8x8 -refs 4 -bf 16 -keyint_min 25 -me_method umh -me_range 16 -i_qfactor 0.71 -cmp +chroma -b_strategy 1 -qcomp 0.6 -trellis 0 -rc_eq 'blurCplx^(1-qComp)' -f h264 <dest_file.h264>
3) convert audio to aac
ffmpeg -y -i <source_file.ac3> -vn -acodec libfaac -ab 160k -ar 48000 -ac 2 -async 50 -threads 4 -f aac <dest_file.aac>
4) join all the tracks together
mp4box -add <dest_file.h264> -add <dest_file.aac> -add <source_file.ac3> <dest_file.mp4>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment