How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
splodgecat
Posts: 9
Joined: Fri Sep 25, 2009 6:58 am

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by splodgecat » Thu Oct 29, 2009 8:58 pm

Thanks once again for your help. I think I value the automation more than the ability to do mkv, it was just an experiment so I can easily go back to m4v. No idea what else the problem was in there but I'll ditch the whole thing - I'm punching slightly above my weight delving into these custom settings. It's just that before I start doing my DVD library I want to get the settings right, I don't want to change my mind and go back to encode something again. Would you be willing to share some of your settings for DVDs for different purposes etc?

User avatar
Rodeo
HandBrake Team
Posts: 12249
Joined: Tue Mar 03, 2009 8:55 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by Rodeo » Thu Oct 29, 2009 10:31 pm

splodgecat wrote:Any idea why the script is producing this error?

Code: Select all

Using Custom/DVD-toolArgs: -f mkv -m -e x264 -q 0.600000023841858 -a 1 -E ac3 -B 160 -R Auto -6 auto -p -x ref=3:mixed-refs:bframes=3:b-pyramid:weightb:filter=-2,-1:trellis=1:analyse=all 8x8dct:me=umh:subme=9:psy-rd=1,1 -s 1 2 -F -U
You do realize that your x264 options are split in 2?

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Fri Oct 30, 2009 4:45 pm

Hello,

First off, awesome post! This tutorial walked through every step and worked perfectly right from the start. The first disk I tried ended up showing bad sectors in FairMount, and the tutorial gave clear warning that this might happen with some discs and gave a possible alternative solution.

So, now I've started the long, slow (but now semi-automated) process of backing up my entire DVD library, and I noticed one thing on the first successful transfer. Once the m4v is transferred into iTunes, it does not show the movie's Rating (PG, PG-13, etc). I don't see anywhere in the iTunes GUI that allows me to set the Rating, which is understandable, actually. I'm wondering if there's a way to tweak the workflow that loads the metadata to add the Rating tag?

Thanks!

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Fri Oct 30, 2009 7:00 pm

th3_m45t3r wrote:I'm wondering if there's a way to tweak the workflow that loads the metadata to add the Rating tag?
Hi th3_m45t3r,

I'm glad it's working for you.

MPAA ratings are not available from themoviedb.org at this time. I believe this is something they are currently working on, but may take a while before the database is populated. I will definitely add it once it's available. In the meantime you can probably manually set it after you've encoded the file with MetaX or another tool, maybe Subler does it too, but I don't remember.

Thanks, mac.jedi

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Sat Oct 31, 2009 8:37 pm

splodgecat wrote:Would you be willing to share some of your settings for DVDs for different purposes etc?
Hi splodgecat,

My settings are pretty basic. I don't really put this stuff on my iPhone or iPod any more, so the only two devices I need to encode for are the Apple TV and Mac Mini. For DVDs, I use a modified Apple TV preset. When I was really cereal, I used --two-pass and --turbo for two pass encoding. Made beautiful encodes, but I don't feel the need anymore since I figure I'll be replacing it with Blu-ray or another HD source later down the road.

For DVD w/ AC-3:

Code: Select all

-e x264  -q 20.0 -a 1,1 -E ca_aac,ac3 -B 160,160 -6 dpl2,auto -R 48,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic --decomb --detelecine -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0


For DVD w/ DTS:

Code: Select all

-e x264  -q 20.0 -a 1 -E ca_aac -B 320 -6 dpl2 -R 48 -D 0.0 -f mp4 -4 -X 960 --loose-anamorphic --decomb --detelecine -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0


Good luck!
mac.jedi
Last edited by mac.jedi on Sat Oct 31, 2009 11:02 pm, edited 1 time in total.

User avatar
Rodeo
HandBrake Team
Posts: 12249
Joined: Tue Mar 03, 2009 8:55 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by Rodeo » Sat Oct 31, 2009 9:58 pm

mac.jedi wrote:For DVD w/ AC-3:

Code: Select all

