Supongo que ya casi todos, sabréis que la supremacía en cuanto a compresión-calidad en formatos de audio, la tiene OGG Vorbis™.
Además de las ventajas de ser un formato libre y sin patentes, algo que le hace ganar frente a otros formatos como MP3 el cual posee una licencia y patentes.
Pero como todo en esta vida, es lo más expandido, por ello actualmente hay aún dispositivos que no poseen compatibilidad con OGG Vorbis™ (no obstante van aumentando).
Para aquellos dispositivos que solo leen MP3, necesitamos siempre convertir nuestros archivos.
Para ello podemos usar ffmpeg:
ffmpeg -i INPUT.ogg -ab 128000 OUTPUT.mp3
La transformación directa con este en muchos casos es efectiva.
No obstante a mi me causo estragos en el archivo, así que decidi buscar por internet otra forma, llegando a mi un bonito script del 2005, no obstante esa versión aunque sin muchos fallos, no me satisfacía, así que me dispuse a hacerle cuatro cambios, adaptándolo más a mis gustos.
Copyright 2009 Mephiston
Este programa es software libre, puedes redistribuirlo y/o modificarlo bajo los terminos de la GNU General Public License publicada por la Free Sofware Foundatio ya sea la versión 2.0 de la Licencia o
(a tu decisión) cualquier versión posterior.
Este programa esta distribuido con la esperanza de ser de utilidad, pero SIN NINGUNA GARANTÍA; incluso sin la garantía implícita de COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.
Ver la GNU Public License para más detalles
# ogg2mp3-lame written in bash
# version 0.2
# Copyright 2009 Mephiston
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2.1.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, get a copy on http://www.gnu.org/licenses/gpl.txt
# —————- Utilidades generales —————- #
# El proposito principal de este script es el convertir archivos OGG a MP3 con normalización incluida.
# Debido a que algunos dispositivos solo son capaces de reproducir OGG.
# Este script además automatiza la conversión haciendo un conversionado de todos los archivos OGG del directorio actual.
# —————- Instructiones —————- #
# Para poder usar este script debeís usar un sistema derivado de Unix i GNU/Linux
# Además requiere tener instalado bash, lame, oggdec, y normalize-audio.
# Os aconsejo dejarlo en algún lugar de vuestro PATH.
if [ -z "$1" ]
then
value=160
valuet=$(( ($value*1000) ))
#If bitrate is not specified will use
mensaje=”Bitrate value not supplied. Default: 160kbps.”
mensaj=”Note: If you want to specify some specify bitrate in kbps, just write something like ‘ogg2mp3 120 ‘”
else
value=$1
valuet=$(( ($1*1000) ))
mensaje=”Bitrate value suplied. Using $value”
mensaj=”"
fi
if ! which oggdec &>/dev/null; then
echo “ogg2mp3: You must install first ‘vorbis-tools’”
elif ! which lame &>/dev/null; then
echo “ogg2mp3: You must install first ‘lame’. ”
elif ! which normalize-audio &>/dev/null; then
echo “ogg2mp3: You must install first ‘normalize-audio’. ”
else
echo “———————————”
echo “| ogg2mp3-lame v0.2 BASH VERSION|”
echo “| Author: Mephiston |”
echo “———————————”
#Lowercasing names
rename ‘y/A-Z/a-z/’ *.ogg
#Erasing spaces between words
rename ‘y/ /_/’ *.ogg
#Converting ogg files to wav format.
echo $mensaje$mensaj && sleep 3
for archivo in *.ogg; do oggdec $archivo; done
#If you don’t want to normalize audio, just comment this line’
normalize-audio -m *.wav
for archivo in *.wav; do
#A variable, for giving name to files
wavname=”$(basename “$archivo” .wav)”
#Now it checks if bitrate is supplied.
#If not supplied it will use a default value.
lame -b $valuet “$wavname.wav” “$wavname.mp3″
#Now it checks if exists some errors.
#If all is correct delete the wav.
if [ $? -eq 0 ]
then
echo “File conversion with bitrate on $value finished”
echo “In the conversion we created temporaly WAV files”
echo “Do you want to delete WAV files? y/n”
read respuesta;
case $respuesta in
Y|y) rm -f “$wavname.wav”;;
S|s) rm -f “$wavname.wav”;;
*) echo “The files were not deleted”;;
esac
fi
done
fi
Y con esto ya podréis convertir toda vuestra música o audios, sin problema.
También lo podéis descargar de mi repositorio personal aquí, donde tengo también mis configuraciones de zsh, un cortador de urls, y temas/plugins de wordpress que voy modificando. Personalmente os recomiendo que vayáis vigilando el repositorio puesto que voy haciendo modificaciones y las suba allí.
Edit: El script se ha mejorado un poco, además he hecho una versión con zsh+ffmpeg y una con bash+ffmpeg.

