Skip to main content

Notice

Please be aware that much of the software linked to or mentioned on this forum is niche and therefore infrequently downloaded. Lots of anti-virus scanners and so-called malware detectors like to flag infrequently downloaded software as bad until it is either downloaded enough times, or its developer actually bothers with getting each individual release allow listed by every single AV vendor. You can do many people a great favor when encountering such a "problem" example by submitting them to your AV vendor for examination. For almost everything on this forum, it is a false positive.
Topic: Predict filesize of encode (Read 11797 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.

Edit:
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):
https://www.ffmpeg.org/ffmpeg-codecs.html#Options-15

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?


Quote
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 :-)

 
SimplePortal 1.0.0 RC1 © 2008-2021