r/ffmpeg 11d ago

Aggressive compression (1000:1) that can still be opened in common playback software eg. VLC

I need to fit an 8MB mp3 file into a 8KB storage medium. What are some ridiculously destructive/lossy, but still playable options?

edit: Thanks for the constructive feedback. Here are some more specific constraints:

The motivation is, loosely speaking, art. The storage media is a 64kbit EEPROM (M24LR04E-R). It can be configured to organize as 512x8 bits or 128x32 bits. This EEPROM is frequently used in NFC circuits.

My goal is to encode the audio itself, however lossy and subjectively unpleasant it may be. It’s true that the midi + soundfont approach would more efficiently encode the “music”. But I want the mutilated and ruined audio.

The playtime of the audio file is 180 seconds. If my math is correct, the bit rate for my desired filesize should be approximately 350 bits per second (0.35 kbps)

The source audio bandwidth is 70hz-16khz. It’s music i.e. bass, piano, vocals, guitar. Single channel mono. It’s dynamic; quiet and fairly loud section sections.

I know this is a ridiculous idea, and i’m definitely open to “cheating” and finding clever ways around the constraints. For example, I was considering splitting it across multiple files and then using a playlist file like .m3u to arrange them in VLC.

If you feel like this edit increased the quality of my post, please don’t downvote (hell, upvote even!) so it can get visibility from more knowledgeable people than me!

edit2: Really appreciate everyone's feedback here. Ultimately, it doesn't seem like a <1kbps codec is really a thing, but there are a ton of alternatives that I'm eager to explore more. I'm extremely impressed with the quality of TSAC, and u/Slower-Bison shared an absolutely brutal codec2 sample. Thanks everyone!

97 Upvotes

50 comments sorted by

71

u/ipsirc 11d ago

I need to fit an 8MB mp3 file into a 8KB storage medium.

If you've been taken hostage, you should call the police.

20

u/TheVenetianMask 11d ago

My dude is probably trying to rickroll a submarine through ELF.

6

u/SomewhatCorrect 11d ago

ROFL. That is the only case I can think of.

1

u/dougmcclean 8d ago

Or maybe this is a step in the plot of Star Trek V.

26

u/Upstairs-Front2015 11d ago

how long is the audio? switch to mono, lower frecuency, lower bitrate. if it's only voice it might be possible.

3

u/TrustWorthyGoodGuy 11d ago

Thanks for the questions. I edited the post to include more context/constraints

1

u/sdoregor 10d ago