-e x264  -q 20.0 -a 1,1 -E ca_acc,ac3 -B 160,160 -6 dpl2,auto -R 48,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic --decomb --detelecine -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0


For DVD w/ DTS:

Code: Select all

-e x264  -q 20.0 -a 1 -E ca_acc -B 320 -6 dpl2 -R 48 -D 0.0 -f mp4 -4 -X 960 --loose-anamorphic --decomb --detelecine -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0
The audio encoder should be ca_aac, not ca_acc :-)

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Sat Oct 31, 2009 11:01 pm

Rodeo wrote:The audio encoder should be ca_aac, not ca_acc :-)
Nice catch Rodeo! I have a habit of mistyping that. Thx!

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Mon Nov 02, 2009 1:21 am

Hello,

Thanks for the suggestion to load MetaX. That seems to work well. It "integrates" with iTunes, so that's nice. As I make my way through my library, I'm coming upon some DVDs that include both the widescreen and the fullscreen versions of a given movie. The Batch Encode process does a nice job and recognizes the two tracks; however, I really only want the widescreen one. So, I'm looking for a way to filter out the fullscreen track, or to have the secondary tracks named with an index of some sort. The current Batch Encode process only uses the name of the DVD's folder, so both tracks end up with the same name, which leaves me with an encoded copy of only the last track in the process. In some cases, the widescreen track is second, but there's no guarantee on that. Any thoughts?

On a slightly different topic, how do you create the .action files for Automator? Is there any way for me to edit those, or would you be willing to package up the source code? I've done some AppleScript work that interacted heavily with the Terminal, but I've never taken things as far as building an Automator action/workflow. So far, with your tutorial, I've only been able to execute the final product, but I'd love to get down to the internals and see what's really going on.

Thanks!

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Tue Nov 03, 2009 2:35 am

Hello,

I found the source code - or at least what I believe is the source code. I'm still a newbie with XCode and Mac-packaged code. I didn't realize that the source code is included in the .action packages. (I come from Microsoft .NET world nowadays, but my deepest roots are C++ and Java.) So, I'll take a closer look at the source and see what's going on, but I wanted to ask one question. When I run the Batch Encode, it displays the settings it's going to use. I'm noticing audio encoder settings as follows: -E ca_acc,ac3. I've not been able to find "ca_acc" anywhere in the HandBrake online documentation, which only mentions faac, lame, vorbis, and ac3. When I look at your source code, in the lines that set the HandBrake settings, I see both "ca_aac" and "ca_acc" (and I'm a bit confused at that point). Can you provide some insight into ca_aac (or should it be ca_acc, or are both valid)? The BatchEncode service doesn't kick back with any error messages, and the encoded files seem fine, but I'm still curious. I've downloaded HandBrake svn2907.

By the way, I can't praise your tutorial and resource files enough - they're very well done and got me going in no time.

Thanks

raquor
Posts: 1
Joined: Wed Nov 04, 2009 12:38 am

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by raquor » Wed Nov 04, 2009 12:46 am

First thanks for this fantastic tutorial. I've had my mac for about a month so I'm still learning the ins and outs but I managed to get this working great with one tiny exception. I have a mac mini and set the batch rip to auto eject on completion. This morning I popped in a DVD and left for work and when I got home it'd ripped the DVD to the HDD about 12 times. It seems that the mini at least sucks the disc back in after some time has passed without the disc being removed.

Is there a way to prevent the mac from sucking the disc back in?
Alternatively, is there a way to tweak the script so that it checks for the existence of a folder with the name it wants to create before it starts ripping the disc?

Thanks-
Raquor

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Sat Nov 07, 2009 5:35 pm

th3_m45t3r wrote:I'm coming upon some DVDs that include both the widescreen and the fullscreen versions of a given movie. I'm looking for a way to filter out the fullscreen track, or to have the secondary tracks named with an index of some sort.
Hi th3_m45t3r,

