Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Burn DivX/AVI movies to CD' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Burn DivX/AVI movies to CD
Authored by: Peter Kappesser on Jan 07, '05 01:20:57AM
If you don't have Toast, you can burn an ISO-formatted CD-R with the command-line tool hdiutil. Here's a simple script I wrote for my own use:

#! /bin/bash
# isoburn - burn a CD-R using ISO/Joliet

hdiutil=/usr/bin/hdiutil
image=/tmp/cdr$$.iso
source=$1

echo "Source: $source"

$hdiutil makehybrid -iso -joliet -o $image "$source"
$hdiutil burn $image -forceclose -noeject

rm $image
(Yes, I've since learned that use of /tmp in this fashion is insecure. I'll leave it as an exercise for the reader to improve it if their situation warrants. Mine doesn't.)

Your AVI file(s) must be enclosed in a folder. One advantage of using ISO format over the standard Disk Image/Finder Burn is that, since the extra Mac-specific filesystem structure is not included, you can cram about 40MB more onto a CD-R (a full 700MB instead of 660MB).

I've tried making a drag-n-drop app with this script using Platypus, but for some reason it doesn't work. Also I've tried burning a DVD, and although it seems to work and verifies with no errors reported, the Mac won't mount the disk afterward and doesn't recognize the filesystem.

[ Reply to This | # ]

An applescript to choose filesystem formats
Authored by: magnamous on Jul 17, '05 03:09:42AM
I made an applescript to do this. It asks you:
  1. which filesystems you would like to include in the disk image
  2. which folder contains the items you want to include
  3. what name you would like the volume to have
  4. and finally, whether you would like to create the disk image, create the image and burn the CD, or do nothing
I created this because I didn't like Disk Utility's semi-cryptic and inflexible options. Also, I made the assumption that the user would want to keep the disk image (which is saved to the user's desktop folder). Any improvements to this script are very welcome!

tell application "System Events"
	activate
	
	(* get the formats the user wishes to use
	
	 There is seemingly a bug in this - no matter what I try, I can't get this 
	 dialog box to recognize pressing Cancel. It just goes on to the next dialog. 
	 I also can't figure a way around the bug...
	 
	The only thing I've been able to figure out to do is set the
	cancel button as an "All formats" button and then set the chosen
	formats manually. But this means that for now there is no cancel button  : (   *)
	set chosenFormats to {}
	choose from list {"HFS+", "UDF", "ISO 9660"} with prompt ¬
		"Which CD format(s) do you wish to use?" with title "Burn Hybrid CD" OK button name "Continue" cancel button name ¬
		"All Formats" with multiple selections allowed without empty selection allowed
	if the result is not false then
		set chosenFormats to the result
	else
		set chosenFormats to {"HFS+", "UDF", "ISO 9660"}
	end if
	
	-- ask the user if the Joliet extensions to ISO 9660 are desired. Add them if they are desired.
	repeat with i from 1 to count of chosenFormats
		if item i of chosenFormats is equal to "ISO 9660" then
			display dialog "Would you like to add Joliet extensions to the ISO filesystem?" buttons {"Do not add Joliet", "Add Joliet"} default button 2
			if the button returned of the result is "Add Joliet" then
				set chosenFormats to chosenFormats & {"Joliet"}
				exit repeat
			end if
		else
			set i to i + 1
		end if
	end repeat
	
	(* set the variable that will determine which formats are used later on
	in the shell script. It's rather kludgy: it could use some optimizing. *)
	set formatsToUse to ""
	set confirmationListOfFormats to ""
	(* in this, confirmationListOfFormats set to a semi-nice-looking
	string which will be used later to confirm that this is what the user wants *)
	if the (count of chosenFormats) is 4 then
		-- leave formatsToUse as empty
		set confirmationListOfFormats to "HFS+, UDF, ISO 9660, Joliet"
	else
		repeat with i from 1 to count of chosenFormats
			if item i of chosenFormats as string is equal to "HFS+" then
				set formatsToUse to formatsToUse & "-hfs "
				set confirmationListOfFormats to confirmationListOfFormats & "HFS+   "
			else if item i of chosenFormats as string is equal to "ISO 9660" then
				set formatsToUse to formatsToUse & "-iso "
				set confirmationListOfFormats to confirmationListOfFormats & "ISO 9660   "
			else if item i of chosenFormats as string is equal to "Joliet" then
				set formatsToUse to formatsToUse & "-joliet "
				set confirmationListOfFormats to confirmationListOfFormats & "Joliet   "
			else if item i of chosenFormats as string is equal to "UDF" then
				set formatsToUse to formatsToUse & "-udf "
				set confirmationListOfFormats to confirmationListOfFormats & "UDF   "
			end if
			set i to i + 1
		end repeat
	end if
	
	-- get the folder with the items to be burned
	choose folder with prompt "Select the folder containing the files you wish to include"
	set sourceFolder to the POSIX path of the result
	
	-- just a perk for the user: allowing the user to specify a name for the CD
	display dialog "Example: Burned Files" with title "Specify the name you want for the CD" default answer ""
	if the text returned of the result is not "" then
		set cdName to the text returned of the result
	else
		set cdName to "BurnedFiles"
	end if
	
	-- allow the user to choose what to do
	-- giving one last opt-out chance, and the ability to create just the image
	display dialog "Chosen folder:" & return & return & sourceFolder & return & return & ¬
		"Chosen filesystems:" & return & return & confirmationListOfFormats with title ¬
		"What would you like to do?" buttons {"Cancel", "Create Disk Image", "Burn CD"} default button 3
	set chosenAction to the button returned of the result
	
	-- prepare the variable for use below
	set sourceFolder to the quoted form of sourceFolder
	
	-- create a name for the disk image
	do shell script "uuidgen"
	set imageName to the result
	set imageCDpath to "~/Desktop/cdr" & imageName & ".iso"
	
	-- do what the user wants
	if chosenAction is "Create Disk Image" then
		do shell script "hdiutil makehybrid " & formatsToUse & ¬
			"-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
		display dialog "Your Disk Image is being created. It will appear on the desktop when the process has finished." buttons {"OK"} default button 1
	else if chosenAction is "Burn CD" then
		do shell script "hdiutil makehybrid " & formatsToUse & ¬
			"-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
		display dialog "Your CD is being burned. The computer will eject it when it has finished burning." buttons {"OK"} default button 1
		do shell script "hdiutil burn " & imageCDpath & " -forceclose -eject"
	end if
	
end tell


[ Reply to This | # ]