Audio conversion (mp3 to ogg)

From Biowikifarm Metawiki
Revision as of 22:24, 21 January 2016 by Andreas Plank (Talk | contribs) (Created page with "== ffmpeg == Usually ffmpeg takes care of the right library to use for conversion and the following should work: <syntaxhighlight lang="bash"> ffmpeg -i file.mp3 file.ogg </s...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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