Newsgroup: it.comp.os.linux.iniziare
Titolo: Encoding di mp3 on the fly

audio in .mp3 al volo, senza dover prima rippare le tracce su HD?
Sulla mia  SuSE c'e'  questo scriptino  (E che  palle, c'e'  gia' la
pappa pronta :-) !):
==
# !/bin/sh
# Demo script for processing all audio tracks with a mp3 decoder
# based on a news article by Tom Kludy
# This variant uses named pipes in order to save space.
# There is another variant of this script, which uses temporary
# wav files (see cdda2mp3.new).
#
# usage: cdda2mp3 <name prefix for all mp3 files>
#
# list_audio_tracks is a (symbolic) link to cdda2wav
# and used to generate a list of audio track numbers and start
# sectors, which in turn are used in a loop to spawn cdda2wav
# and the post processor on a track by track basis.
# specify the audio track listing program and its options
LAT=list_audio_tracks
LAT_OPTIONS=
# specify the sampling program and its options
# do not specify the track option here!
CDDA2WAV=cdda2wav
CDDA2WAV_OPTS='-Owav -H -P0 -q'
# for normal use, comment out the next line
#DEBUG='-d1'
# the post processor is fed through a named pipe to avoid space waste
# specify the post processing program and its options
MP_CODER=l3enc
#MP_OPTIONS='2>/dev/null 1>/dev/null'
MP_OPTIONS='-br 128000'
#MP_OPTIONS='-hq'
# name of the named pipe
NPIPEPREFIX='npipe'$$
NPIPE=$NPIPEPREFIX".wav"
FILEPREFIX=${1:-audiotrack}
mkfifo $NPIPE
# clean up named pipe on exit, abort, ...
trap "rm -rf $NPIPE" 0 2 3 4 6 7 8 10 11 12 13 15
# feed track numbers and start sectors into loop
$LAT $LAT_OPTIONS | while read TRACK STARTSECTOR;
do
  $CDDA2WAV $CDDA2WAV_OPTS -t$TRACK $DEBUG $NPIPE &
#  echo n | $MP_CODER $NPIPE $FILEPREFIX$TRACK.mp3 $MP_OPTIONS 
  $MP_CODER $NPIPE $FILEPREFIX$TRACK.mp3 $MP_OPTIONS 
  # check result code
  RES=$?
  if [ $RES = 0 ] ; then
    echo File $FILEPREFIX$TRACK.mp3 finished successfully.
  else
    echo File $FILEPREFIX$TRACK.mp3 failed \(result $RES\). Aborted. >&2
    break
  fi
done
==
Come vedi, come encoder usa l3enc e per "rippare" il solito cdda2wav.
-- 
                                                                     __
 __                                                              _  ///
| _        Student in Computer Science, Swiss Federal Institute  \\///
|__|iambo      of Technology - mailto:
ggia...@iiic.ethz.ch
       \X/


# Mon 12 Jun 2000
# Notes:
# 	Requires cdda2wav and lame
# Install:
#	Copy this file in /usr/local/bin and... have fun!
#
echo -e "\n\t.------------------------."
echo -e   "\t|  mp3grabber for Linux  |"
echo -e   "\t}-.____________________.-{"
echo -e   "\t|   Written  by Zefram   |"
echo -e   "\t|   zefram @ 
libero.it
   |"
echo -e   "\t'------------------------'\n"
if [ "$1" = "" ]; then
	if [ "$2" = "" ]; then
		echo "Usage: `basename $0` <track> <output file>"
		exit 1
	fi
fi
if [ "$2" = "" ]; then
	echo "Grabbing Track $1 into file track-$1.mp3 ..."
	cdda2wav -D /dev/cdrom -i cooked_ioctl -t $1 -O wav - | lame - track-$1.mp3
	echo -e "\n\t.-------------------------."
	echo -e   "\t| CD Track # [ $1 ] "
	echo -e   "\t| Ripped to: [ track-$2.mp3 ] "
	echo -e   "\t'-------------------------'"
else
	echo "Grabbing Track $1 into file $2.mp3 ..."
	cdda2wav -D /dev/cdrom -i cooked_ioctl -t $1 -O wav - | lame - $2.mp3
	echo -e "\n\t.-------------------------."
	echo -e   "\t| CD Track # [ $1 ] "
	echo -e   "\t| Ripped to: [ $2.mp3 ] "
	echo -e   "\t'-------------------------'"
fi
exit 0
---> CUT HERE <---
-- 
Zefram 	| WARNING: The email address is FAKE.	 ||   [ 
http://zefram.8m.com
 ]
@ Home	| "I think it's time we blow the scene. Get everybody and the
________| stuff together. Ok, 3, 2, 1... Let's jam!" --The Seatbelts, "Tank!"
GnuPG Key Fingerprint: 9747 635E B95A B0B3 4370  1CAA CAF7 512B 945C A44C