There isn't any way to do filter these in the action now, but I'll take a look to see what I can do to filter these out in the future. In the mean time, your best best is to do these ones manually with the GUI or if you know the title number, create a custom DVD setting in the Action and set the -t <titleNum> flag.
th3_m45t3r wrote:How do you create the .action files for Automator?
The Apple Developer site has some great info on this, as well as macosxautomation.com and automator.us. For the apple dev site all you need is to do is to sign up with your Apple/iTunes ID and you'll get loads of content as well as the newest version of xcode.
th3_m45t3r wrote:I'm noticing audio encoder settings as follows: -E ca_acc,ac3. I've not been able to find "ca_acc" anywhere in the HandBrake online documentation, which only mentions faac, lame, vorbis, and ac3.
ca_aac is fairly new to HandBrake. It's only in the snapshots and repository at this point, which is why the command line wiki has not yet been updated with the info. There may be additional info on ca_aac in the release notes for the current snapshot.

ca_aac basically uses Core Audio instead of faac. It allows for higher bit rates, which is great for down converting DTS and adding secondary stereo tracks with 320 bit audio. The "ca_acc" vs "ca_aac" was a typo. My fingers somehow like to confuse aac and acc. I'll fix it in the next release. The reason it doesn't fail is that HandBrake is smart enough to realize my mistake and automatically fall back to faac. As you can see, I've typed aac many times in this post, and will continue to do so till I get it right … aac, aac, aac, aac, aac, aac, aac, aac, aac, aac, aac, aac … :roll:

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Sat Nov 07, 2009 6:10 pm

raquor wrote:I have a mac mini and set the batch rip to auto eject on completion. This morning I popped in a DVD and left for work and when I got home it'd ripped the DVD to the HDD about 12 times. It seems that the mini at least sucks the disc back in after some time has passed without the disc being removed. Is there a way to prevent the mac from sucking the disc back in?

Hi raquor,

Thanks for your post! I'm sorry it copied so many times. Did you have "Run Automatically" set in the action? I'd suggest turning it off. The Folder Action dialog box will ignore the disc after 30 seconds if a video kind is not selected. This will provide a safety net to assure the disc doesn't automatically copy again when the mac sucks it back in.
raquor wrote: Alternatively, is there a way to tweak the script so that it checks for the existence of a folder with the name it wants to create before it starts ripping the disc?
The last version of the Action did exactly that, if a folder existed in the output folder with the same name as the newly inserted disc, it skipped it. After the inital release, another user reminded me about the days when the discs were all named the same… SONY, DVD_VIDEO, TV_SHOW_SEASON_1 (with no disc number), etc. At the time, it seemed appropriate that I revise the script and allow the Action to simply rename the new copy … as opposed to having to manually rename, or move the existing copy, before copying the next disc. This was how I had originally set it up for myself.

Anyway, turning the "Run Automatically" off, should help solve your problem and prevent the disc from recopying. You can also turn off the eject when done option, if you plan on copying a disc before leaving. Then, turn them back on when you want to copy a bunch of discs one after another.

I hope this helps!

Thanks again, mac.jedi

MyMonyPit
Posts: 2
Joined: Wed Nov 11, 2009 2:40 am

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by MyMonyPit » Wed Nov 11, 2009 2:48 am

First off, let me say thank you for the automation! I haven't gotten it all working yet and could use some help. The Batch Rip is working fine and I have the Rename Movie Items service working also. I'm unable to figure out my issue with the Batch Encode. I'm using defaults and here's what I get when it tries to run:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROCESSING: The Taking of Pelham 123 (2009)

*Scanning Folder: 'The Taking of Pelham 123 (2009)'
Will encode the following tracks: 1


*Creating The Taking of Pelham 123 (2009).m4v
Using AC3/DVD-toolArgs: -e x264 -q 20.0 -a 1,1 -E ca_acc,ac3 -B 160,160 -6 dpl2,auto -R 48,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0


Script could not complete because The Taking of Pelham 123 (2009).m4v does NOT exist
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

PROCESSING COMPLETE: The Taking of Pelham 123 (2009)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Any ideas?

