HydrogenAudio

Lossy Audio Compression => MP3 => Topic started by: Klymins on 2024-04-16 10:10:46

Title: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 10:10:46
Hello. MP3 does not support 18kbps and 20kbps but Adobe Flash CS6 can encode 20kbps, and Adobe Media Encoder CS6 can encode 18kbps and 20kbps. How this is possible? And, is encoding 12kbps (and maybe 10kbps and 14kbps) possible with this way while it's not supported? If yes, which encoder can export (preferably good quality) sound with 8-10-12-14kbps range? (16kbps sounds very good if it's encoded with Adobe Flash CS6 but 8kbps does not sound very good.) My target sampling rate is 11025Hz and i'm targeting CBR Mono.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Case on 2024-04-16 10:45:37
Those Adobe tools aren't limited to MP3. They support newer AAC audio format. The HE-AAC format they support is meant for low bitrate use and beats MP3 hands down.
There are multiple HE-AAC audio encoders. And there is newer option, xHE-AAC. And you could try open Opus format too.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 11:10:20
Thanks Case, but i want to use MP3 in most cases. Plus, these codecs are not supported for most tasks including Adobe Flash. Plus, MP3 is very flexible: supports mono and stereo in one file, can be edited with notepad (you can combine two MP3's with notepad and they will play), very strong (stays playable even after being distruptively edited by notepad) and more.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 11:24:46
Now i'm tried opus and it sounds horrible for 16kbps and 8kbps compared to MP3. Also it does not support 11025Hz, 22050Hz, and 44100Hz while these are my target sampling rates.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: maikmerten on 2024-04-16 17:33:11
Now i'm tried opus and it sounds horrible for 16kbps and 8kbps compared to MP3. Also it does not support 11025Hz, 22050Hz, and 44100Hz while these are my target sampling rates.

That's very unexpected. Opus should do *much* better than MP3 at such exceedingly low bitrates. Do you have an example file to toy around with?

Edit: If you happen to encode with ffmpeg: Don't use the interal Opus encoder, use libopus.

Edit2: One can encode non-standard bitrates in MP3 in "free format" mode. For instance "lame -b 18 --freeformat music.wav freeformat.mp3". This is, however, non-standard and needs a supporting decoder. This throws away most of the compatibility benefit MP3 has.

Edit3: Also, of course, one can do ABR-encoding with a bitrate target of 18 or 20 kbps.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 17:52:40
Now i'm tried with libopus and it is still terrifying. MP3 is bad for 8kbps too, but looks like opus is worse for music. I guess it can be better for voice. AAC, on the other hand, sounds like a bit better than MP3. I'm going to upload a first few seconds of my test files.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 17:58:57
Files: https://drive.google.com/drive/folders/1dr3cROqsDJUERHuLtVpWB1CS_iW-UPz7?usp=drive_link MP3 is encoded by Adobe Flash CS6, Opus encoded by Shotcut libopus. Fair use audio credit: NemesisTheory
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-16 18:02:33
By the way, these 20kbps MP3 files are marked as 24kbps and Flash Player plays them without a problem. 18kbps files are marked as 16kbps.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-16 23:41:15
@Klymins, when people ask about extremely uncommon things without giving a use case where such things would seem appropriate, there is a temptation to assume that the person is solving an XY problem (https://www.google.com/search?q=xy+problem), e.g. how to hammer nails with a microscope. Could you explain why a specific bitrate, CBR mode and mono sound are important to you?

Take, for example, the point-n-click adventure game Broken Sword (1996), where the audio is mostly stored as 11025 Hz 16 bit mono. I'm going to compress a fragment, which contains speech and music, using Fraunhofer (https://www.rarewares.org/rrw/mp3enc.php) 3.1 (CBR), GXLame (https://hydrogenaud.io/index.php/topic,80509.msg767867.html#msg767867) 5.3 (CBR & VBR), Helix (https://www.rarewares.org/mp3-others.php#helix_enc) 5.2.3 (VBR with forced resampling to 22.05 kHz), and Vorbis Aotuv (https://www.rarewares.org/ogg-oggenc.php#oggenc-aotuv) 6.03 (VBR).

(https://i2.imageban.ru/out/2024/04/17/cd6d9569fc0e2e30653c457d343df019.webp)

Code: [Select]
$ mp3enc.exe -br 24000 -esr 11025 -if history.wav -of history.frau.11khz.cbr.br24000.mp3
$ gxlame.exe -b 24 -h history.wav history.gxlame.11khz.cbr.b24h.mp3
$ gxlame.exe -V# -h history.wav history.gxlame.11khz.vbr.v#h.mp3 (# = 24, 32, 40)
$ hmp3.exe -V24 history.wav history.helix.22khz.vbr.V24.mp3
$ oggenc2.exe history.wav -q # -o history.aotuv.11khz.vbr.q#.ogg (# = -1, 0, 1)

  Bytes    Kbps   Filename                      
 -------- ------ -------------------------------
  34 913   17     history.aotuv.vbr.q-1.ogg     
  37 599   18     history.gxlame.vbr.v24h.mp3   
  41 814   20     history.gxlame.vbr.v32h.mp3   
  47 330   22     history.gxlame.vbr.v40h.mp3   
  50 173   24     history.aotuv.vbr.q0.ogg      
  50 648   24     history.gxlame.cbr.b24h.mp3   
  51 095   24     history.frau.cbr.br24000.mp3 
  51 584   25     history.helix.vbr.V24.mp3     
  56 562   27     history.aotuv.vbr.q1.ogg
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: danadam on 2024-04-17 01:20:22
Opus encoded by Shotcut libopus.
Doesn't look like libopus:
Code: [Select]
]$ opusinfo lo2.opus
...
Encoded with Lavf58.29.100
User comments section follows...
        encoder=Lavf58.29.100
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Case on 2024-04-17 06:38:46
I shouldn't have suggested Opus, I didn't remember that it's not meant for such low bitrates. It's indeed horrible at ultra low bitrate, mp3 is muffled but Opus is metallic and glitchy. The Xiph's recommended settings page (https://wiki.xiph.org/Opus_Recommended_Settings) thinks Opus starts beating MP3 and others at around 64 kbps.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 10:20:28
@Kraeved In fact, CBR is not necessary (i want it because it's easier to work with it) but i want mono because i think stereo is not going to be sound good below 20kbps or 16kbps. And, i already can produce a good quality sound with 16kbps, the reason that i want to use below is: can i make a good sound with these bitrates? 20kbps stereo sounds good and 16kbps mono sound better than it, so i thinked lower bitrates must be able to produce good sounds. @danadam You can be right, i selected libopus from shotcut but i don't trust it.

And, i must use MP3 because Flash Player does not support these newer alternatives even if some of them can sound better.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Case on 2024-04-17 10:33:03
You do realize that Flash is dead and buried?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 10:33:43
@Klymins, Is it a matter of disk space or bandwidth ?   If not then why not :
Create a preset in foobar2k :  source to output = WAV
Add these DSP's:
> re sampler=44.1
> convert mono to stereo

Then in CS6, encode the new WAV's as mp3 cbr 112 or 128
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 10:35:51
@Case I realize Flash is not supported anymore but this is not a reason for me to stop using it. @shadowking i can't understand, sorry, can you explain a little more?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 11:02:21
@Case I realize Flash is not supported anymore but this is not a reason for me to stop using it. @shadowking i can't understand, sorry, can you explain a little more?

Scale input to 2ch stereo-16bit-44.1khz. That way you are dealing with stereo 44.1 and encode to 128k etc.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 11:03:04
@shadowking What is the advantage of this?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 11:09:38
@shadowking What is the advantage of this?

I thought it would be more compatible.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-17 11:19:08
@Klymins, it seems to me that you have fallen into the trap of premature optimization (https://www.google.com/search?q=premature+optimization) and are overzealous in trying to reduce the bitrate while maintaining the quality. Make minimum viable product (https://en.wikipedia.org/wiki/Minimum_viable_product) first, get some feedback, and then decide whether it's worth getting carried away with such a, cough, fine-tuning.

From my table (https://hydrogenaud.io/index.php/topic,125810.msg1043055.html#msg1043055), it should be obvious that the relationship between bitrate and space taken is extremely small at this scale (a few kilobytes), but the difference by ear between 16 and 24 kpbs is quite noticeable (download and listen to “Broken Sword - History” samples if you haven't done so yet). There are reasons why bitrate is usually associated with powers of 2 (https://superuser.com/questions/465657/why-are-mp3-bitrates-usually-multiples-of-32-powers-of-2), more common bitrates are much more likely to have psychoacoustic enhancements, etc.

Therefore, I suggest following the KISS (https://en.wikipedia.org/wiki/KISS_principle) principle, i.e. keeping it simple unless you have no choice, and using one of the above-mentioned encoders (three for MP3, one for Vorbis OGG) without lowering the bar below 24 kpbs and giving priority to mono — the mankind has listened to this quality (https://downloads.khinsider.com/game-soundtracks/album/broken-sword-shadow-of-the-templars) for decades (double the bitrate for stereo (https://hydrogenaud.io/index.php/topic,119708.msg989413.html#msg989413)), and some still listen to it on smartphones and boomboxes, not to mention it will pair well with a, cough, vintage Flash technology.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 11:33:22
@shadowking I don't think it will be more compatible but thank you anyway. @Kraeved No, i don't think i'm overcomplicating it. If i can produce for example 12kbps mono with a good quality, this will not complicate the output SWF file, this will just complicate the production of the file. And, disk space is important for me. My output SWF files must not be bigger than roughly 1 or 2 megabytes. 24kbps is too high for me, 16kbps is already my standard (most flash games used 16kbps sounds and they were sounded very well). I can do the minimum viable product already.  I'm just thinking: can I do better?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 11:43:01
lame -b16 -mm --resample 11 *.wav

Its working here fine. Lame 3.100.1
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: jaybeee on 2024-04-17 11:52:53
@Klymins is the purpose to listen to music for personal enjoyment?
Or is this for some project you're working on to create low bitrate audio that is acceptable for the project?

If it's the former then I cannot understand why you'd want to go so low with the bitrate when the audio is clearly so much worse than the lossless source; i.e. it is not transparent at all and unless one has a hearing issue (maybe you have?), then it seems nonsensical to me.

I have some aac music audio files that were encoded by someone else at ~64kbps and they sound very good for such a low bitrate (the excellence of modern codecs at low bitrates shines). But for personal listening (via my mobile using headphones and also connected in my car) I use Apple aac (qaac) with (T)VBR q64 which aims for 128kbps. But I dare say aiming for 64kbps for me would be acceptable in the car for instance.

Of course, there's no issues in discussing this desire for such low bitrates in an mp3 for example and it's an interesting subject. I'm just confused as to why - if it is indeed for music listening pleasure - you'd want to go so low when you'd almost certainly be able to ABX between it and the source lossless files... and between say even 64kbps mp3s and aacs.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 12:01:20
@jaybeee The purpose is putting audio files insisde Flash movies but 16kbps mono 11025Hz MP3 sounds very fine to listen with linear interpolation. It sounds like a junk only with stronger interpolations, and this is not a problam as Flash Player uses linear interpolation.

16kbps MP3 is much easier to listen for me because it's "simplified" by the MP3 algorithm and high frequencies are in relationship with low frequencies as they are just reflections. 11025Hz is a magical sampling rate for me. And, i don't have any hearing issues, my both ears can hear higher than 16kHz.

I can accept a little bit lower quality than 16kbps MP3 by Adobe Flash CS6 and if this quality can be achived with ~12kbps that will be good for me because this means i can use more/longer musics.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 12:12:17
In foobar2k, create a preset for lame mp3 with the following command:

lame -b16

Then add dsp in converter preset options:
-resampler(dbpoweramp) = 11.25k
-downmix stereo to mono

This has given me a mono 16k cbr mp3 file tested OK with speech.  8k was too low quality for me.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 12:24:39
I prefer Adobe Flash CS6 for 16kbps.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 12:26:25
18 is out of spec so must be freeformat. I remember years ago there was this fhg encoder that did 144cbr etc and it was a playable cbr file not freeformat. Maybe that is what cs6 is doing @ 18..20
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 12:33:38
144kbps is inside of specs. Anyway, how can i get ~12kbps that works with Flash Player?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 12:48:50
lame --freeformat -b12 -mm --resample 11
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 12:54:34
Which LAME version is recommended? (I didn't like LAME's sound color in my tries. I used Shotcut.)
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: shadowking on 2024-04-17 13:53:28
Which LAME version is recommended? (I didn't like LAME's sound color in my tries. I used Shotcut.)
3.100.1 ,  BTW you add -q6 or -q7 to see if sounds better.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-17 14:24:23
lame --freeformat -b12 -mm --resample 11

Why do you keep pushing that devilish freeformat? Do you know many players that can decode (https://hydrogenaud.io/index.php/topic,95177.msg796741.html#msg796741) it? MPV that utilizes mpg123 (https://www.mpg123.de/) — yes. 1by1, AIMP, FFPlay, Foobar2000, MPH-HC, Resonic, Winamp, XMPlay, you name it, let alone web-browsers — no. It's an optional part of the spec, an experiment that has not received recognition if you will.

Which LAME version is recommended? (I didn't like LAME's sound color in my tries. I used Shotcut.)

(https://i6.imageban.ru/out/2024/04/17/4d90b3c465d9e4e34c9809ad2d76c77c.png)

Shotcut is a video editor, not an audio encoder. In case of exporting your project to MP3, it can utilize either LAME (libmp3lame) or MediaFoundation (mp3_mf) encoders of the bundled FFMPEG. By the way, they use the outdated version 5.1.2-9, whereas the current one is 7.0. It seems you tried its non-optimal options (e.g. they don't offer 24 kHz sample rate, but offer a pointless 1 Mbps bitrate), and then decided to puzzle us with the question what to do next. And I've already answered you by listing encoders (https://hydrogenaud.io/index.php/topic,125810.msg1043055.html#msg1043055) that work well with low bitrates. Why don't you try them?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 14:47:12
@Kraeved How can i run GXLame or Helix? Double clicking did not do anything and i don't know how to specify filenames etc.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-17 16:57:32
@Klymins There is no substitute for hours of practice if you are going to create a convincing reproduction of any famous painting. The same applies to audio conversion. There are many free and commercial apps (Xrecode, dBpoweramp, Foobar2000 to name a few) with tons of options. But there is not a single app with a single “Do it” button that could solve your specific task of creating a good-sounding copy with a minimum size in MP3 format. Such apps exist only for the most common tasks, for example, to convert FLAC into high quality MP3. This means that one way or another you will have to work hard, step by step figuring out the purpose of each option, gradually building a chain of commands that will lead you to the long-awaited result. At this stage, it seems you are faced with the fact that you do not know how to use command line apps (such as audio encoders GXLame and Helix) that do not have their own window. But the thing is, all audio encoders are inherently windowless, so you have to learn that first.

Eventually, you'll end up with a more or less similar chain of commands that I used here to convert bee.FLAC (https://helpguide.sony.net/high-res/sample1/v1/en/index.html) 96000 Hz 24 bit stereo into bee.WAV 11025 Hz 16 bit mono, and then to bee.MP3 using GXLame 5.3 with options --abr 16 -h. The 16.6 kbps result sounds clear enough and it is hardly possible to do better. As a bonus, I attach a 15.5 kbps fragment from the Gladiator (https://hydrogenaud.io/index.php/topic,123331.msg1042830.html#msg1042830) soundtrack.

(https://i4.imageban.ru/out/2024/04/17/b1e349731dcb932184e8100a9364c25d.png)
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: fooball on 2024-04-17 17:00:24
@Kraeved How can i run GXLame or Helix? Double clicking did not do anything and i don't know how to specify filenames etc.
Run them in a command terminal at a command prompt, not from a GUI.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 17:34:19
Which command line commands will run these functions? I think they must be different for each encoder, right?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-17 17:46:16
Which command line commands will run these functions? I think they must be different for each encoder, right?
The commands for encoders and the sound they produce are here (https://hydrogenaud.io/index.php/topic,125810.msg1043055.html#msg1043055) and there (https://hydrogenaud.io/index.php/topic,125810.msg1043126.html#msg1043126).
You have no other choice but to read more carefully, because everything you need to know has already been said above.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-17 18:20:59
I missed, thanks. I will try in soon.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 09:38:52
@Kraeved Now i tried GXLame and Helix but they did not give ~12kbps. GXLame gave ~16kbps and helix gave ~20kbps + helix gave 22050Hz. MP3ENC looks like not free and looks like it's payment system is down. What can i do?

Commands:
hmp3.exe -V12 hmp3.wav hmp3.v12.mp3
gxlame-t5.3.exe -b 12 -h gxl.wav gxl.mp3
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-18 11:51:31
Now i tried GXLame and Helix but they did not give ~12kbps.

gxlame.exe --abr 12 -h in.wav out.mp3

Code: [Select]
GXLame-t5
CPU features: MMX (ASM used), SSE (ASM used), SSE2
Using polyphase lowpass filter, transition band:  5379 Hz -  5513 Hz
Encoding history.wav to history.mp3
Encoding as 11.025 kHz single-ch MPEG-2.5 Layer III (14.7x) average 12 kbps qval=0
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
   324/324   (100%)|    0:00/    0:00|    0:00/    0:00|   56.994x|    0:00
  8 [169] *********************************************************************
 16 [138] *********************************************************
 24 [ 13] ******
 32 [  4] **
 40 [  0]
 48 [  0]
 56 [  0]
 64 [  0]
-------------------------------------------------------------------------------
   kbps       mono %     long switch short %
   12.3      100.0        90.1   5.6   4.3
Writing LAME Tag...done
ReplayGain: -0.2dB
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 12:48:31
@Kraeved Much thanks. So, is manually setting the cutoff frequency possible with this? I wrote "--lowpass 3500" but this also changed the sampling rate to 8000Hz. It must be 11025Hz otherwise i can't import this file to Flash. Also, can this tool make 12kbps CBR (18kbps and 20kbps files were CBR)?
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-18 13:33:47
RTFM (https://en.wikipedia.org/wiki/MP3#Bit_rate) #1

Quote
MPEG-1 Audio Layer III: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 kbps
MPEG-2 Audio Layer III: 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 kbps
MPEG-2.5 Audio Layer III: 8, 16, 24, 32, 40, 48, 56 kbps

These are the bitrates for MP3 CBR mode. There is no 12 kbps among them. Thus, to get 12 kbps file, which can be played back on a wide range of audio equipment, you have no choice but to use VBR mode (or ABR as a variation of it) so that some of the data is compressed at a lower bitrate and some of the data is compressed at a higher bitrate, producing the output that is as close as possible to the bitrate you specified.

RTFM (https://svn.code.sf.net/p/lame/svn/trunk/lame/USAGE) #2

Quote
If not specified, LAME may sometimes resample automatically when faced with extreme compression conditions (like encoding a 44.1 kHz input file at 32 kbps).  To disable this automatic resampling, you have to use --resample to set the output samplerate equal to the input samplerate.  In that case, LAME will not perform any extra computations.

gxlame.exe --abr 12 -h --lowpass 3500 --resample 11025 in.wav out.mp3

Code: [Select]
GXLame-t5
CPU features: MMX (ASM used), SSE (ASM used), SSE2
Using polyphase lowpass filter, transition band:  3423 Hz -  3556 Hz
Encoding history.wav to history.mp3
Encoding as 11.025 kHz single-ch MPEG-2.5 Layer III (14.7x) average 12 kbps qval=0
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
   324/324   (100%)|    0:00/    0:00|    0:00/    0:00|   60.240x|    0:00
  8 [170] *********************************************************************
 16 [137] ********************************************************
 24 [ 15] *******
 32 [  2] *
 40 [  0]
 48 [  0]
 56 [  0]
 64 [  0]
-------------------------------------------------------------------------------
   kbps       mono %     long switch short %
   12.3      100.0        90.1   5.6   4.3
Writing LAME Tag...done
ReplayGain: -0.2dB
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 13:48:22
@Kraeved So, how 18kbps and 20kbps files are CBR and they are working with Flash Player? I'm uploading a 20kbps file example... (it's here too: https://drive.google.com/drive/u/1/folders/1dr3cROqsDJUERHuLtVpWB1CS_iW-UPz7)
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: AiZ on 2024-04-18 14:06:41
Hello,

Your example file has an even number of 16kbps and 24kbps frames, averaging to 20kbps.

    AiZ
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 14:10:52
@AiZ How can i get this with ~12kbps (ABR does not do that)? And, which program is shown in this screenshot? Addition: By "ABR does not do that", i mean: Let 8kbps frames be letter A and 16kbps ones B. ABR does something like "ABABBAABBABAABABBA" but i want "BABABABABABABABA".
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-18 15:28:52
So, how 18kbps and 20kbps files are CBR and they are working with Flash Player? I'm uploading a 20kbps file example...

What makes you think it's 20 kbps CBR? Because some player told you so? Have you ever thought of double-checking this value via others apps? Especially via apps that are designed to analyze media files? It is not a CBR file, but a VBR (or ABR) file without a proper header, which data is encoded using 16 kbps and 24 kbps, so it gives an average of 20 kbps, since (16×9+24×9)/18=20.

Code: [Select]
$ mediainfo.exe google.mp3

Audio
Format                                   : MPEG Audio
Format version                           : Version 2.5
Format profile                           : Layer 3
Bit rate mode                            : Variable
Channel(s)                               : 1 channel
Sampling rate                            : 11.025 kHz
Compression mode                         : Lossy
Stream size                              : 2.29 KiB (100%)

$ mp3val.exe google.mp3

WARNING: VBR detected, but no VBR header is present. Seeking may not work properly.
WARNING: No supported tags in the file
INFO: 18 MPEG frames (MPEG 2.5 Layer III), no tags, no VBR header

$ mp3packer.exe -i google.mp3

INFO:
 MPEG2.5 layer 3
 18 frames
 11025 Hz
 Bitrate distribution:
   16: 9,0
   24: 9,0

$ mp3guessenc.exe -f google.mp3

Frame histogram
  16 kbps :  9 (50.0%), size distr: [ 9 x 104 B]
  24 kbps :  9 (50.0%), size distr: [ 9 x 156 B]
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 16:26:12
@Kraeved I can't say this is VBR or ABR because frame bitrates are selected automatically, not via an algorithm that looks at the contents of this file. I think more than a variable bit rate is required to say it is VBR or ABR. As i said already: Let 8kbps frames be letter A and 16kbps ones B. ABR does something like "ABABBAABBABAABABBA" but i want "BABABABABABABABA". And, my 12kbps files must be marked as CBR even if they are VBR actually. Addition: I also want the additional 4kbps in 16kbps frames to go to the 8kbps frames in a normal sequence via bit reservoir, so it can be really 12kbps.

Addition: I was already sure there is some interesting stuff as foobar2000 says it's 24kbps and it's shorter than actually it is, and i was thinked it is 24kbps at first, but these are still not a reason for me to say it's VBR or ABR per above.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-18 17:26:29
(https://i4.imageban.ru/out/2021/06/20/4c362c4619374a888fb04e5ebfe03263.png)

@Klymins You came to the audiophile forum for advice on how to solve the problem of audio compression. This means that you do not have enough personal knowledge to solve it. People who know how to solve such problems spent a lot of time and came to the conclusion that there were very few solutions, then they offered the optimal one.

This command (https://hydrogenaud.io/index.php/topic,125810.msg1043180.html#msg1043180) creates an audio file that meets the specifications, users can listen to it even in the browser and it can be used with Flash. Instead of being satisfied with it, you continue to bend your will and demand attention to increasingly bizarre requirements, trying to achieve what is impossible with MP3.

After all, if you're looking for a way to be smarter than established audio encoders and reshape their audio output to your whims, you need a hacker forum. And here your persistence has already grown into annoying stubbornness.

Finally, it makes sense to try the latest version of LAME (today it is 3.101 beta 3 (https://www.free-codecs.com/lame_encoder_download.htm)) and compare the sound.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-18 18:01:24
Okay, sorry for my stubbornness, anyway, thanks for recommending GXLame, it is useful.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Kraeved on 2024-04-20 22:37:49
Quote
Starting with Flash Player 9.0.115.0 and AIR 1.0, the runtime can play AAC files (AAC Main, AAC LC, and SBR). A simple optimization can be made by using AAC files instead of MP3 files. The AAC format offers better quality and smaller file size than the MP3 format at an equivalent bitrate. Reducing file size saves bandwidth, which is an important factor on mobile devices that don’t offer high-speed Internet connections. (Adobe Flash manual (https://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36ffa41af1243193910f-7ffc.html))

If your Flash app allows you to import AAC encoded audio files, then you may consider using them as well — you can get better sound quality at a size comparable to MP3. There are several encoders (https://wiki.hydrogenaud.io/index.php?title=AAC_encoders) and encoding modes, of which in this case I prefer FDKAAC (https://www.rarewares.org/aac-encoders.php) in LC and LC SBR modes. Also, if you feel uncomfortable using the full version of Fraunhofer's MP3 encoder, there is a demo (https://www.rarewares.org/rrw/mp3enc.php) version that allows you to encode up to 30 seconds, which is enough for, say, sound effects.

Source: history.wav (https://hydrogenaud.io/index.php/topic,116307.msg1043263.html#msg1043263) (16 seconds, 11025 Hz, 16 bit, mono)

Code: [Select]
rem Commands to encode
gxlame.exe --abr 12 -h history.wav out.gxlame.mp3
mp3enc.exe -br 12000 -esr 11025 -bw 11025 -if history.wav -of out.frau.mp3
fdkaac.exe -b 12 history.wav -o out.fdk.lc.m4a

rem AAC LC with SBR is not happy about 11025 Hz, because it needs some headroom to work magic, so we have to upsample
ffmpeg.exe -i history.wav -af aresample=32000:resampler=soxr:precision=28:cutoff=0.95 -bitexact history.32khz.wav
fdkaac.exe -p 5 -b 12 history.32khz.wav -o out.fdk.lc-sbr.m4a

rem We can shave a few bytes here and cover up the metadata
mp4box.exe -time 0 -mtime 0 -keep-utc -tight -no-iod -add out.fdk.lc.m4a -new out.fdk.lc.v2.m4a
mp4box.exe -time 0 -mtime 0 -keep-utc -tight -no-iod -add out.fdk.lc-sbr.m4a -new out.fdk.lc-sbr.v2.m4a

  Bytes    Kbps   Filename           
 -------- ------ --------------------
  25 548   12.0   out.frau.mp3       
  26 208   12.3   out.gxlame.mp3     
  26 923   12.7   out.fdk.lc.m4a     
  27 386   12.9   out.fdk.lc-sbr.m4a
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-21 21:05:22
Thanks, but i can't import AAC files. Also, i think that must be limited to web because SWF SPEC 19 (https://open-flash.github.io/mirrors/swf-spec-19.pdf) says only these codecs are supported: Uncompressed native endian, ADPCM, MP3, Uncompressed little endian, NellyMoser Asao, NellyMoser Asao 8kHz, NellyMoser Asao 16kHz, and Speex (somehow i also can't import or encode Sppex or NellyMoser Asao 8kHz or 16kHz with Flash).
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Case on 2024-04-22 08:42:29
Flash and SWF have supported HE AAC since version 9 (https://helpx.adobe.com/flash/kb/supported-codecs-flash-player.html), that was released in June 2006.
Title: Re: Low bitrate MP3 (+ unsupported bitrates)
Post by: Klymins on 2024-04-23 09:52:55
@Case Looks like this works only with video, but thank you anyway.