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

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Spinalcrack Offline
Senior Member
Posts: 104
Joined: Jul 2011
Reputation: 9
Post: #161
(2012-10-08 23:16)rodrom Wrote:  Am i doing anything wrong here?

Take 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
AmericanAl Offline
Junior Member
Posts: 32
Joined: Sep 2012
Reputation: 3
Post: #162
Does anyone know what settings I can use to make sure the handbrake encoding doesn't leave a lot of artifacts on the darker parts of movies? I'm using the High Quality default profile, and taing DVD rips from 6-7GB to 1-2 is amazing. 90% of the time the quality is unnoticeable, but if you've got a keen eye you can see a lot of artifacting on DVD rips in dark parts of the movie.
find quote
akevit Offline
Donor
Posts: 124
Joined: May 2011
Reputation: 0
Location: Seattle
Post: #163
Hello, thanks for putting this together, I just ordered a Blu-Ray drive and was hoping something like this existed -- I'm excited to try it out next week!

If you're interested in also automatically updating the library, you could add the following to your code.  I am not sure if Eden supports JSON or if it is only Frodo, so the question for which version you're using might be pointless, but at least I know that the HTTP API works in Eden and the JSON API works in Frodo.  I haven't had a chance to test this yet since I don't have the drive, but it should work Tongue.  

Also, in going through your batch file, I see one area that might be an issue. Where you have:
Code:
If %Handbrake%==Yes call :HBEncode

The code will go through the HBEnode label but then also go through the rename label an additional time, as there is no escape from the HBEncode section. I actually don't really see this being a problem since it is going to try and rename a file that no longer exists, but it still might be worth it to jump out of the HBEncode label in the event some other portion of code is added later.

New Variables:
Code:
::------------------------------------
::
::*** Update XBMC Library Upon completion?
::*** NOTE: CURL for Windows MUST BE INSTALLED
:: http://curl.haxx.se/download.html
::
::------------------------------------
set UpdateXBMC=Yes
::------------------------------------
::
::*** Which version of XBMC are you using? Enter Frodo or Eden
::
::------------------------------------
set XBMCversion=Frodo
:: Set login details for XBMC HTTP access
set XBMCuser=xbmc
set XBMCpass=xbmc
set XBMCurl=127.0.0.1
set XBMCport=8082
set cURLpath=C:\cURL\curl.exe

Modified/Added code (paste after "for %%i in ("title*.mkv") do (set fname=%%i) & call :rename[/i]"):[/b]
Code:
:EndingScripts
If %Handbrake%==Yes call :HBEncode
If %UpdateXBMC%==Yes call :UpdateLibrary

:ScriptComplete
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"
SET Handbrake=NULL
Goto :EndingScripts

:rename
::Cuts off 1st 5 characters of fname, then appends prefix
ren %fname% "%volid%"_%fname:~5%
Goto :EndingScripts

:UpdateLibrary
If XBMCversion==Frodo set updateCall=%cURLpath% -i -H "Content-Type: application/json" -X POST -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.Scan\"}" http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/jsonrpc
If XMBCversion==Eden set updateCall=%cURLpath% --get "http://%XBMCuser%:%XBMCpass%@%XBMCurl%:%XBMCport%/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)"
call %updateCall%
SET UpdateXBMC=NULL
Goto :EndingScripts


Thanks again for doing this Smile

Edit: One thing to note is that if you did want to include this in your download, you could include the 32-bit and x64 version of curl in your installer then call it from there, as it's just an exe file and doesn't need to be registered or anything.

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-01 21:20 by akevit.)
find quote
Spinalcrack Offline
Senior Member
Posts: 104
Joined: Jul 2011
Reputation: 9
Post: #164
This looks pretty good. Let me know how it works for your system and if it's solid I'll add it in and do another release.
find quote
akevit Offline
Donor
Posts: 124
Joined: May 2011
Reputation: 0
Location: Seattle
Post: #165
Alright so I've also changed the discnum:0 switch for the MakeMKV CLI to be a variable that is discovered by the %volid% variable. This would solve an issue where if someone had two drives and they didn't know if it was disc:0 or disc:1; it's not really needed but it would just be one less variable to find. I only tested the :GetDiscNum part with one disc, so maybe try it out with one of your own.

Here's the code:
Code:
:GetDiscNum
::Get disc number based on name of %volid%
"%IntDir%\makemkvcon64.exe" -r --cache=1 info disc:9999 | find /i "%volid%" > "%userprofile%\ARtemp"
type "%userprofile%\ARtemp"
set /p discNum=<"%userprofile%\ARtemp"
del "%userprofile%\ARtemp"
set discNum=%discNum:~4,1%

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

I tested this by converting a smaller video file to a DVD ISO then mounting it to a virtual drive and specifying that drive for the drive letter. Everything works fine for me, would you mind giving it a test?

Also I had to modify my update code a little bit but it works as far as I've tested. Also I changed the ScriptPath variable to be dynamically hardcoded, as long as the exe file is with the other scripts it won't need to be set. This is referenced in batch files by %~dp0

Full Code


Feel free to take any and all of it, if anything I now have exactly what I was looking for. Thanks again.

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-02 04:26 by akevit.)
find quote
jayzirl Offline
Junior Member
Posts: 33
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: 124
Joined: May 2011
Reputation: 0
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: 104
Joined: Jul 2011
Reputation: 9
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: 33
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: 104
Joined: Jul 2011
Reputation: 9
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
Post Reply