Thanks!

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Wed Nov 11, 2009 5:38 am

ANNOUNCEMENT: BATCH RIP ACTIONS UPDATED


Update 2009-11-10

Release Notes
Batch Rip Actions for Automator

1.0.3

In Apple speak, v1.0.3 provides general fixes that enhance the stability, compatibility and functionality
of Batch Rip Actions for Automator and is recommended for all users.
  • Added workflows to install package. Now installs Services to ~/Library/Services, and Folder Actions to ~/Library/Workflows/Applications/Folder Actions
  • Shared components are now installed in /usr/local/bin
  • Fixes an issue that might cause tagging actions to stall when adding cover art
  • Includes general reliability and speed improvements for Add TV Tags, Add Movie Tags, Add Movie Poster, Batch Encode and Batch Rip
Enjoy!
Last edited by mac.jedi on Wed Nov 11, 2009 3:04 pm, edited 2 times in total.

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Wed Nov 11, 2009 5:57 am

MyMonyPit wrote:I'm unable to figure out my issue with the Batch Encode. I'm using defaults and here's what I get when it tries to run: Script could not complete because The Taking of Pelham 123 (2009).m4v does NOT exist
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hi MyMonyPit,

Thanks for posting!

Sorry you ran into trouble. The most common causes related to this issue, is when trying to use HandBrakeCLI v0.9.3 which is not compatible with the actions or using the HandBrakeCLI 64-bit version on a core solo mac.

Make sure you have the latest version of HandBrakeCLI installed … the latest snapshot is located here: http://handbrake.fr/snapshot.php. Also make sure you select the correct cpu type: 32-Bit or 64-Bit depending on your system.

Once you've verified your configuration, please post the full scan data of the failed source so I can see if HandBrake is reporting any issues. You can use the code below in Terminal to get the scan data, just replace the path to HandBrakeCLI and the input path (after "-i ") to the path to the VIDEO_TS folder. You can also drag your VIDEO_TS folder to the Terminal to insert the path.

Code: Select all

/Applications/HandBrakeCLI -i "/Path/to/The Taking of Pelham 123 (2009)/VIDEO_TS" -t0
Also, there is a new version of the actions if you want to give them a try as well.

Thanks again for your post. Let me know how it goes.

mac.jedi

oo_void
Posts: 3
Joined: Wed Nov 11, 2009 8:05 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by oo_void » Wed Nov 11, 2009 8:19 pm

Thanks for all your hard work here... well executed and extremely well documented. Took me a little bit longer than I'd thought to get up and running but that was due to you uploading the new version mid-stream configuring everything.

If you plan on refining the process any further, I have two enhancement requests for you. The first being the ability to define additional rip folders, each with their own encode setting. The use case here being that I'd like to use different custom encoding parameters for animated content, or possibly black and white sources.

The second request is a little more basic (and it may be implemented or addressed already). This would be to limit multiple instances of the encode tasks from running at the same time. The use case for this one being that someone has a scheduled job configured that doesn't complete within the 24 hour window. I had a case in which I had started an encode manually last evening, but then the scheduled job started later on during the night resulting in both processes attempted to encode the same file set.

Once again, thanks for your work here.

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Thu Nov 12, 2009 5:30 am

oo_void wrote:The first being the ability to define additional rip folders, each with their own encode setting. The use case here being that I'd like to use different custom encoding parameters for animated content, or possibly black and white sources.
Hi oo_void!

Thanks for the feedback! It should be possible to define addition rip folders and encode settings by saving additional Service workflows. Each workflow should save it's parameters in it's own plist file. One caveat is that they might not be able to run at the same time as some of the parameters are set in the Action during runtime.
oo_void wrote:The second request is a little more basic (and it may be implemented or addressed already). This would be to limit multiple instances of the encode tasks from running at the same time.
I'm not sure limiting multiple instances would be a feature. I've got an 8-core Mac Pro and I like to set up two iCal alarms, each targeting its own batch rip folder. They both start encoding at midnight and max out all processors, which results in more efficient use of the computing time. I'll have to think more on this one, in the meantime you might want to delete the iCal alarm for the day you are manually encoding. That's what I usually do if I decide to start encoding in the evening.