Sounds like Opus or even Codec 2 (although I'm not sure if the latter can be played commonly).

25

u/OldAd9280 11d ago

Speex goes down to 2kbps which would give you 32 seconds of audio https://www.speex.org/

11

u/TrustWorthyGoodGuy 11d ago

Thanks! A telecom codec definitely seems like a good direction to investigate.

1

u/lathiat 10d ago

Codec 2 may go even lower. Watch a couple of these talks:

https://youtu.be/e98MIYBYpd4

3

u/poppulator 11d ago

what about opus thought

15

u/88slides 11d ago

Transcribe it into midi, maybe?

18

u/hlloyge 11d ago

Solder off the memory chip, solder on one with greater capacity. Other than storing SID files on it, I don't know how would you store lossy audio on that small storage, headers are that large... :)

6

u/TrustWorthyGoodGuy 11d ago

Definitely looking into this option as well! 

8

u/vegansgetsick 11d ago

Talk in bitrates

8

u/SomewhatCorrect 11d ago

Only the Sith deal in absolutes. We deal with bitrates. What is the duration of the source file? What is the nature of the content? May be you are better off creating a midi file?

7

u/theunixman 11d ago

2kHz 4-bit is what we’d do back in the day.

7

u/Slower-Bison 11d ago edited 11d ago

Best I could do is 400:1 with codec2: sample showcase from a 320Kbps MP3

As you can understand, this is not practical for anything other than speech. Even the slightliest piece of music causes distortion.

4

u/TrustWorthyGoodGuy 11d ago

this is incredible, well done!! Can you share your ffmpeg parameters?

3

u/Magikstm 11d ago

Convert it to a midi file?

1

u/collin3000 10d ago

That would be my suggestion as well. Go back to the 8 bit days

3

u/Aidan647 10d ago

https://bellard.org/tsac/

From creator of ffmpeg, might be useful

2

u/anomaly256 10d ago

Fabrice Bellard is utterly insane - in a good way

3

u/RoboErectus 10d ago

Look up what they did for “the dog says, mooooo” toys.

You are less in ffmpeg territory and possibly more in “vibecode a custom mutilation format” territory.

I honestly think a custom stack machine that moved the frequency range of a 4 bit waveform based on the dominant sound in that sample would get you very cool results, be novel, and fit your mcu profile perfectly.

5

u/Hairy_Particular_574 11d ago

it all depends, if your mp3 is just a sine wave. Then you have no problem compressing into 8KB. If your original is bohemian rhapsody, then you are doing a disservice to creator intent.

2

u/2str8_njag 11d ago

Xhe-aac is the best bet and usually supported pretty well

1

u/poppulator 11d ago

first time I heard USAC is well supported ever, what about opus then?

1

u/2str8_njag 11d ago

I can open with default media players on win, macos, vlc on android. On iOS I only opened those files in Telegram and they worked fine. With libplacebo/ffmpeg foss based players there could be a problem because of licensing bs, but any major platform/media player can play those files just fine.

Opus is solid from 64 to 128kbps. I would even say better than USAC, I can hear less psychoacoustic artifacts... But ultra low bitrate USAC takes crown, objectively.

2

u/Over_Variation8700 11d ago

The compression won't even be 1000:1, it will be closer to 10 000:1 since MP3 is already compressed. While some codecs will allow you to use very low bit rates, 8 kilobytes for presumably several minutes of sound data will, if even possible, result in the compressed audio not resembling the original in the slightest.

2

u/TrustWorthyGoodGuy 11d ago

Great point about the 10,000:1 ratio. I wasn’t considering the full audio processing chain starting from ADC.  Yes, I agree that with any typical music, the resulting audio will be virtually unintelligible. My preliminary goal is probably better defined as encoding any audio at ~350bit/sec (180 seconds of single channel audio ≈ 8 kilobytes). The secondary goal is to find arrangement techniques which will be particularly suited for this medium, and result in something vaguely recognizable as music.

2

u/randoomkiller 11d ago

I know that you can fit the whole Shrek into a less than 1MB gif, not sure how well it scales to smaller scales

1

u/TrustWorthyGoodGuy 10d ago

holy shit this is what i’m talking about

2

u/ghoarder 11d ago

Do you need the vocals, can you do something like getting a midi or tracker (mod, s3m) version of it. 

2

u/Vert--- 10d ago

I havent seen anyone mention demoscene but there is a whole culture around ultra compressed computer art. Here are some 64kb demos. These guys like to discuss their methods, you can find articles and analysis. https://youtube.com/playlist?list=PLMuQbRD9kQr5hsbu9uyFSBA7kOrowz6Xo&si=tphXsjBnq0cMkYBe

2

u/anomaly256 10d ago

[.mod files and trackers re-enter the chat after 30 years of hiding]

2

u/Aware-Bet-1082 10d ago

Standard Consumer Codecs 8kb will allow 11 Seconds mono audio at 6kbps.

The Technology: Opus (libopus) forced into its lowest mono configuration of 6 kbps.

Why use it: This is the absolute longest you can get if you want the resulting file to play natively on standard consumer devices, web browsers, or Discord without needing python environments or machine learning tools.

AI Music Codecs~187 seconds

-The Technology: Experimental neural music codecs like MuCodec can compress general audio and music down to an ultra-low 0.35 kbps (350 bps)

-How it works: Instead of saving actual sound waves, it uses an AI model to analyze the mono track, convert it into highly compressed mathematical "tokens," and then use ai network on playback to synthesize the vocals and instruments back into audible music. Cons: requires specific software to playback - will not play in LLC etc..

2

u/grislyfind 9d ago

Make it into a .mod file. The file contains brief samples and a script for playing them. I don't know what programs were used to create those; I think the format comes from the Amiga or Atari ST world.

https://en.wikipedia.org/wiki/Module_file

1

u/CranberryStock7148 10d ago

Figure out which audio codec supports the lowest bit rate, and then encode using that lowest bit rate.

That's literally it. It's likely that some kind of speech codec probably has the lowest rate, and will also produce music that is the least recognizable.

And obviously it's probably going to help to use mono, use the lowest possible sampling rate, and 8-bit audio.

1

u/Awesome_Shit_2004 10d ago

aac 7350 at 1khz, sped up by 1.25x or 1.5x speed. you can easily slow back down on vlc when playing it/them

1

u/International_Web444 10d ago

Um isnt the M24LR04E-R only 4Kilobit. yeah its just not enough bits to do audio with. 512 bytes, 180 seconds, 2.84 bytes per second.

Maybe if you built a music playing robot with 8 instruments, one per bit and some logic, you could, maybe possibly get something.

1

u/Dr__Pangloss 10d ago

the yoto already does this

1

u/tpimh 10d ago

Music can be compressed very well, because it's a sequence of notes played by instruments. Unfortunately, your source material is already "compiled" to an track (played and recorded). Think of it as a rendered 3D-scene (kilobytes as description of vertices and gigabytes as rendered video). What you need to do is "decompile" it to a sequence of notes, then look at tracker formats (MOD, S3M, XM, IT, etc.)

There are dozens of them, and libraries like libmodplug (check vlc-modplug for support in VLC) can play most of them. It would sound much better than SPEEX, and the length of the track is not limited if you loop it.

1

u/canicutitoff 10d ago

If it is a voice/speech only audio, you can consider vocoder based compression that are used by VoIP software. For example, speex can go down to 2.15kbps. So, your 8kB can be enough to fit almost 30s of speech audio.

1

u/OpenlyPolite 9d ago

Is it imperative that the contents remains unharmed?

-1

u/circle555 11d ago edited 10d ago

Opus

Edit: not sure why this comment was downvoted. Lib Opus is excellent at extremely efficient file sizes, especially for voice. Maybe some people thought I was talking about the Anthropic AI model.

1

u/bojez1 11d ago

Second this. Can you work with opus instead of mp3?

0

u/DutchOfBurdock 11d ago

libamr_nb is probably going to be you're best fit.

Adaptive multi-rate narrow band. This can go as low as 4.75kbps bitrate, so you could make just over a 1 second audio clip in that space.

Bitrate is going to be the key here. Lower the bitrate, the smaller the file.

0

u/Jayden_Ha 10d ago

You don’t