HandBrake is a free open-source video transcoder. It's goal is to help people rip their DVDs and save them to a file on their computer. Although there are ways to extract Blu-rays using a 3rd party application, I will not covert this in details over here. In my case I like to use the MakeMKV software which allows to do a preprocess and remove the Audio and subtitle tracks I don't need.
HandBrake is available for Windows, OS X and for many Linux distributions. For this last one, you can even use the command lines to convert your videos. This is what we will look at this this tutorial.
apt-get install handbrake-cli
pacman -S handbrake-cli
apacman -S handbrake-cli-git
HandBrakeCLI
-h help -u check for updates -i Input file name or input device (i.e. DVD Player) -o Output file name and location
-t title to encode (by using 0 it will automatically can the input) --scan scan the input and display its information --min-duration Minimum duration (in seconds) a video needs to before being scanned
HandBrakeCLI -i sintel-2k.mp4 --scan
Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2010-09-29 12:52:03 Duration: 00:14:47.99, start: 0.000000, bitrate: 3660 kb/s Stream #0.0(und): Video: h264 (High), yuv420p, 2048x872 [PAR 1:1 DAR 256:109], 3526 kb/s, 24 fps, 1k tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01 00:00:00 Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 127 kb/s (default) Metadata: creation_time : 2010-09-29 12:52:24 [21:41:02] scan: decoding previews for title 1 Scanning title 1 of 1, preview 1, 10.00 %[21:41:02] scan: audio 0x1: aac, rate=44100Hz, bitrate=127998 Unknown (AAC) (2.0 ch) Scanning title 1 of 1, preview 10, 100.00 %[21:41:02] scan: 10 previews, 2048x872, 24.000 fps, autocrop = 0/0/0/0, aspect 2.35:1, PAR 1:1 [21:41:03] libhb: scan thread found 1 valid title(s) + title 1: + stream: /media/hd1/Videos/Movies-Eng/Sintel (2010).mp4 + duration: 00:14:47 + size: 2048x872, pixel aspect: 1/1, display aspect: 2.35, 24.000 fps + autocrop: 0/0/0/0 + support opencl: no + support hwd: not built-in + chapters: + 1: cells 0->0, 0 blocks, duration 00:14:47 + audio tracks: + 1, Unknown (AAC) (2.0 ch) (iso639-2: und) + subtitle tracks:
Duration: 00:14:47.99, start: 0.000000, bitrate: 3660 kb/s Stream #0.0(und): Video: h264 (High), yuv420p, 2048x872 [PAR 1:1 DAR 256:109], 3526 kb/s, 24 fps, 1k tbn, 48 tbc (default)
Scanning title 1 of 1, preview 1, 10.00 %[21:41:02] scan: audio 0x1: aac, rate=44100Hz, bitrate=127998 Unknown (AAC) (2.0 ch) Scanning title 1 of 1, preview 10, 100.00 %[21:41:02] scan: 10 previews, 2048x872, 24.000 fps, autocrop = 0/0/0/0, aspect 2.35:1, PAR 1:1
+ chapters: + 1: cells 0->0, 0 blocks, duration 00:14:47 + audio tracks: + 1, Unknown (AAC) (2.0 ch) (iso639-2: und) + subtitle tracks:
-f format (av_mp4, av_mkv) -e encoder (x264, x265, mpeg4, mpeg2, VP8, Theora) -q quality (default = 20, min = 0, max = 51) or -b video bitrate -2 (opt) Uses 2 pass before encoding the video -T (opt) Activate the turbo mode on the first pass --vfr Variable Frame Rate (preserve the source timing) or --cfr Constant Frame Rate (use the -r flag to define the new rate for your video)
HandBrakeCLI -i sintel-2k.mp4 -f av_mkv -e x265 -q 21 --vfr -o sintel.mkv
HandBrakeCLI -i sintel-2k.mp4 -f av_mp4 -e mpeg4 -b 3000 -2 -T --cfr 23.976 -o sintel.mp4
-a audio tracks (specify the order of your audio tracks seperated by commas. i.e. 1, 3, 2) -E audio encoder (av_aac, fdk_aac, fdk_haac, copy:aac, ac3, copy:ac3, copy:dts, copy:dtshd, mp3, copy:mp3, vorbis flac16, flac24, copy) Note : copy:* will passthrough if it's a supported format. Defaults : av_mp4 av_aac av_mkv mp3 -B Audio bitrate (each encoder hage a different min and max bitrate) or -Q Audio quality (each encoder have a different min and max quality) -6 (opt) Mix down (mono, left_only, right_only, stereo, dpl1, dpl2, 5point1, 6point1, 7point1, 5_2_lfe) -R (opt) Audio rate sample rate (8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48 KHz) -A (opt) Track name ("English", "French", ...)
HandBrakeCLI -i sintel-2k.mp4 -a "1" -E "copy:acc" -A "English" -o sintel.mp4
HandBrakeCLI -i sintel-2k.mp4 -a "2,1" -E "copy:*,mp3" -6 "5point1,sterio" -B "default,128" -o sintel.mp4
-s Subtible track (specify the order of your subtitles separeted by commas. -S (opt)
HandBrakeCLI -i sintel-2k.mp4 -s "1,3,2,5" -S "English,Espanol,Francais,Nihongo" -o sintel.mkv