How to use ffmpeg to encode ogg audio files?

0

1

I want to convert the following simple oggenc command to use ffmpeg instead:

oggenc -b 8 input.wav -o out.ogg

From the ffmpeg libvorbis wrapper doc, it says,

The following options are supported by the libvorbis wrapper. The oggenc-equivalent of the options are listed in parentheses.

  b (-b)

Set bitrate expressed in bits/s for ABR. oggenc -b is expressed in kilobits/s.

But I just don't know how to apply it to ffmpeg, I've tried,

ffmpeg -i input.aac -c:a libvorbis -b 8 out.ogg
ffmpeg -i input.aac -c:a libvorbis b 8 out.ogg
ffmpeg -i input.aac -c:a libvorbis=b:8 out.ogg

but none is working as expected.

UPDATE: What I want to know is how to "translate" the options listed in ffmpeg (libvorbis wrapper) doc into ffmpeg command. I can get away with -ab switch to do the transcode, but I don't think it is the libvorbis wrapper specific options. So if you provide the answer, please provide the demo specifying all the following options as well.

b (-b)

q (-q)

minrate (-m)

maxrate (-M)

iblock

xpt

Posted 2016-09-06T01:43:01.837

Reputation: 5 548

If you want such a low bitrate why not use a more suitable format such as Opus? – llogan – 2016-09-06T04:50:17.117

@LordNeckbeard, is Opus widely supported, even on older version of Windows? – xpt – 2016-09-06T14:55:48.317

I don't use Windows often, and I don't know what Windows version(s) you are referring to, but I'd guess the answer is "no" for native support of both Opus and Vorbis unless you use VLC or some other sane player. – llogan – 2016-09-06T16:38:07.683

Answers

3

The answer is in your question:

oggenc option    corresponding ffmpeg option
-b               -b:a
-q               -q:a
-m               -minrate
-M               -maxrate

Example command

ffmpeg -i input.aac -c:a libvorbis -b:a 8k output.oga

If your desired value of 8k fails then use a higher bitrate or lower your audio sampling rate with -ar, such as -ar 8000.

Encoder and muxer info

You can see additional info and the single private option that is specific to this encoder with:

ffmpeg -h encoder=libvorbis

You can also get info about the muxer/output container format:

ffmpeg -h muxer=ogg

llogan

Posted 2016-09-06T01:43:01.837

Reputation: 31 929

Thanks. It'd be great if a full example of command-line is provided. And BTW, the answer is not in my question, as I don't know how you know minrate (-m) is just -minrate, not -minrate:a whereas b (-b) somehow magically becomes -b:a. Neither ffmpeg -h encoder=libvorbis, nor ffmpeg -h muxer=ogg, or the online-doc provide that info. – xpt – 2016-09-07T00:22:13.220

The documentation was probably written before some options got the ability to use stream specifiers. If you just use -b then ffmpeg will tell you to use -b:a instead. – llogan – 2016-09-07T05:19:00.737

2

This works for me:

ffmpeg -i test.aac -c:a libvorbis -b:a 64k test.ogg

I don't think 8kb/s is a valid value, but I could be wrong. :-)

bot1131357

Posted 2016-09-06T01:43:01.837

Reputation: 181

8kb/s is a valid value for vorbis/oggenc. that's why I'm using it, and your answer is not. Welcome abroad, BTW. – xpt – 2016-09-06T03:36:37.347

Consider adding -c:a libvorbis to your example, otherwise the flac encoder may be chosen by default instead (if you choose .oga which is typically for audio only). – llogan – 2016-09-06T04:44:17.837

Sorry I wasn't clear on what I want to know. OP updated. – xpt – 2016-09-06T15:06:44.547