View previous topic :: View next topic |
Author |
Message |
oliver Apprentice
Joined: 25 Jun 2003 Posts: 170
|
Posted: Mon Mar 22, 2004 9:25 pm Post subject: how to calculate time when burning audio cd? |
|
|
If I have a directory of wavs, how can I calculate the running time of the CD before burning it? For example, I want to know how close to 80 minutes I am getting.
Edited to add:
I like to burn CDs from the command line... I know I can use something like xcdroast, I was just wondering how an app like that calculates it
Thanks |
|
Back to top |
|
|
theturner Tux's lil' helper
Joined: 12 Mar 2004 Posts: 111 Location: United Socialist Republic of Europe
|
Posted: Mon Mar 22, 2004 9:58 pm Post subject: |
|
|
Well i can answer at least you last question - sort-of-question - whatever...
The CD recording apps just count the frames in your wavs - that is all bytes except foir header information, just raw data - and calculate how many Audio CD minutes that makes, which is quite easy because Audio CDs use 44100 Hz 16 bit Stereo - should be (wait, gotta open calculator... *g*) 10584000 bytes per minute if i didn't miscalculate (hope so). could also be that they just grab the timecode from the headers, or from an id3 tag, or whatever..
i don't know about any text mode tools though, for i am not a gui enemy, as long as the gui is userfriendly like gnome or BeOS... |
|
Back to top |
|
|
Regor Guru
Joined: 06 Aug 2002 Posts: 545 Location: 39° 2' 48" N, 120° 59' 2" W
|
Posted: Tue Mar 23, 2004 11:59 am Post subject: |
|
|
Here's a script I hacked together to do something like what you want. It's a little rough, but seems to work okay. It'll take whatever files you give it as an argument and fill the cd up to its capacity with the audio files. It's not intelligent enough to reorder the list you give it to maximize space usage, but it may at least give you an idea how to go about doing the necessary calculations.
Aside from cdrecord it also depends of sfinfo, which is part of media-libs/audiofile.
Code: | #!/bin/bash
DEV=ATAPI:0,0,0
MAXSIZE=`cdrecord -v dev=${DEV} -atip 2> /dev/null | grep "ATIP start of lead out:" | cut -f8 -d" "`
let MAXSIZE=MAXSIZE\*2048
TOTALSIZE=0
FILESTOBURN=""
for F in "$@"
do
FILESIZE=`sfinfo $F 2> /dev/null | grep bytes | tr -s " " | cut -f3 -d" "`
if [ -z ${FILESIZE} ]
then
echo "Skipping ${F}, unrecognized format..."
else
let TMPSIZE=TOTALSIZE+FILESIZE
if [ ${TMPSIZE} -gt ${MAXSIZE} ]
then
echo "Skipping ${F}, not enough space..."
else
echo "Including ${F}..."
TOTALSIZE=${TMPSIZE}
FILESTOBURN="${FILESTOBURN} ${F}"
fi
fi
done
echo
echo "Burning ${FILESTOBURN}"
cdrecord dev=${DEV} driveropts=burnproof -vv -pad -audio -swab -raw96r ${FILESTOBURN} |
_________________ Sometimes the appropriate response to reality is to go insane.
-Philip K. Dick, Valis |
|
Back to top |
|
|
nevynxxx Veteran
Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Tue Mar 23, 2004 12:51 pm Post subject: |
|
|
I usually just aproximate. 80 mins= 700MB from the cover of my blank cd's, so 40 mins is 350Mb etc.....give a pretty decent guide. Also works the other way round for burn time, burning 350MB @ 10x would be 4 mins. _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
|
oliver Apprentice
Joined: 25 Jun 2003 Posts: 170
|
Posted: Mon Apr 05, 2004 4:59 pm Post subject: |
|
|
thank you all for the responses |
|
Back to top |
|
|
|