Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to calculate time when burning audio cd?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
oliver
Apprentice
Apprentice


Joined: 25 Jun 2003
Posts: 170

PostPosted: Mon Mar 22, 2004 9:25 pm    Post subject: how to calculate time when burning audio cd? Reply with quote

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
View user's profile Send private message
theturner
Tux's lil' helper
Tux's lil' helper


Joined: 12 Mar 2004
Posts: 111
Location: United Socialist Republic of Europe

PostPosted: Mon Mar 22, 2004 9:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Regor
Guru
Guru


Joined: 06 Aug 2002
Posts: 545
Location: 39° 2' 48" N, 120° 59' 2" W

PostPosted: Tue Mar 23, 2004 11:59 am    Post subject: Reply with quote

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
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Tue Mar 23, 2004 12:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
oliver
Apprentice
Apprentice


Joined: 25 Jun 2003
Posts: 170

PostPosted: Mon Apr 05, 2004 4:59 pm    Post subject: Reply with quote

thank you all for the responses
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum