I just ran into another issue that reinforces why I like having my own tools. As I may have said before (I'm lucky I can remember yesterday), my main goal in processing DVDs and Blu-rays for transcoding is to preserve all the information gleaned from analyzing them to determine what needs to be done. Then, years later, if I need/want to retranscode them, it's all recorded.
To facilitate this, years ago a wrote a scripting language specifically tailored to manipulating and processing audio/video files. It divides the processing in to two time phases, now and later. Steps to be done immediately are in the now category. Steps to be done later generate queue entries for my GUI tool I've explained above. Stuff designated "later" are things that either take a long time, like transcoding, or must happen after transcoding.
The scripting engine handles all the laborious steps involved in creating the resultant media files that go on my NAS. A common example is when the commentary tracks on the disc are put into a separate title from the normal audio. Keeping both titles is a waste of time and space, as the only difference is the audio tracks. I use to have to extract both titles from the disc, extract the commentary audio from the one, and mux it into the other (imagine doing an entire TV series of this!). With my tool, I simply give it both titles: "1+2", and it know what to do.
Another example is deleted scenes. Often, they are in separate titles, but I like them all combined. As above, I simply give it all the title: "1-5+7" (that is, titles 1 through 5, plus 7), and tell it to concatenate instead of merge. I can also tell it to concatenate
after transcoding (which has the advantage of not have to pre-extract them all).
Anyway, the problem I ran into now was a foreign movie where the foreign language audio was labeled as English. Not a big deal, but I'm anal and little things bother me.
So, in my script for the movie, I have:
Code:
# Audio track is Japanese but is labeled as English. need to extract title and fix it.
dst1 := "{@sandbox}\{@line}\t4"
extract:"{src}",4,"{dst1}.mkv",title-type(dvd)
mkvmerge:"{dst1}.mkv","{dst1}.remux.mkv",now,track-info(1,2,,,jpn)
"{dst1}.remux.mkv",1,"{dst_dir}\{title} ({title_yr}).mkv",dvd,chg-subtitle(1,1,0,1),crop(68,68,2,2),audio-lang(jpn)
Each line of this snippet does thusly:
1. Set the variable "dst1" to a path on the previously defined sandbox folder. This is used in the other commands to indicate where to place their files. "{@line}" resolves to the current line number, guaranteeing the path is unique relative to the script.
2. Extract title 4 from the DVD (the movie). The extract command can use various tool to extract titles from DVDs and Blu-rays (MakeMKV, mkvmerge, ffmpeg, etc.). The default tool is MakeMKV. "title-type" tells it that "4" is the DVD title number. The default is whatever numbering system the tool uses. By telling it to use the DVD title number, I don't have to open MakeMKV and figure out what its title number for the movie is. My tool will create a mapping between the two.
3. Calls mkvmerge to change the language of the 2nd track of the 1st file to "jpn". All numbers in the script are 1-based to make it easier, even if the tool uses 0-based (which mkvmerge does). "now" indicates to run mkvmerge now instead of adding a task to the transcoder queue.
4. This creates an entry in the trancoder queue to transcode the file using HandBrake (if no tool is specified, it defaults to HandBrake). The options tell handbrake to: use the predefined DVD profile, burn-in the first subtitle track, crop the video, and select audio tracks of the given language (by default, it would have selected English tracks, of which there are none).
A more common issue I run into is tracks where the language is "undefined" (und). Since this happens a lot, I have shortcut options for the HandBrake command to fix them. For example, "undefined-audio(LANG)" will tell HandBrake to select the "und" audio track(s), and will add an entry to the transcoder queue to remux the file after transcoding, changing all audio tracks defined as "und" to LANG.
This scripting method has worked out so well, I have what I call my "oh, sh*t!" backup. It is simply the scripts for all my discs and the source code for my tools, on a thumb drive. If my NAS ever dies and its backups fail (unlikely, but possible), I can recreate everything with the scripts and my disc backups (or the discs, themselves, if those backups also fail).
DrX