Audio conversion (mp3 to ogg)

From Biowikifarm Metawiki
Jump to: navigation, search

ffmpeg

Usually ffmpeg takes care of the right library to use for conversion and the following should work:

ffmpeg -i  file.mp3 file.ogg

However there exist different version. On https://biowikifarm.net version 0.8.17-6 does not convert properly.

ffmpeg -version
# ffmpeg version 0.8.17-6:0.8.17-1, Copyright (c) 2000-2014 the Libav developers

You have to specify the properties in detail to get a functioning ogg-audio file:

ffmpeg -i  file.mp3 -acodec libvorbis file.ogg # use libvorbis to convert 
ffmpeg -i  file.mp3 -y -acodec libvorbis file.ogg # -y add overwrite mode
ffmpeg -i  file.mp3 -y -qscale:a 8 -acodec libvorbis file.ogg # -qscale:a add quality setting (range: poor 1-10 best)

# use a loop to convert multiple mp3
# ffmpeg version 0.8.17-6:0.8.17-1, Copyright (c) 2000-2014 the Libav developers
# -y overwrite, -acodec audio codec, -qscale:a quality scale for audio
for mp3 in *.mp3;
  do ffmpeg -i "${mp3%.*}.mp3"
  -y \
  -acodec libvorbis \
  -qscale:a 8 \
  "${mp3%.*}.ogg";
done

See also Selected Linux commands for finding files.

Information about audio file

When an ogg file is converted to flac it does not play natively in Firefox it should be converted using above libvorbis. So the following gets information on the audio file:

ffprobe "Corvus_brachyrhynchos_call.ogg" 2>&1 | grep --ignore-case 'Stream.*audio'
#    Stream #0:0: Audio: flac, 22050 Hz, mono, s16