With the script you can convert all your material and filter tracks, languages etc.
You can download the latest release here: https://github.com/AlBundy33/hb_rb/tree/master/build
Just download HandbrakeCLI for your platform and save it in the appropriate folder under tools.
I've tested the script on OSX and Windows.
This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt (available in archive).
This is free software, and you are welcome to redistribute it under certain conditions.
Main advantages of the script are:
- no need to work with audio-track-numbers - simply use "deu", "eng", etc. to specifiy the wanted language(s)
- filter tracks by duration (e.g. to convert all eposiodes from a dvd)
- prevent tracks from converting twice
- works with single-files, DVDs and with blurays
- recursive converting
- works also with presets
some examples
Code: Select all
convert main-feature with all original-tracks (audio and subtitle) for languages german and english (override languages with --lang)
hb.rb --input /dev/rdisk1 --output "~/Movie.m4v" --movie
convert all episodes with all original-tracks (audio and subtitle) for languages german and english
hb.rb --input /dev/rdisk1 --output "~/Series_SeasonX_#pos#.m4v" --episodes
convert complete file or DVD with all tracks, languages etc.
hb.rb --input /dev/rdisk1 --output "~/Output_#pos#.m4v"
convert all MKVs recursive in a directory
hb.rb --input "~/MKV/**/*.mkv" --output "~/#title#.m4v"
Code: Select all
This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt.
This is free software, and you are welcome to redistribute it under certain conditions.
For questions, feature-requests etc. visit: https://forum.handbrake.fr/viewtopic.php?f=10&t=26163
Usage: hb [options]
common
--input INPUT input-source
--output OUTPUT output-file (mp4, m4v and mkv supported)
available place-holders
#pos# - title-number on input-source
#size# - resolution
#fps# - frames per second
#ts# - current timestamp
#title# - source-title (dvd-label, directory-basename, filename)
#source# - name of input
#source_basename# - name of input without extension
#source_dirname# - complete path to the input-file
#source_parentname# - directoryname of the input-file
#encoder# - the used video-encoder
--force force override of existing files
--check show only available titles and tracks
--help Display this screen
--hbpreset PRESET user defined presets (bluray, plex)
output-options
--compatibility enables iPod compatible output (only m4v and mp4)
--autocrop automatically crop black bars
--max-width WIDTH maximum video width (e.g. 1920, 1280, 720)
--max-height HEIGTH maximum video height (e.g. 1080, 720, 576)
--audio LANGUAGES the audio languages
--subtitles LANGUAGES the subtitle languages
--lang LANGUAGES sets audio and subtitle languges
--burnin-forced Burn in the first forced subtitle
--audio-track SETTINGS the audio-settings to use
allowed options
encoder - the audio encoder to use (allowed: copy, auto, ca_aac, ca_haac, ac3, mp3, vorbis, flac16, flac24, default: copy)
mixdown - allowed: auto, mono, left_only, right_only, stereo, dpl1, dpl2, 5point1, 6point1, 7point1, 5_2_lfe), default: auto)
bitrate - the bitrate to use (default: 160kb/s)
codec - the codec-filter to apply (regular expression)
language - the language-filter to apply (space separated)
--audio-settings SETTINGS encoding settings for auto-encoder depending on audio-type
allowed options
track - regular expression for track (use * to set default settings)
encoder - the audio encoder to use (allowed: copy, ca_aac, ca_haac, ac3, mp3, vorbis, flac16, flac24)
mixdown - allowed: auto, mono, left_only, right_only, stereo, dpl1, dpl2, 5point1, 6point1, 7point1, 5_2_lfe))
bitrate - the bitrate to use
--preset PRESET the handbrake-preset to use
allowed: Android, Android Tablet, AppleTV, AppleTV 2, AppleTV 3, High Profile, Normal, Universal, Windows Phone 8, iPad, iPhone & iPod touch, iPod)
--preview [RANGE] convert only a preview in RANGE (default: 00:01:00-00:02:00)
filter-options
--main main-feature only
--titles TITLES the title-numbers to convert (use --check to see available titles)
--chapters CHAPTERS the chapters to convert (e.g. 2 or 3-4)
--min-length DURATION the minimum-track-length - format hh:nn:ss
--max-length DURATION the maximum-track-length - format hh:nn:ss
--skip-duplicates skip duplicate titles (checks block-size)
--only-first-track-per-language
convert only first audio-track per language
--skip-commentaries ignore commentary-audio- and subtitle-tracks
--skip-forced ignore forced subtitles
options passed through handbrake (see handbrake-help for info)
--large-file
--encopts OPTIONS
--quality QUALITY
--[no-]decomb
--[no-]detelecine
--[no-]loose-anamorphic
logging
--log [LOGFILE] write all output to LOGFILE
--log-override always override logfile
--log-overview LOGFILE write additional overview-file
--create-encode-log create the handbrake encode-log based on the outputfile-name
expert-options
--loops LOOPS processes input LOOPS times (default: 1)
--wait LOOPS retries LOOPS times to wait for input (default: unlimited)
--xtra ARGS additional arguments for handbrake
--temp DIR use DIR as temp-directory
--debug enable debug-mode (doesn't start conversion)
--verbose enable verbose output
--testdata FILE read info from/write info to file
--encoder ENCODER sets the video-encoder to use (available: x264, mpeg4, mpeg2, theora)
--qsv enables hardware-acceleration with qsv_h264 if available, otherwise x264 will be used
--x264-profile PRESET use x264-profile (baseline, main, high, high10, high422, high444)
--x264-preset PRESET use x264-preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo)
--x264-tune OPTION tune x264 (film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency)
--disable-progress disables handbrakes progress output
commands to run after input was processed
--input-done-cmd COMMAND runs user defined COMMAND (use #file# as placeholder)
--input-move TARGETDIR moves file to TARGETDIR
--input-delete deletes file
--input-copy TARGETDIR copies file to TARGETDIR
--input-eject eject tray
commands to run after output was created
--output-done-cmd COMMAND runs user defined COMMAND (use #file# as placeholder)
--output-move TARGETDIR moves file to TARGETDIR
--output-copy TARGETDIR copies file to TARGETDIR
shorts
--audio-copy sets: --audio-track encoder=copy
--audio-mixdown sets: --audio-track encoder=ca_aac,mixdown=dpl2
--movie sets: --default --main
--episodes sets: --default --min-length 00:10:00 --max-length 00:50:00 --skip-duplicates
--default sets: --audio deu,eng --subtitles deu,eng --audio-copy --skip-commentaries --only-first-track-per-language
--bluray sets: --no-decomb --no-detelecine --no-loose-anamorphic
hints:
use raw disk devices (e.g. /dev/rdisk1) to ensure that libdvdnav can read the title
see https://forum.handbrake.fr/viewtopic.php?f=10&t=26165&p=120036#p120035
examples:
convert main-feature with all original-tracks (audio and subtitle) for languages german and english
hb.rb --input /dev/rdisk1 --output "~/Movie.m4v" --movie
convert all episodes with all original-tracks (audio and subtitle) for languages german and english
hb.rb --input /dev/rdisk1 --output "~/Series_SeasonX_#pos#.m4v" --episodes
convert complete file or DVD with all tracks, languages etc.
hb.rb --input /dev/rdisk1 --output "~/Output_#pos#.m4v"
convert MKV, add at first the english mixed down track and after that the copied english and german track
hb.rb --input ~/mymovie.mkv --output "~/Output_#pos#.m4v" --audio-track encoder=ca_aac,mixdown=dpl2,language=eng --audio-copy
convert all local DVDs recursive in a directory
hb.rb --input "~/DVD/**/VIDEO_TS" --output "~/#title#_#pos#.m4v"
convert all MKVs in a directory
hb.rb --input "~/MKV/*.mkv" --output "~/#title#.m4v"
convert 10 DVDs, eject disc when done (OSX) and wait for next
hb.rb --input /dev/rdisk1 --output "~/#title_#pos#.m4v" --movie --preset "Android Mid" --loops 10 --input-done-cmd "drutil tray eject"
input not set
Code: Select all
tag_episode.rb Copyright (C) 2013 AlBundy
This program comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt.
This is free software, and you are welcome to redistribute it under certain conditions.
For questions, feature-requests etc. visit: https://forum.handbrake.fr/viewtopic.php?f=10&t=26163
Usage: tag_episode [options]
--provider PROVIDER tag-provider
imdb: imdb.com (en)
sj: serienjunkies.de (de)
--query QUERY series QUERY (depending on provider)
--season NUM season number
--episode NUM episode number
--name NAME series name (overrides name from provider)
--test test-only
--tag tag file
--rename rename file
--pattern PATTERN pattern for the new name (default: #name# - #season#x#episode# - #title# (#title_org#).#filename#)
--help Display this screen
Code: Select all
requirements
============
To run hb.rb you need an installed ruby-interpreter.
You can get the current version of ruby for your platfrom from http://www.ruby-lang.org/
installation
============
1. download the latest version from https://forum.handbrake.fr/viewtopic.php?f=10&t=26163
2. extract the archive
3. download Handbrake CLI for your platform from http://handbrake.fr/downloads2.php
4. extract/install Hanbrake CLI to the appropriate folder in hb.rb-installation-folder under tools/handbrake (e.g. HandbrakeCLI.exe to tools/handbrake/windows)
5. repeat step 4 for AtomicParsley and/or Subler if you want to tag your files with tag_epsiodes.rb
6. if you want to work with presets in plist-files you have to install this gem
gem install plist
7. if you want to use tag_episodes.rb you have to install some gems with following commands
gem install hpricot
gem install imdb
8. if you use a ruby-version < 1.9.0 you'll get an error-message when loading imdb - in that case simply open series.rb (path is in stacktrace) and add a \ at the end of line 18
run
===
Now you should be able to run hb.rb.
Maybe directly via ./hb.rb or via path_to_ruby/ruby.exe hb.rb
To get a list of possible options and example-calls run hb.rb without any arguments or with --help.
For any questions about hb.rb use also this thread https://forum.handbrake.fr/viewtopic.php?f=10&t=26163
tag and or rename converted files
=================================
If your ripped files are orderd e.g. for According to Jim Season 1
ATJ_S1D1T2.m4v (season 1, disc 1, title 2)
ATJ_S1D1T3.m4v (season 1, disc 1, title 3)
...
you can run
./tag_episode.rb --id Accordingtojim --season 1 --episode 1 --tag --rename ATJ_S1*.m4v
So the first file will have the name and tags for episode 1, the second file for episode 2 and so on.
useful commands
===============
restart
OSX : osascript -e 'tell application "System Events" to restart'
windows: shutdown -r -t 0
sleep
OSX : osascript -e 'tell application "System Events" to sleep'
showdown
OSX : osascript -e 'tell application "System Events" to shut down'
windows: shutdown -s -t 0
logoff
OSX : osascript -e 'tell application "System Events" to log out'
windows: shutdown -l -t 0
eject disc
OSX : drutil tray eject
To enable qsv on windows have a look at this thread: viewtopic.php?f=11&t=29498
For encrypted dvd support download the dll according to your handbrake version from here: http://download.videolan.org/pub/videol ... ss/1.2.11/
To directly convert blurays you should have a look at this thread viewtopic.php?f=10&t=30432
viewtopic.php?f=11&t=31197