[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Spam: Re: [OT] MP3: Compressioni



Vito wrote:

> messia@debian:~$ ./vito
> ++ find /home/messia/mp3/ -iname '*.mp3'
> ++ read file
> +++ echo quit
> +++ mplayer -slave -identify -ao null -vo null -nosound -novideo
> /home/messia/mp3/Le vibrazioni - In Una Notte 'D'\''estate.mp3'
> +++ grep ID_AUDIO_BITRATE
> +++ awk -F = '{print $2}'
> ++ ID_AUDIO_BITRATE=
> ++ '[' -ge 128000 ']'
> ./vito: line 7: [: -ge: unary operator expected
> [snip]
> 
> NB: nn ho incollato tutti i file, ho interrotto il processo :)
> 

Ok, ora è chiaro..
Mi dispiace ma mplayer non riesce ad estrarre il BITRATE dai tuoi mp3..
lo script va in errore perchè ID_AUDIO_BITRATE viene valorizzato con una
stringa nulla..

Puoi tentare di ignorare i files che non ti permettono di sapere il
bitrate con una modifica del tipo:

find mp3_dir -iname '*.mp3' | while read file
do
      ID_AUDIO_BITRATE=$(echo quit | mplayer -slave -identify \
      -ao null -vo null -nosound -novideo $file 2>/dev/null | \
       grep ID_AUDIO_BITRATE | awk -F "=" '{print $2}')
      if [ -z "$ID_AUDIO_BITRATE" ]; then
          echo bitrate non disponibile per $file
      else
         [ $ID_AUDIO_BITRATE -ge 128000 ] && cd $(dirname $file) && \
         lame -m s -b 128 $(basename $file)
      fi
done

Ciao.

-- 
Saluti By MCM.

<< Unix is the most user friendly system I know, the point is that it is
really selective about who is indeed its friend. >>



Reply to: