Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Predict filesize of encode (Read 13876 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Predict filesize of encode

I'd like to use Ogg at 64kbps (q=0) as an output format (for low data consumption). I'm currently writing an audio streaming client, and I need the estimated data size before streaming. It would be great if the prediction could be accurate to within a few kB. Is it possible to set up ffmpeg or SoX to encode into Ogg/CBR so I can calculate the exact file size?

I agree VBR would be the better option where quality is concerned, but VBR 64kbps doesn't mean that I actually get 64kbps in average. Sadly...

Or would ABR be an option?

Thank you!

Predict filesize of encode

Reply #1
-b 64 --managed -m 48 -M 76
or as
--bitrate=64 --managed --min-bitrate=48 --max-bitrate=76

This will encode with 64 kbps and with a minimal bitrate of 48 kbps and a maximum bitrate of 76kbps.
The managed mode is slower but VBR will be 'disabled' and the encoder stays between your required bitrate.

Of course in your case the minimal bitrate is not really necessary.
I would not use it or write --min-bitrate 0.

For ffmpeg use b (-b),  minrate (-m) and maxrate (-M):

Predict filesize of encode

Reply #2
Thanks a lot for you answer.

I tried the command but ffmpeg seems not to recognize the option "m" or "M". Did I miss something?

The command I used:
Code: [Select]
ffmpeg -i [input file] -b 64 -m 63 -M 65 output.ogg

Predict filesize of encode

Reply #3
I tried the command but ffmpeg seems not to recognize the option "m" or "M". Did I miss something?

libvorbis encoder wrapper.

Requires the presence of the libvorbisenc headers and library during configuration. You need to explicitly configure the build with --enable-libvorbis.

Predict filesize of encode

Reply #4
Hi, seems i read that wrong.
You have to use -minrate and not -m.

So here is how it works for me, try this:
ffmpeg -i test.wav -codec:a libvorbis -b:a 64k -minrate 63k -maxrate 65k test.ogg

If i check a file encoded with this parameters, MediaInfo shows me that the bitrate goes from 63-65 kbps.
AND always use libvorbis since the vorbis encoder in ffmpeg is really bad. Don't also forget to write 64k and not just 64 for 64 kbps or any other bitrate.

Grüße an die Schweiz :-)