Thanks again for posting,

mac.jedi

MyMonyPit
Posts: 2
Joined: Wed Nov 11, 2009 2:40 am

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by MyMonyPit » Sat Nov 14, 2009 2:41 am

mac.jedi wrote:
MyMonyPit wrote:I'm unable to figure out my issue with the Batch Encode. I'm using defaults and here's what I get when it tries to run: Script could not complete because The Taking of Pelham 123 (2009).m4v does NOT exist
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Make sure you have the latest version of HandBrakeCLI installed … the latest snapshot is located here: http://handbrake.fr/snapshot.php. Also make sure you select the correct cpu type: 32-Bit or 64-Bit depending on your system.

mac.jedi
Thanks mac.jedi!

It appears I was using an older version. I thought I had all the current versions. Got the encode working so maybe I'll keep movin' on this weekend.

Thanks again!!

jkbuster
Posts: 12
Joined: Fri Mar 21, 2008 8:26 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by jkbuster » Wed Nov 18, 2009 12:14 am

Thanks for an awesome how-to!!

Have you considered making a nice pdf version for downloading and printing?

JKB

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Wed Nov 18, 2009 12:27 am

Hello,

I've made some minor tweaks to the source code found in the copy of the actions I have here. I thought it would be only fair that I post them here for your review and offer them for your inclusion in an update if you see fit.

First, while transferring several dozen DVDs, I found that most of my manual time was taken up by changing any "_" characters to spaces in the folder name after the files are copied from the disc. While older DVDs have generic names like DVDVideo and would have to be renamed manually, newer ones have some variation of the actual movie title with underscores to separate the words. When the name is submitted to themoviedb.org, it only works with titles that have spaces, so I made the following change in batchRip.sh (found inside the package of the Batch Rip Automator action). The file I have here indicates version 1.01 with a latest change log entry of 7.20091023.0.

batchRip.sh original Line 192:

Code: Select all

discName=`diskutil info "$1" | grep "Volume Name:" | sed 's|.*: *||'`
batchRip.sh new Line 192:

Code: Select all

discName=`diskutil info "$1" | grep "Volume Name:" | sed 's|.*: *||' | sed -e 's,_,\ ,g'`
This change simply pipes the name of the disc to an additional sed command to replace all "_" characters with spaces. I'm still a bit new with the shell commands, so I'm not sure if the two sed commands could be combined or not. This modification makes things a wee bit faster when it comes to submitting the folders to the Batch Rename action.

I made that change before I came upon several DVDs that would not cooperate with the Fairmount program. As an alternative, I've installed AnyDVD and run that in a VMWare instance of XP. That process, however, skips the folder-rename step from the Batch Rip action, so I went a little deeper and found another place to include some character replacement code. This time, I've updated the main.command file found in the package of the Rename Movie Items action (same version release as above). This change requires a few more lines of code, though:

main.command original lines (starting at line 25):

Code: Select all

set theFile to "$1"
tell application "Automator Runner" 
activate
display dialog "What is the movie title?" default answer theFile buttons {"Cancel", "OK"} default button 2
main.command new Lines (starting at line 25):

Code: Select all

set theFile to "$1"
set d to text item delimiters
set text item delimiters to "_"
set t to theFile's text items
set text item delimiters to " "
tell t to set t to item 1 & ({""} & rest)
set text item delimiters to d
set noSpaceFileName to t
tell application "Automator Runner" 
activate
display dialog "What is the movie title?" default answer noSpaceFileName buttons {"Cancel", "OK"} default button 2
This change uses an AppleScript method to replace the "_" characters with spaces, and this will work regardless of the folder name (with or without "_" characters).

All other code in these two files is untouched, and I simply saved the changes and ran the corresponding workflows.

