Jump to content

CLI DVD Folder to ISO


The End

Recommended Posts

A short PHP script to convert DVD folders to ISO images.

 

To execute, place script in directory above VIDEO_TS and type:

php dvd2iso.php

 

Script will convert all DVD folders in current directory only. So place all your DVD movies in the same folder and run the script then go to sleep. :)

 

- The End

 

dvd2iso.php

-----------

<?php

 

//

// http://www.ephestione.it/how-to-use-imgburn-for-batch-buildcreateburn-iso-to-backup-to-dvd/

 

function convertDvdFolderToIso($dvd)

{

$imgburn = "C:\\Program Files (x86)\\ImgBurn\\ImgBurn.exe";

 

// DVD video disc uses UDFRevision 1.02 not 2.01

$options = array(

'MODE' => 'BUILD',

// 'BUILDINPUTMODE' => 'ADVANCED',

'BUILDOUTPUTMODE' => 'IMAGEFILE',

'SRC' => "$dvd\\VIDEO_TS",

'DEST' => "ISO\\$dvd.iso",

'VOLUMELABEL' => "$dvd",

'FILESYSTEM' => 'ISO9660 + UDF',

'UDFREVISION' => '1.02',

'NOIMAGEDETAILS' => '',

'ROOTFOLDER' => 'yes',

'START' => '',

'CLOSE' => '',

'LAYERBREAK' => '2000000',

);

 

//

// Construction CLI command

// start with executable and add option/value parameters

$cmd = "\"$imgburn\" ";

foreach ($options as $opt => $val) {

// double quote value in case there's a space

if (!empty($val)) {

$val = "\"$val\"";

}

$cmd .= " /$opt $val";

}

 

// $result = "$cmd\n";

$result = array();

$ret = exec($cmd, &$result);

 

return $result;

}

 

//

// Script starts here

//

$d = dir(".");

echo "Converting DVD Folder to ISO\n";

while (($dvd = $d->read()) !== false) {

$folder = "$dvd\\VIDEO_TS";

if (is_dir("$dvd") && is_dir("$folder")) {

echo " o $dvd\n";

$output = convertDvdFolderToIso($dvd);

// print_r($output);

// echo "\n";

}

}

$d->close();

 

?>

Edited by The End
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.