Конвертировать mp3 в ogg vorbis

16884
Michiel de Mare

Есть ли утилита командной строки для преобразования mp3-файлов в ogg vorbis, которую я могу установить с помощью apt-get?

В качестве альтернативы, есть ли расширение для nginx, чтобы я мог указать ему каталог с mp3-файлами, и он будет обслуживать файлы ogg на лету?

9

2 ответа на вопрос

25
evilsoup

ffmpeg (or more likely the fork avconv if you're using Debian or Ubuntu - these instructions should apply equally to both, though nobody knows how far apart they may drift in the future) should be in the repositories of your distro.

ffmpeg -i input.mp3 -c:a libvorbis -q:a 4 output.ogg 

To do a whole directory full of MP3s:

for f in ./*.mp3; do ffmpeg -i "$f" -c:a libvorbis -q:a 4 "$"; done 

Recursively, with find:

find . -type f -name '*.mp3' -exec bash -c 'ffmpeg -i "$0" -c:a libvorbis -q:a 4 "$"' '{}' \; 

Set the output quality by adjusting the value of -q:a: for this codec the range is 0-10 and higher gives better quality.

On older versions of ffmpeg, you may need to use -acodec and -aq instead of -c:a and -q:a.

Of course, converting from one lossy format to another is not ideal; but such is life.

Для параметра качества более высокое число дает лучшее качество. Смотрите здесь: http://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide Christian Long 10 лет назад 1
Это работа, спасибо! Chu-Saing Lai 9 лет назад 0
Супер - пупер, спасибо. Очень полезно в таких случаях, как этот https://github.com/nwjs/nw.js/issues/4687 loretoparisi 8 лет назад 0
Подтверждено: использование этих параметров с avconv действительно работает. Отличный ответ. aggregate1166877 7 лет назад 0
3
Sven

В Debian быстрый поиск с помощью aptitude показал мне пакеты mp32ogg и dir2ogg. Посмотрите, может быть, они делают то, что вам нужно.

Похожие вопросы