View Single Post
  #1   (View Single Post)  
Old 30th December 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Post FreeBSD howto: burning and ripping cd's

To create iso
$ mkisofs -o /path/to/output.iso -R -J /path/to/files/you/want/on/cd
to burn cd-r/cd-rw
$ burncd data /path/to/output.iso fixate
to burn files to disk (without creating iso) [thanks to Pushrod]
mkisofs -o /dev/stdout -R -J /path/to/files/you/want/on/cd | burncd data /dev/stdin fixate
to blank cd-rw
$ burncd blank
to get cd/dvd image (to get iso from disk)
$ dd if=/dev/acd0 of=/path/to/disk.iso bs=2048

to burn dvd iso to disk
$ growisofs -dvd-compat -Z /dev/cd0=/path/to/image.iso
to burn files to dvd without creating iso
$ growisofs -Z /dev/cd0 -R -J /some/files
above 2 commands will overwrite content on dvd+-rw disk
no need to blank (so it seams. i tested on my pc)

to append to dvd (must use same options as when creating this dvd)
$ growisofs -M /dev/cd0 -R -J /some/more/files
to finalize dvd (you need this after appending to dvd)
$ growisofs -M /dev/cd0=/dev/zero

to burn audio cd from wav files
$ burncd audio file1.wav file2.wav file3.wav fixate
here's simple script that uses mplayer and burncd to burn audio cd's from directory with music files (basically any file that mplayer can play)
for i in `ls`; do
  rm -f /tmp/cd_track.wav
  mplayer -vo null -vc dummy -af resample=44100 -ao pcm:file=/tmp/cd_track.wav $i
  burncd audio /tmp/cd_track.wav
rm -f /tmp/cd_track.wav
burncd audio fixate
exit 0
and here's another simple script to rip audio cd's to mp3
mkdir /tmp/cd
cd /tmp/cd
cdparanoia -B -d /dev/acd0
for i in `ls *.wav`; do
  lame -m s "$i" -o "$(echo $i | awk '{print substr($0,6,2)}' -).mp3"
  rm -f "$i"
echo 'files are in /tmp/cd'
exit 0
you can rip 1 audio track to wav with
$ cdparanoia -B -d /dev/acd0 1
in this example it'll rip track 1 only
and convert it to mp3 with
lame -m s audio.wav -o audio.mp3

to attach and mount iso image
$ mdconfig -a -t vnode -u 0 -f /path/to/image.iso
$ mount -t cd9600 /dev/md0 /mnt

to umount and detach iso image
$ umount /mnt
$ mdconfig -du 0

To make it all happen you need:

in kernel
options 	CD9660			# ISO 9660 Filesystem, because you want to read them ;)
device		atapicd		# ATAPI CDROM drives
device		atapicam
device		cd				# nessacery for dvd's
device 		pass
device 		scbus
options		MD_ROOT
device		md
options         UDF
and permission to write to /dev/acd0 /dev/cd0 /dev/pass1

note: The pass device number will also depend on the order that SCSI devices are enumerated by the kernel. To determine exactly which one it is, one can use camcontrol devlist as root [thanks to phoenix from]

note, you can't run growisofs using su, you need to do that as user....

here's some part of my /etc/devfs.conf
own     acd0    root:users
perm    acd0    0660

own     cd0     root:users
perm    cd0     0660

own     pass1   root:users
perm    pass1   0660

own     pass0   root:users
perm    pass0   0660

note: if you have more than one drive, you need to specify which one to use with burncd as well
use -f flag for this
burncd -f /dev/acd1 data /path/to/image.iso fixate
to use mkisofs you need to install sysutils/cdrtools
to use growisofs you need to install sysutils/dvd+rw-tools

to use cdparanoia you need to install audio/cdparanoia
to use lame you need to install audio/lame
to use mplayer you need to install multimedia/mplayer

man 8 burncd
man 8 mkisofs
man 8 growisofs

man 8 mplayer
man 1 cdparanoia

man 8 mdconfig

man 1 lame , hmm why this is not available in freebsd online manual pages?

origianl post:

Last edited by graudeejs; 30th December 2008 at 05:03 PM.
Reply With Quote