Windows - One Button DVD/BluRay Ripping using a Launcher from within XBMC

  Thread Rating:
  • 9 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jayzirl Offline
Junior Member
Posts: 45
Joined: Jan 2012
Reputation: 0
Post: #166
Hi Spinalcrack, Well done on the excellent script!

I might get you to have a look my code if possible, It running fine when i run the launcher... it rips the dvd i put in and after it rips it to the assigned folder it ejects the dvd from the drive but does not seem to go on to run handbrake to compress the ripped file at all? - The other night to try it out i put in ghostbusters 2... it ripped the main movie to 3.5GB but that was all.

I am using XP (32 bit version)

Thanks for any help with this one!

Code:
@Echo offSetlocal enableextensions
::******************************************************************************​***************
::*** AutoRipDVD is brought to you by Spinalcracker
::******************************************************************************​***************
::
::******************************************************************************​***************
::***  Change the following variables to match your setup
::******************************************************************************​***************
::
::*** DriveLetter=The drive letter of your DVD or Blu-Ray drive ie. D: or G: etc
::
::------------------------------
Set DriveLetter=D:
::------------------------------
::
::*** RipDir=Where you want your DVD ripped to ie. your xbmc movie folder *BE SURE TO INCLUDE TRAILING \
::
::------------------------------
Set RipDir=C:\Documents and Settings\user1\My Documents\My Videos\
::------------------------------
::
::*** IntDir=Where you installed MakeMKV to
::
::----------------------------------------
Set IntDir=C:\Program Files\MakeMKV\
::----------------------------------------
::
::*** ScriptPath=Where the files for this script are located with trailing "\" ie. Where AutoRipComplete.vbs & Beep.vbs are located *BE SURE TO INCLUDE TRAILING \
::
::------------------------------------
Set ScriptPath=C:\Program Files (x86)\AutoRipDVD\
::------------------------------------
::
::*** RipMinSeconds=Minimum time in seconds that should be ripped off disk to avoid getting previews etc.  Default is 3600 seconds or 1 hour
::
::---------------------
Set RipMinSeconds=3600
::---------------------
::
::*** Using Handbrake to compress - Yes or No?
::
::------------------------------------
Set Handbrake=yes
::------------------------------------
::
::*** Sets the install path to handbrake
::
::------------------------------------
Set Handbrakepath=C:\Program Files\Handbrake
::------------------------------------
::
::*** Sets the level of compression in Handbrake so unless you really know what you are doing, do NOT adjust this next setting!
::
::------------------------------------
Set X264=b-adapt=2:rc-lookahead=50:me=umh:bframes=5:ref=6:direct=auto:trellis=2:subq=10:psy-rd=1.0,0.10:analyse=all
::------------------------------------
::
::*** Sets the format of the new compressed file, so again, unless you know what you are doing, please leave it as mkv!
::
::------------------------------------
Set FORMAT=--optimize --format mkv
::------------------------------------
::
::*** Sets the quality to something visually appealing but in a small files size - play with this if your outcome isn't to your liking
::
::------------------------------------
Set QUALITY=--ab 160 --mixdown stereo --quality 23 -e x264 -x %X264%
::------------------------------------
::
::*** Sets the output to 720p resolution - change if you prefer something else
::
::------------------------------------
Set SIZE=--width 1280 --height 720
::------------------------------------
::
::******************************************************************************​***************
::******************************************************************************​***************
::******* DO NOT EDIT ANYTHING BELOW THIS!!!!!!************************************************
::******************************************************************************​***************
::******************************************************************************​***************



::For /f %%# In ('Mountvol^|Findstr [d-z]:\\') Do (
::        Fsutil fsinfo drivetype %%#|Find "CD-ROM">Nul&&(Set "CDROM=%%~d#"))
::If Not Defined CDROM call :NoDrive


for /f "tokens=1-5*" %%1 in ('vol %DriveLetter%') do (
    set volid=%%6 & goto processcontd
)

:processcontd
set nospace=%volid%
echo [%nospace%]
echo.
for /f "tokens=* delims= " %%A in ('echo %nospace% ') do set nospace=%%A
set nospace=%nospace:~0,-1%
echo [%nospace%]
set volid=%nospace%
echo: %volid%

