 ) ... es decir scripts (
) ... es decir scripts (  ) para el shell de Unix, especifya saben como icamente probados en bash. Usan ffmpeg para transformar archivos mp3 a wav y viceversa.
) para el shell de Unix, especifya saben como icamente probados en bash. Usan ffmpeg para transformar archivos mp3 a wav y viceversa.No es nada raro, pero es util y sirve para ver a bash en accion.
Tal vez la parte más interesante es cómo usar las expansiones de variables para crear los nombres nuevos, es decir, cambiar un holahola.wav a holahola.mp3... o tal vez a alguno le interese cómo es el tema de los colores en la consola, que ahi aparece.
Como sea, si tienen preguntas haganlas. Y no me vengan con comparar BASH con BATCH!!

Compartan ambos bajo GPLv2
Código
#!/bin/bash
################################################################################
# AUTOR: Dario A. Rodriguez #
# Convierte los ficheros MP3 de un directorio a WAV usando ffmpeg #
################################################################################
if [ $# -eq 0 ]
then
FILES=`ls --color=never ./*.mp3`;
else
case $1 in
"-h")
echo "USAGE:"
echo " mp32wav <file1.mp3> [<file2.mp3> <file3.mp3> ...]"
echo " Transform all given files to WAV"
echo " mp32wav -f <text_file>"
echo " Transform all files listed in the given text file to WAV"
echo " mp32wav"
echo " Transform all the mp3 files in the directory to WAV"
echo " this is case sensitive (only mp3, not MP3)"
exit 0
;;
"-f")
FILES=`cat $2`
;;
*)
FILES="$*"
;;
esac
fi
for fn in $FILES
do
noextfn=${fn%.mp3}
newfn="${noextfn}.wav"
echo -e "\033[1m$fn\033[0m -------> \033[1m$newfn\033[0m"
ffmpeg -i $fn $newfn
done
Código
#!/bin/bash
################################################################################
# AUTOR: Dario A. Rodriguez #
# Convierte los ficheros WAV de un directorio a MP3 usando ffmpeg #
################################################################################
if [ $# -eq 0 ]
then
FILES=`ls --color=never ./*.mp3`;
else
case $1 in
"-h")
echo "USAGE:"
echo " wav2mp3 <file1.mp3> [<file2.mp3> <file3.mp3> ...]"
echo " Transform all given files to MP3"
echo " wav2mp3 -f <text_file>"
echo " Transform all files listed in the given text file to MP3"
echo " wav2mp3"
echo " Transform all the mp3 files in the directory to MP3"
echo " this is case sensitive (only wav, not WAV)"
exit 0
;;
"-f")
FILES=`cat $2`
;;
*)
FILES="$*"
;;
esac
fi
for fn in $FILES
do
noextfn=${fn%.wav}
newfn="${noextfn}.mp3"
echo -e "\033[1m$fn\033[0m -------> \033[1m$newfn\033[0m"
ffmpeg -i $fn $newfn
done


 
  




 Autor
 Autor
		




 En línea
									En línea
								


