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: 589
Post FreeBSD howto: burning and ripping cd's

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

to burn dvd iso to disk
Code:
$ growisofs -dvd-compat -Z /dev/cd0=/path/to/image.iso
to burn files to dvd without creating iso
Code:
$ 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)
Code:
$ growisofs -M /dev/cd0 -R -J /some/more/files
to finalize dvd (you need this after appending to dvd)
Code:
$ growisofs -M /dev/cd0=/dev/zero

to burn audio cd from wav files
Code:
$ 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)
Code:
#!/bin/sh
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
done
rm -f /tmp/cd_track.wav
burncd audio fixate
exit 0
and here's another simple script to rip audio cd's to mp3
Code:
#!/bin/sh
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"
done
echo 'files are in /tmp/cd'
exit 0
you can rip 1 audio track to wav with
Code:
$ cdparanoia -B -d /dev/acd0 1
in this example it'll rip track 1 only
and convert it to mp3 with
Code:
lame -m s audio.wav -o audio.mp3



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

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

To make it all happen you need:

in kernel
Code:
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 daemonforums.org]

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

here's some part of my /etc/devfs.conf
Code:
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
Code:
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



resources:
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:
https://forums.freebsd.org/showthread.php?t=1195

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