While we're on the topic of code changes, I took a closer look at the encoding settings for AC3/DVD, and I decided on some slightly different options. You mentioned before that you used to use 2-pass but decided against it since your material would most likely be replaced with HD of some sort. I'm in the opposite situation: my sources will most likely NOT be replaced with HD (though I reserve the right to acquire HD sources in future purchases, of course). The following are the settings that I've chosen to use:

"-e x264 -2 -T -b 1500 -a ${audioTrack},${audioTrack} -E faac,ac3 -B 192,160 -6 dpl2,auto -R 48,Auto -D 0.0,0.0 -f mp4 -4 -X 960 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:b-adapt=2:weightb=0:trellis=0"

The ABR of 1500, using 2-pass, seems to provide a very good balance between visual quality and file size. I boosted the AAC bit rate to 192 to give it just a little bit more room, and you'll notice I've chosen to stick with faac as the audio encoder. Basically all of the DVDs I encoded using the ca_aac encoder (in SVN2907) ended up with an audible "scratch" within the first second of the final output. I have not yet taken the time to investigate this situation in detail, but I plan to submit a full bug report with as much information as I can gather based on my limited knowledge of the HandBrake project.

After all of that, I wonder if you've had any experience with increasing the bit rate for the AC3 pass-through track? If so, do you believe that 192 would produce a noticeable increase in quality, or perhaps avoid possible clipping/"mashing" of highly active audio tracks (like movies with lots of cool explosions)? My primary target is an AppleTV device.

Thanks for you time, and keep up the awesome work!

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Wed Nov 18, 2009 12:38 am

jkbuster wrote:Thanks for an awesome how-to!!

Have you considered making a nice pdf version for downloading and printing?

JKB
Hi Jkbuster,
Thanks for posting! There's a PDF in the Batch Rip Actions Installer for offline viewing.

Thanks again, mac.jedi

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Wed Nov 18, 2009 4:25 pm

th3_m45t3r wrote:I've updated the main.command file found in the package of the Rename Movie Items action (same version release as above). This change requires a few more lines of code, though:
main.command new Lines (starting at line 25):

Code: Select all

set theFile to "$1"
set d to text item delimiters
set text item delimiters to "_"
set t to theFile's text items
set text item delimiters to " "
tell t to set t to item 1 & ({""} & rest)
set text item delimiters to d
set noSpaceFileName to t
tell application "Automator Runner" 
activate
display dialog "What is the movie title?" default answer noSpaceFileName buttons {"Cancel", "OK"} default button 2
Hi h3_m45t3r!

Thanks for posting your changes! An even simpler way to do this would be to add the "tr" command to the variable on line 85 in the Rename Movie Items' main.command file. This will send the item name without underscores to the AppleScript subroutines.

Code: Select all

fileName=`basename "$theFile" | tr '_' ' '`
I had thought of doing this before, but never got around to it. I'll make sure to include underscore replacement in the next release of the Rename Movie Items Action.

EDIT: To make it work for files as well you'll have to add a file extension variable before line 85 and change the fileName variable too, to remove the file extension:

Code: Select all

	fileExt=`basename "$theFile" | sed 's|.*\.||'`
	fileName=`basename "$theFile" .$fileExt | tr '_' ' '`
th3_m45t3r wrote:I wonder if you've had any experience with increasing the bit rate for the AC3 pass-through track?!
I've never increased the bit rate for passthru. I usually leave it set to auto. I could be wrong, but I think passthru leaves the bit rate the same as the original. So if it's 192 to begin with, it should still be 192 after the encode.

I do however up the audio bit rate for DTS down to aac. With ca_aac you can go up to 320 which definitely sounds better, cleaner and more dynamic. However, my sources for this are Blu-Ray which have higher bit rates than DVD.

As for the video, I prefer a constant quality setting (-q) around 20.0. I think you get better results using constant quality instead of a constant bit rate. You can go as low as 21.0 or as high as 19.0, somewhere around there should get you results which are pretty close to the source quality. Keep in mind this is only my opinion, there are tons of posts on this forum that debate this.