set str=%volid%
echo.%str%
set str=%str:_= %
echo.%str%
set volid=%str%
If "%volid%"=="_= " call :NoDrive

Echo:Ripping %volid% now...

mkdir "%RipDir%%volid%"

cd /d "%ScriptPath%"
OSDAutoRip.hta

cd /d "%IntDir%"
makemkvcon.exe --minlength=%RipMinSeconds% mkv disc:0 all "%RipDir%%volid%"

SET _tmpPath="%RipDir%%volid%"
cd /d %_tmpPath%
for %%i in ("title*.mkv") do (set fname=%%i) & call :rename

If %Handbrake%==Yes call :HBEncode

cd /d "%ScriptPath%"
AutoRipComplete.vbs
cscript Beep.vbs
exit

:NoDrive
cd /d "%ScriptPath%"
cscript Beep.vbs
NoDiskDrive.hta
AutoRipComplete.vbs
exit

:HBEncode
cd /d "%Handbrakepath%"
HandBrakeCLI -v0 -i "%RipDir%%volid%" -o "%RipDir%%volid%\%volid% 720p.mkv" %FORMAT% %QUALITY% %SIZE%
cd /d %_tmpPath%
del "%volid%_*.mkv"

:rename
::Cuts off 1st 5 characters of fname, then appends prefix
ren %fname% "%volid%"_%fname:~5%
[/php]
find quote
akevit Offline
Donor
Posts: 127
Joined: May 2011
Reputation: 2
Location: Seattle
Post: #167
(2012-11-06 23:45)jayzirl Wrote:  Hi Spinalcrack, Well done on the excellent script!

I might get you to have a look my code if possible, It running fine when i run the launcher... it rips the dvd i put in and after it rips it to the assigned folder it ejects the dvd from the drive but does not seem to go on to run handbrake to compress the ripped file at all? - The other night to try it out i put in ghostbusters 2... it ripped the main movie to 3.5GB but that was all.

I am using XP (32 bit version)

Thanks for any help with this one!

Code
  • Is your RipDir set properly? Does the path contain user1 or did you just edit it out for posting?
  • Your ScriptPath setting is likely incorrect, Windows XP shouldn't have have a Program Files (x86)

