Darksoul71
6th April 2005, 07:17
Hi there,
I usally tend to produce a lot of DVD´s as my PC servers as PVR recording
several movies a week. The movies are edited (commercials out, cut start and end)
and mastered via TMPEG DVD Author. If the resulting DVD is oversized, I tend to use
DVD-RB to shrink the DVD (<- Yes, yes, I know: Lossy format to lossy format
conversion, but frankly I don´t care !). So the output of those tools is a normal
windows folder with all DVD files in it. The VIDEO_TS and AUDIO_TS folders are
already available. Burning those files to DVD by using Nero or TMPEG DVD Author
itself often resulted in non-playable disks for me. My standalone got "hickups"
somewhere in the middle or (even worse) somewhere in the end of the movie. The
only reliable way to burn movie DVD´s for me was always creating an ISO file and
burning this ISO via DVDDecrypter. If DVDDecrypter says the disk is ok after verify,
I never ever experienced any issues. So I ended up myself generating the last ISO
disks via TMPEG DVD Author and burning via DVDDecrypter. Not a real issue for a
single DVD but imagine you have something like 10 mastered DVDs residing on your
HD ! Wow, now that´s what I call serious "BTAC"-work (BTAC=boring type and click :)).
Yesterday I was fed up with this and browsed the web for commandline driven
ISO-generation tools. My search revealed MKISOFS. As I do a lot of Windows
automation via AutoIt, I hacked up a quick "MassISO" tools (<- Thus the name of the script).
Here is the code:
$Liste = @ScriptDir & "\ISO.txt"
$file = FileOpen($Liste, 0)
While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
$Dummy = StringSplit($Line,";")
If (@error <> 1) Then
$Command = Chr(34) & @ScriptDir & "\mkisofs.exe" & Chr(34) & " -dvd-video -V " & Chr(34) & "%Titel%" & Chr(34) & " -o " & Chr(34) & "%ISO%" & Chr(34) & " " & Chr(34) & "%Quelle%" & Chr(34)
$Quelle = $Dummy[1]
$Titel = $Dummy[2]
$ISO = $Dummy[3] & $Titel & ".ISO"
$Command = StringReplace($Command,"%Titel%",$Titel)
$Command = StringReplace($Command,"%ISO%",$ISO)
$Command = StringReplace($Command,"%Quelle%",$Quelle)
;TrayTip ( "Now processing:", $Titel, 10, 1)
RunWait($Command,@ScriptDir,@SW_SHOW)
EndIf
Wend
FileClose($file)
How to use the script:
First cut, copy and paste the codesegment above into a textfile and compile it
via AutoIt (http://www.hiddensoft.com/autoit3/). Get MKISOFS from
somewhere (it´s part of the cdrtools package. Hint: Google is your friend :D)
and put it in the same directory as the "MassISO.exe"). Now you are ready to go.
Generate a textfile named "ISO.txt" inside the same directory. ISO.txt keeps
all the relevant informations for ISO generation and is structured
in the following way:
Path to DVD Files;DVD Title;Output Path for ISO
Example:
G:\BLADE;BLADE_THE_DAYWALKER;G:\
Explanation:
The source folders VIDEO_TS and AUDIO_TS are stored in directory G:\BLADE
The resulting ISO will have "BLADE_THE_DAYWALKER" as title and will be stored
under path G:\ with the filename BLADE_THE_DAYWALKER.ISO.
Quite simple, isn´t it ?
Setting up the ISO.txt file for multiple DVDs can be done very quickly
if you just copy the pathnames directly from the Windows Explorer.
Generating eight (8) DVD ISO files just took 16 Minutes on my P4/2.4 GHz.
TMPEG DVD Author needs a lot more time.
Final thoughts: If you dislike the script because you could have hacked
something together yourself, fine ! I don´t wanna hear. If you like it, use it !
I just wanted to share my experiences. May be it helps someone out here.
-D$
Darksoul71
6th April 2005, 13:24
Small code update:
I´ve added a filecheck for the output ISO plus automatic renaming the outfile
in order to avoid that the existing ISO is being overwritten.
$Liste = @ScriptDir & "\ISO.txt"
$file = FileOpen($Liste, 0)
While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
$Dummy = StringSplit($Line,";")
If (@error <> 1) Then
$Command = Chr(34) & @ScriptDir & "\mkisofs.exe" & Chr(34) & " -dvd-video -V " & Chr(34) & "%Titel%" & Chr(34) & " -o " & Chr(34) & "%ISO%" & Chr(34) & " " & Chr(34) & "%Quelle%" & Chr(34)
$Quelle = $Dummy[1]
$Titel = $Dummy[2]
$ISO = $Dummy[3] & $Titel & ".ISO"
$i = 0
While FileExists($ISO)
$ISO = $Dummy[3] & $Titel & "_" & $i & ".ISO"
$i = $i + 1
WEnd
$Command = StringReplace($Command,"%Titel%",$Titel)
$Command = StringReplace($Command,"%ISO%",$ISO)
$Command = StringReplace($Command,"%Quelle%",$Quelle)
TrayTip ( "Now processing:", $Titel, 10, 1)
RunWait($Command,@ScriptDir,@SW_SHOW)
EndIf
Wend
FileClose($file)
Darksoul71
3rd July 2008, 12:43
Hi all,
wow, reviving a 3 year old thread here.
Since I hade "some" mastered DVDs on my HDD lately which I needed
as ISO in order to burn them with ImgBun I dicided to enhance my
old "BatchISOGeneration" script a bit.
I removed the requirement for setting up a text file with all
the source directories for DVD generation. You can now select
the folders directly. The title for the DVD will be preset with
the directory name. So if you named the directories of the mastered
DVDs in a self-speaking manner, batch-generation of a lot of DVDs
works like a charm. I normally master all my DVDs to a certain
folder and name them self-speaking (e.g. "Master and Commander").
The script will then suggest you "MASTER_AND_COMMANDER" as DVD title.
There you go:
#include "dsFileName.au3"
;++++++++++++++++++++++++++++++++++++++++++++++++++
$mkisofs = @ScriptDir & "\mkisofs\mkisofs.exe"
;++++++++++++++++++++++++++++++++++++++++++++++++++
Func CreateDVDImage ($SourceDir, $TargetFile, $CDLabel)
$Command= Chr(34) & $mkisofs & Chr(34) & " -dvd-video -V " & $CDLabel & " -o " & Chr(34) & $TargetFile & Chr(34) & " " & Chr(34) & $SourceDir & Chr(34)
$val = RunWait ($Command,@ScriptDir & "\mkisofs",@SW_HIDE)
EndFunc
;++++++++++++++++++++++++++++++++++++++++++++++++++
Func CleanTitle ($MyTitle)
$MyTitle = StringUpper ($MyTitle)
$MyTitle = StringStripCR ($MyTitle)
; Lösche alle doppelten Leerzeichen, führende und beendende Leerzeichen
$MyTitle = StringStripWS ($MyTitle, 7)
$MyTitle = StringReplace ($MyTitle, " ", "_")
$MyTitle = StringReplace ($MyTitle, "Ä", "AE")
$MyTitle = StringReplace ($MyTitle, "Ö", "OE")
$MyTitle = StringReplace ($MyTitle, "Ü", "UE")
$MyTitle = StringReplace ($MyTitle, "ß", "SS")
Return ($MyTitle)
EndFunc
;++++++++++++++++++++++++++++++++++++++++++++++++++
$MaxDirs = 8000
;Note: The sencond cell keeps the DVD Title
Dim $SourceArray [$MaxDirs][2]
; Initializing $SourceArray
For $i = 0 To $MaxDirs - 1
$SourceArray [$i][0] = ""
$SourceArray [$i][1] = ""
Next
$Count = 0
$CurrentDir = ""
; Browse for files to process until user aborts selection loop
Do
$SourceArray[$Count][0] = FileSelectFolder("Choose DVD source directory", $CurrentDir, 0)
; Only increase $Count if user has selected a valid directory
If ($SourceArray[$Count][0] <> 1) And FileExists($SourceArray[$Count][0] & "\VIDEO_TS") Then
$DVDLabel = CleanTitle(_FileGetFilename($SourceArray[$Count][0]))
$DVDLabel = InputBox("DVD Label", "Enter title of DVD", $DVDLabel)
If (@Error = 0) Then
$SourceArray[$Count][1] = $DVDLabel
Else
$SourceArray[$Count][1] = "DVD_VOLUME"
Endif
$Count = $Count + 1
EndIf
$Button = MsgBox(36, "Browse for DVD sources", "Do you want add other directories for ISO Generation ?")
$CurrentDir = _FileGetDrive($SourceArray[$Count][0])
Until $Button = 7
$TargetDir = FileSelectFolder("Choose the ISO target directory", "", 1)
If (StringLen ($TargetDir) > 3) Then $TargetDir = $TargetDir & '\'
For $i = 0 To $MaxDirs - 1
If ($SourceArray [$i][0] <> "") Then
CreateDVDImage ($SourceArray [$i][0], $TargetDir & $SourceArray [$i][1] & ".ISO", $SourceArray [$i][1])
Else
ExitLoop
EndIf
Next
Note: The CleanTitle Function is coded for German "Umlauts". So if you have other
country specific characters you want to change here to DVD-compliant text, please
add them there.
Requires my UDF "dsFileName". So here is the source code for dsfilename:
#include "File.au3"
;----------------------------------------------------------------------------------
Func _FileGetDrive ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return ($tmpDrive)
EndFunc
;----------------------------------------------------------------------------------
Func _FileGetPath ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return ($tmpDrive & $tmpDir)
EndFunc
;----------------------------------------------------------------------------------
Func _FileGetFilename ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return ($tmpName & $tmpExt)
EndFunc
;----------------------------------------------------------------------------------
Func _FileGetExt ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return ($tmpExt)
EndFunc
;----------------------------------------------------------------------------------
Func _FileChangeExt ($FullPath, $Extension)
If (StringLeft ($Extension, 1) <> ".") Then $Extension = "." & $Extension
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return (StringReplace ($FullPath, $tmpExt,$Extension))
EndFunc
;----------------------------------------------------------------------------------
Func _FileStripExt ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
Return ($tmpDrive & $tmpDir & $tmpName)
EndFunc
;----------------------------------------------------------------------------------
Func _FileAppendTextfile ($ToAppend, $FromAppend)
$ToFile = FileOpen($ToAppend, 1)
; Check if file opened for appending OK
If $ToFile = -1 Then
MsgBox(0, "Error", "Unable to open file " & $ToAppend)
Exit
EndIf
$FromFile = FileOpen($FromAppend, 0)
; Check if file opened for reading OK
If $FromFile = -1 Then
MsgBox(0, "Error", "Unable to open file " & $FromAppend)
Exit
EndIf
While 1
$line = FileReadLine($FromFile)
If @error = -1 Then ExitLoop
FileWriteLine($ToFile, $Line)
Wend
FileClose($FromFile)
FileClose($ToFile)
EndFunc
;----------------------------------------------------------------------------------
Func _FileSearchAndReplaceText ($SearchFile, $SearchString, $ReplaceString, $CaseSensitive)
$LineCount = _FileCountLines( $SearchFile )
If ($LineCount = 0) Then
Exit
Else
Dim $myArray[$LineCount]
EndIf
If (_FileReadToArray( $SearchFile, $myArray ) = 0) Then Exit
For $i = 0 To $LineCount - 1
$myArray[$i] = StringReplace ($myArray[$i], $SearchString, $ReplaceString, -1, $CaseSensitive)
Next
_FileWriteFromArray($SearchFile, $myArray)
EndFunc
;----------------------------------------------------------------------------------
Func _FileSearchForText ($SearchFile, $SearchString, $CaseSensitive)
$StringFound = 0
$File = FileOpen($SearchFile, 0)
; Check if file opened for appending OK
If $File = -1 Then
MsgBox(0, "Error", "Unable to open file " & $SearchFile)
Exit
EndIf
While (1) And ($StringFound = 0)
$line = FileReadLine($File)
If @error = -1 Then ExitLoop
If (StringInStr ( $line, $SearchString, $CaseSensitive) <> 0) Then $StringFound = 1
Wend
FileClose ($File)
Return ($StringFound)
EndFunc
;----------------------------------------------------------------------------------
Func _FileIncrementFileName ($FullPath)
If FileExists($FullPath) Then
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
$Count = 1
$ReturnName = $tmpDrive & $tmpDir & $tmpName & " (" & $Count & ")" & $tmpExt
While FileExists ($ReturnName)
$Count = $Count + 1
$ReturnName = $tmpDrive & $tmpDir & $tmpName & " (" & $Count & ")" & $tmpExt
Wend
Return ($ReturnName)
Else
Return ($FullPath)
EndIf
EndFunc
;----------------------------------------------------------------------------------
Func _GenerateIncrementedFileNames ($FullPath, $Count, byRef $myArray)
If (UBound($myArray) = 1 And @error = 1) Then Dim $myArray[$Count]
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
$myArray [0] = $FullPath
For $i = 1 To $Count - 1
$myArray[$i] = $tmpDrive & $tmpDir & $tmpName & " (" & $i & ")" & $tmpExt
Next
EndFunc
;----------------------------------------------------------------------------------
Func _DrivePercentFree ($FullPath)
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
If (DriveStatus ($tmpDrive) <> "READY") Then Return (-1)
$SizeTotal = DriveSpaceTotal ($tmpDrive)
$SizeFree = DriveSpaceFree ($tmpDrive)
Return (Round ($SizeFree / ($SizeTotal*0.01),2))
EndFunc
;----------------------------------------------------------------------------------
Func _IsSearchedType ($FullPath, $Types)
$SearchedTypes = StringSplit ( $Types, "|,;:" )
$SearchCount = $SearchedTypes[0]
For $i = 1 To $SearchCount
$SearchedTypes[$i] = StringUpper($SearchedTypes[$i])
If (StringLeft ($SearchedTypes[$i], 1) <> ".") Then $SearchedTypes[$i] = "." & $SearchedTypes[$i]
Next
; Define local variables
Local $tmpDrive = ""
Local $tmpDir = ""
Local $tmpName = ""
Local $tmpExt = ""
Local $tmpDrive = ""
_PathSplit($FullPath, $tmpDrive, $tmpDir, $tmpName, $tmpExt)
For $i = 1 To $SearchCount
If ($SearchedTypes[$i] = StringUpper($tmpExt)) Then Return (1)
Next
Return (0)
EndFunc
;----------------------------------------------------------------------------------
Have fun,
D$
madvj
4th August 2009, 00:15
This is awsome. works fine with the very first script of this thread but when i try to do it with this script i get a error:
ERROR:
#include "dsFileName.au3"
Error opening the file
#include "dsFileName.au3"
;++++++++++++++++++++++++++++++++++++++++++++++++++
$mkisofs = @ScriptDir & "\mkisofs\mkisofs.exe"
;++++++++++++++++++++++++++++++++++++++++++++++++++
Func CreateDVDImage ($SourceDir, $TargetFile, $CDLabel)
$Command= Chr(34) & $mkisofs & Chr(34) & " -dvd-video -V " & $CDLabel & " -o " & Chr(34) & $TargetFile & Chr(34) & " " & Chr(34) & $SourceDir & Chr(34)
$val = RunWait ($Command,@ScriptDir & "\mkisofs",@SW_HIDE)
EndFunc
;++++++++++++++++++++++++++++++++++++++++++++++++++
Func CleanTitle ($MyTitle)
$MyTitle = StringUpper ($MyTitle)
$MyTitle = StringStripCR ($MyTitle)
; Lösche alle doppelten Leerzeichen, führende und beendende Leerzeichen
$MyTitle = StringStripWS ($MyTitle, 7)
$MyTitle = StringReplace ($MyTitle, " ", "_")
$MyTitle = StringReplace ($MyTitle, "Ä", "AE")
$MyTitle = StringReplace ($MyTitle, "Ö", "OE")
$MyTitle = StringReplace ($MyTitle, "Ü", "UE")
$MyTitle = StringReplace ($MyTitle, "ß", "SS")
Return ($MyTitle)
EndFunc
;++++++++++++++++++++++++++++++++++++++++++++++++++
$MaxDirs = 8000
;Note: The sencond cell keeps the DVD Title
Dim $SourceArray [$MaxDirs][2]
; Initializing $SourceArray
For $i = 0 To $MaxDirs - 1
$SourceArray [$i][0] = ""
$SourceArray [$i][1] = ""
Next
$Count = 0
$CurrentDir = ""
; Browse for files to process until user aborts selection loop
Do
$SourceArray[$Count][0] = FileSelectFolder("Choose DVD source directory", $CurrentDir, 0)
; Only increase $Count if user has selected a valid directory
If ($SourceArray[$Count][0] <> 1) And FileExists($SourceArray[$Count][0] & "\VIDEO_TS") Then
$DVDLabel = CleanTitle(_FileGetFilename($SourceArray[$Count][0]))
$DVDLabel = InputBox("DVD Label", "Enter title of DVD", $DVDLabel)
If (@Error = 0) Then
$SourceArray[$Count][1] = $DVDLabel
Else
$SourceArray[$Count][1] = "DVD_VOLUME"
Endif
$Count = $Count + 1
EndIf
$Button = MsgBox(36, "Browse for DVD sources", "Do you want add other directories for ISO Generation ?")
$CurrentDir = _FileGetDrive($SourceArray[$Count][0])
Until $Button = 7
$TargetDir = FileSelectFolder("Choose the ISO target directory", "", 1)
If (StringLen ($TargetDir) > 3) Then $TargetDir = $TargetDir & '\'
For $i = 0 To $MaxDirs - 1
If ($SourceArray [$i][0] <> "") Then
CreateDVDImage ($SourceArray [$i][0], $TargetDir & $SourceArray [$i][1] & ".ISO", $SourceArray [$i][1])
Else
ExitLoop
EndIf
Next
Darksoul71
4th August 2009, 18:45
hi madvj,
the 1st script works fine because it is not relying on my UDF file (= user defined functions). You need to copy the source code of the second code block of my last segment into a text editor of your choice and save it to a file named "dsFileName.au3". Save this script in the same directory as the first code block. After this you should be able to compile the script without any error messages.
Let me know if you still have problems. :cool:
Cheers,
D$
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.