I hope this helps and thanks again for your work!

mac.jedi

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Fri Nov 20, 2009 5:51 am

I forgot to mention a modification I made to the batchEncode.sh file. In a previous post, I had asked about working around discs that have more than one track that meets the length requirements (all of them would be encoded with the same file name, so I'd end up with just the last track). With an additional "if" block, I check the trackCount to determine if the track number should be appended to the file name.

batchEncode.sh Original Line 778:

Code: Select all

encodeFile "$sourceFile" "${discName}.m4v" "DVD"
batchEncode.sh New Lines (starting at 778):

Code: Select all

if [ $trackCount -gt 1 ] ; then
  encodeFile "$sourceFile" "${discName}-${aTrack}.m4v" "DVD"
else
  encodeFile "$sourceFile" "${discName}.m4v" "DVD"
fi
All other lines are unchanged. By using an "if" block there, I get non-appended file names for DVDs with only 1 valid track (regardless of the track number), and I get track-number-appended file names for DVDs that have >1 valid tracks.

There are any number of reasons a DVD might have multiple valid tracks, but the one I've seen the most is the inclusion of both widescreen and "standard" format on the same disc. There's no rhyme or reason applied to deciding which track is the widescreen and which is the "standard," so the automated process just encodes them both. We could probably check the dimensions of the track before encoding, but I've also seen some very invalid tracks that happen to meet the length and aspect ratio requirements. And with an 8-core Mac Pro, encoding an extra track takes only a few minutes. (I'm usually sleeping while it's encoding, too, so I don't even notice the "delay.")

Thanks for your time and effort on this. I look forward to a future update to see what else you might include!

mac.jedi
Regular User
Posts: 108
Joined: Thu Apr 24, 2008 11:17 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by mac.jedi » Fri Nov 20, 2009 5:53 pm

th3_m45t3r wrote:In a previous post, I had asked about working around discs that have more than one track that meets the length requirements (all of them would be encoded with the same file name, so I'd end up with just the last track).
Hi th3_m45t3r,

For movies, there is already code that selects only the longest title (between the min/max duration). TV shows will encode every title (between the min/max duration). Have you experienced a situation where Batch Encode has tried to encode more than one title when the video kind of the source was set to "Movie"?

I've never had it encode more than one track unless the video kind was set to TV Show. Let me know.

Thanks, mac.jedi

th3_m45t3r
Posts: 8
Joined: Fri Oct 30, 2009 4:31 pm

Re: How-To: Automate DVD & Blu-Ray (Backup, Encoding & Tagging)

Post by th3_m45t3r » Fri Nov 20, 2009 8:09 pm

Hello,
mac.jedi wrote:For movies, there is already code that selects only the longest title (between the min/max duration).
While I don't doubt that the code is in there, as I'm sure you've come across several of these cases, I've never experienced a situation where the batch encode only does a single track when multiple are present. Perhaps I've missed a setting somewhere in the workflow? I've only been doing movies, as I haven't started on the TV show collection yet.

Even if the process were to only encode the longest track, I've seen a few cases where the longest track actually isn't the right one. One in particular that I can think of just now is Finding Nemo. The special edition DVD includes tons of extras, and for some reason, one of the tracks is interpreted as over 2 hours long (longer than the movie). Interestingly, the encoded version of that track has movie clips interspersed with storyboards and other special features clips (that clearly don't belong), and the audio is completely wrong.

I'm betting that there's something set up on the Finding Nemo DVD that's causing some confusion, as I've seen no other DVDs with this invalid track configuration. Most of the other DVDs either include widescreen/standard or original/extended editions. In the case of the extended editions, encoding only the longest track does apply, but in the case of widescreen/standard it would not (since the tracks would/should be the same length). Of course, the vast majority of the DVDs include only a single long track, so this is only a "once in a while" concern.

I'm not at my primary machine at the moment, but if you'd like to see some logs or the terminal output, I would be happy to post them when I can get to them.

th3_m45t3r

Post Reply