ATV2 running XBMC Eden (Skin: Quartz3)
Windows 7 running XBMC Eden (custom setup as I'm basically running it as a service)
MySQL installed on Windows 7 for sharing libraries
iOS Specific FAQ | Alternative ATV2 keymap | Default ATV2 keymap
Post log files to Pastebin

[Image: 1721571156.png]
find quote
Spinalcrack Offline
Senior Member
Posts: 128
Joined: Jul 2011
Reputation: 10
Post: #168
(2012-11-06 23:45)jayzirl Wrote:  Hi Spinalcrack, Well done on the excellent script!

I might get you to have a look my code if possible, It running fine when i run the launcher... it rips the dvd i put in and after it rips it to the assigned folder it ejects the dvd from the drive but does not seem to go on to run handbrake to compress the ripped file at all? - The other night to try it out i put in ghostbusters 2... it ripped the main movie to 3.5GB but that was all.

I am using XP (32 bit version)

Thanks for any help with this one!

Try taking the trailing slash off

Code:
Set IntDir=C:\Program Files (x86)\MakeMKV\

So it looks like this

Code:
Set IntDir=C:\Program Files (x86)\MakeMKV

Then try again and see if that fixes the issue.
find quote
jayzirl Offline
Junior Member
Posts: 45
Joined: Jan 2012
Reputation: 0
Post: #169
(2012-11-07 03:21)Spinalcrack Wrote:  Try taking the trailing slash off

Code:
Set IntDir=C:\Program Files (x86)\MakeMKV\

So it looks like this

Code:
Set IntDir=C:\Program Files (x86)\MakeMKV

Then try again and see if that fixes the issue.

Thanks for getting back to me, i tried that with no luck... when i ran the launcher it ripped another dvd i put in to my selected destination folder and then ejected it from the drive. The total file it ripped to was 3.4GB.

Am i missing a step or something? when it rips the dvd, you can see the light on the drive and then when finished, (about 10 mins) in my case, it ejects the dvd from the drive. Should a banner or splash screen pop up then and state that handbrake is running or something simular?

Also, is there a certain version of handbrake i should be using?

Thanks again for the help on this - it is a great script and i cant wait to use it for my ripping requirements in XBMC.

On a side note to earlier asked questions... yes user1 is correct and contained in the path and i have moved that particular folder into the standard programs folder from the wrong folder and reflected this by editing my code.
find quote
Spinalcrack Offline
Senior Member
Posts: 128
Joined: Jul 2011
Reputation: 10
Post: #170
Wait, 3.4GB? How big was the disc before you ripped it? Handbrake is re-encoding by default to 720p, so if you have a 8.5gig dvd, after stripping out the menus and special features and encoding to 720p 3.4gb doesn't sound too far off really. Does it say 720p in the file name after the rip? It will only create that name if Handbrake is working.

Try setting Handbrake to no, and rip the disc and see what size and quality you get. I think Handbrake is probably doing the encode.

The other way to trouble shoot this as well is tab out to windows and open a command prompt (window Key + R, type cmd and hit enter), and then run the AutoRipDVD.bat file from there and you can see all the output in the window. See if there is any error being given.
find quote
redwoodgrown Offline
Junior Member
Posts: 1
Joined: Sep 2011
Reputation: 0
Post: #171
could you email your files for this
redwoodgrown@gmail.com
find quote
AmericanAl Offline
Junior Member
Posts: 32
Joined: Sep 2012
Reputation: 3
Post: #172
(2012-11-08 00:46)Spinalcrack Wrote:  Wait, 3.4GB? How big was the disc before you ripped it? Handbrake is re-encoding by default to 720p, so if you have a 8.5gig dvd, after stripping out the menus and special features and encoding to 720p 3.4gb doesn't sound too far off really. Does it say 720p in the file name after the rip? It will only create that name if Handbrake is working.

Try setting Handbrake to no, and rip the disc and see what size and quality you get. I think Handbrake is probably doing the encode.

The other way to trouble shoot this as well is tab out to windows and open a command prompt (window Key + R, type cmd and hit enter), and then run the AutoRipDVD.bat file from there and you can see all the output in the window. See if there is any error being given.

Some Blu Ray / DVDs don't compress all that well. I tweaked the settings for the re-encoding a bit, and I can get 7-8 GB DVDs to 1-2 GB .MKV files with little to no difference in quality, and then 20-30GB Blu Rays to 7-8GB, but sometimes you get the odd movie that comes out being 4-5GB / 10-12GB.

But yeah, if you get at least 50% file size reduction, I consider it a good job for a fully automated process.
find quote
akevit Offline
Donor
Posts: 127
Joined: May 2011
Reputation: 2
Location: Seattle
Post: #173
Well I've been doing a lot of tweaking and testing with Blu-Rays, and right now it doesn't seem possible to have a full proof method for automating blu ray rips. Some publishers obfuscate the main title with 50+ other 'fake' playlists being present on the disc, meaning you either need to test each one to find the right one or do a google search to find out which one you need (such as what I had to do for Safe). I've made quite a few changes, and it's really now tailored for exactly what I'm doing, but if anyone is interested here's my modified code. Since the makemkv command line is pretty limited, I need to manually check to see if I can RIP the MKV automatically. If I can then I select option 1 and 6-10 hours later I have a 720p copy of the blu ray (with the original backed up to a separate folder), and if not I rip the movie manually to the RipDir then selection option 2 and it will handle the rest.

Changes I made:
  • Option to not eject disc after finishing
  • Option to show splash screens
  • All directory variables are now similar in syntax (no trailing back slash)
  • Option to log Handbrake encode
  • Added psuedo logging for batch file
  • Option to only encode the largest MKV in the directory (this was my first attempt at fixing the blu ray issue, it's now sort of pointless)
  • Option to keep the original full quality MKV that makemkv creates (rather than deleting after converting with Handbrake -- which is helpful if you're still messing with HB settings)
  • Streamlined Handbrake settings to match up better with the Handbrake GUI
  • Option to Update XBMC
  • Option to include an empty file to use to create a movie.nfo file if XBMC doesn't scrape correctly

The handbrake settings I'm using now are an accumulation of some information I found on other forums. 'Fortunately' one of the first movies I encoded was The Dark Knight, which uses different aspect ratios throughout the film. In order for that to be retained, you need to turn off auto cropping then set the crop to 0,0,0,0 which essentially just keeps it as the original. Since I don't have my Blu Ray player hooked up to my TV yet I can't fully compare the Blu Ray to my 720p edition, but from watching the encoded 720p version it looks quite good. These are the settings I'm using (which are formatted differently from Spinalcrack's code) which took The Dark Knight from 26.9GB to 3.35GB:

Code:
:720pHigh
Set RESOLUTION=720p
Set PICTURE=-f mkv --decomb -w 1280 --crop 0:0:0:0 --loose-anamorphic  --modulus 2
Set VIDEO=-m -e x264 -q 20 --vfr
Set AUDIO=-a 1,1 -E faac,copy:ac3 -B 160,0 -6 dpl2,auto -R Auto,Auto -D 0,0 --gain=0,0 --audio-copy-mask none --audio-fallback ffac3
Set ADVANCED=-x b-adapt=2:rc-lookahead=50:ref=6:bframes=6:me=umh:subq=9:merange=64:analyse=all
Goto :EOF

Thanks again, hope you don't mind me using your code for my own endeavors.

ATV2 running XBMC Eden (Skin: Quartz3)
Windows 7 running XBMC Eden (custom setup as I'm basically running it as a service)
MySQL installed on Windows 7 for sharing libraries
iOS Specific FAQ | Alternative ATV2 keymap | Default ATV2 keymap
Post log files to Pastebin

[Image: 1721571156.png]
(This post was last modified: 2012-11-12 21:56 by akevit.)
find quote
Depitel Offline
Junior Member
Posts: 1
Joined: Nov 2012
Reputation: 0
Post: #174
This looks like a awesome program. Im new to XBMC and i have 400+ dvds that i would like to have on my HTPC so this program would be perfect for me, but for some reason i cannot download the program from Game Front. Is there anyplace else to get it or could you email it?
find quote
Spinalcrack Offline
Senior Member
Posts: 128
Joined: Jul 2011
Reputation: 10
Post: #175
(2012-11-12 21:32)akevit Wrote:  Thanks again, hope you don't mind me using your code for my own endeavors.

Not at all. I appreciate you posting your changes for others to use. In fact I am going to put links in the first post to your code as an advanced version as you've taken it to a much more sophisticated level, and those with technical knowledge will really appreciate what you have done.
(This post was last modified: 2012-11-19 22:21 by Spinalcrack.)
find quote
kyrios2021 Offline
Junior Member
Posts: 25
Joined: Nov 2012
Reputation: 1
Post: #176
So i have also taken some time to tweak this code some. I took the original Design and merged some of akevit's code to make a combination of the two while adding some of my own to it. The AutoRipDVD code. I wanted to have both modes avaible purely from within the XBMC, so i created a sub-batch to prompt user input in advanced mode.

In order to take advantage of Advanced mode you will need Advanced.bat code and put in the same folder as AutoRipDVD.

Code:
:: Advanced User Input Mode
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::​:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::      
        :: Allows for command prompt user interaction for choice in script
        Set AdvancedMode==Yes

So Part of the changes i made was to still have everything run from within XBMC. So when you say "no" to advanced mode, everything will automate itself to the settings inputed. Selecting Yes will make it so that user input is needed to complete the process. Since AutoripDVD has no cmd box that opens up to have user input i created a sub-batch file that calls certain commands for user input.

For Example: Cmd Box asking what settings to encode at


Code:
:EncodingSettings
cd /d C:\Program Files (x86)\AutoRipDVD
Echo 1.  720pLow
Echo 2.  720pMedium
Echo 3.  720pHigh
Echo 4.  1080pLow
Echo 5.  1080pMedium
Echo 6.  1080pHigh
Set /P UseSettings=Please select a number:
echo %UseSettings% >>value.txt
pause
Goto :EOF

So far there are 4 options you can choose from
-Rip to MKV
-Encode With Handbrake
-Settings to Encode with
- Keep Uncompressed Version


- Added More Options for encoding "6 Presets"
-Advanced % Automated Auto RIP all can be done in XBMC

Media Companion Option is also available if you use that to scrap Movies

Code:
:: http://mediacompanion.codeplex.com/ (requires .net 4.0)
    Set MediaDir=c:\MediaCompanion3.500

*Due to some lazy coding that i will soon fix Advanced.bat for Advanced mode is assuming that AutoRipDVD folder is
C:\Program Files (x86)\AutoRipDVD
If you have a different location you need to manually change for now.


*Advanced Mode also auto selects the Largest MKV and deletes smaller ones. Will update to add a 5th option to hopefully select MKV you want to keep. Allowing you to pause the script Play the files and see which is the one you would like.

Thanks SpinalCrack and Akevit for the great inputs.

Hope it was ok to tweak it some more Smile
find quote
Spinalcrack Offline
Senior Member
Posts: 128
Joined: Jul 2011
Reputation: 10
Post: #177
(2012-11-27 16:27)kyrios2021 Wrote:  Thanks SpinalCrack and Akevit for the great inputs.

Hope it was ok to tweak it some more Smile

Totally fine by me. I think it's great and really appreciate you sharing what you've done with the community. Cheers!
find quote
wints Offline
Senior Member
Posts: 203
Joined: Apr 2011
Reputation: 0
Post: #178
Should this script work with any version of XBMC? its just that i'm using Frodo Beta1 and seem to be having abit of a problem when it should be ripping it doesn't but it does create the folders but there empty? cheers for any input as always

7.1 Cinema Room HTPC with XBMC Gotham~Epson TW3200~Homemade 7ft pj screen~AVR~Yamaha RX-A2020~Speakers~Monitor Audio RX6 Fronts & RX Centre~RXFX Surrounds~180's Rears~BK XXLS400 Sub~8033C AntiMode~HarmonyOne


find quote
kyrios2021 Offline
Junior Member
Posts: 25
Joined: Nov 2012
Reputation: 1
Post: #179
(2012-11-29 09:14)wints Wrote:  Should this script work with any version of XBMC? its just that i'm using Frodo Beta1 and seem to be having abit of a problem when it should be ripping it doesn't but it does create the folders but there empty? cheers for any input as always

I'm running Frodo Beta 1 , both Spinals and My modified code work from within XBMC

Sounds like the script is running if making the folder.

1) Your make MKV might be expired or not activated. You can check by opening the application and seeing if you can use it. BTW you have to open MAKEMKV once anyways on first install to accept terms.

2) your path is incorrect down below. Make sure you don't have a trailing slash.


Code:
:: IntDir=Where you installed MakeMKV to
        Set IntDir=C:\Program Files (x86)\MakeMKV

3) Also make sure you are calling the correct MakeMKV (example: makemkvcon64.exe if on 64 bit)

Try running Task manager as you start the script and see if MakeMKV64 loads in there
(This post was last modified: 2012-11-29 18:16 by kyrios2021.)
find quote
wints Offline
Senior Member
Posts: 203
Joined: Apr 2011
Reputation: 0
Post: #180
ok kyrios, you was right with number 1) my MKV had expired so i.ve updated that and registered and ran it and it worked fine,then I launched XBMC tried running the script again but still nothing now it doesn't even create the folders, so i checked task manger and MakeMKV64 is not loaded, i've checked the bat file and path is correct (Set IntDir=C:\Program Files (x86)\MakeMKV ) with no trailing \ and i'm using 64bit win 7 so i'm calling makemkvcon64.exe. Any more suggestions would be really great and thanks Wink

7.1 Cinema Room HTPC with XBMC Gotham~Epson TW3200~Homemade 7ft pj screen~AVR~Yamaha RX-A2020~Speakers~Monitor Audio RX6 Fronts & RX Centre~RXFX Surrounds~180's Rears~BK XXLS400 Sub~8033C AntiMode~HarmonyOne


find quote
Post Reply