Skip to main content

Notice

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: Is shortest mp3 36 bytes? (Read 6237 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is shortest mp3 36 bytes?

I wonder what the shortest specification-compliant mp3 should look like?

One Packet header (4 bytes), One Frame header(4), then one shortest frame?

At 48kHz, 8kilobits/second, MPEG-2 Layer III, I think a frame can be 28 bytes.

That would be 36 bytes for the whole file.

Anyone seen such a beast for testing decoders?

A more practical "shortest" would also have id3 tags for testing max num songs in a player app.

I'll test LAME on very short inputs, but I think hand-building a file could produce smaller corner cases.  It certainly works that way for ELF binary files.

-M

Is shortest mp3 36 bytes?

Reply #1
Quote
I wonder what the shortest specification-compliant mp3 should look like?

One Packet header (4 bytes), One Frame header(4), then one shortest frame?

At 48kHz, 8kilobits/second, MPEG-2 Layer III, I think a frame can be 28 bytes.

That would be 36 bytes for the whole file.

Anyone seen such a beast for testing decoders?

A more practical "shortest" would also have id3 tags for testing max num songs in a player app.

I'll test LAME on very short inputs, but I think hand-building a file could produce smaller corner cases.  It certainly works that way for ELF binary files.

-M
[a href="index.php?act=findpost&pid=235609"][{POST_SNAPBACK}][/a]

I decided to do some testing myself, and made a 1-sample wav file to encode with LAME. I used "lame -b 16" and got 72 bytes. Using "lame -b 8" gave me an error:
Code: [Select]
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), SSE, SSE2
Resampling:  input 44.1 kHz  output 8 kHz
Using polyphase lowpass filter, transition band:  3000 Hz -  3097 Hz
Encoding VeryShort.wav to VeryShort.wav.mp3
Encoding as 8 kHz   8 kbps single-ch MPEG-2.5 Layer III (16x) qval=3
   Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
    0/2      ( 0%)|    0:00/    0:00|    0:00/    0:00|   0.0000x|    0:00 strange error flushing buffer ...
    0/2      ( 0%)|    0:00/    0:00|    0:00/    0:00|   0.0000x|    0:00
ReplayGain: 0.0dB

The resultant file doesn't have anything in it.

(oddly enough, although the encoder says there are two frames, only one is stored in the 16kbps file)

I then realized that LAME was resampling to 8 khz, so changed the command line to "lame -b 8 --resample 24" and it worked OK. The file is 24bytes long.

Here it is, in all its hex glory:
Code: [Select]
FF F3 14 C4 00 00 00 03 48 00 00 00 00 4C 41 4D 45 33 2E 39 36 2E 31 55
Unfortunately, neither Foobar nor EncSpot recognize it.

PS. Note that MPEG-2 layer 3 doesn't support sampling rates of higher than 24khz.
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

Is shortest mp3 36 bytes?

Reply #2
Quote
Here it is, in all its hex glory:
Code: [Select]
FF F3 14 C4 00 00 00 03 48 00 00 00 00 4C 41 4D 45 33 2E 39 36 2E 31 55
[a href="index.php?act=findpost&pid=235615"][{POST_SNAPBACK}][/a]

I think this may be the first time in the history of the Hydrogen Audio forums that an MP3 has been posted, complete, in its hex form. 

    - M.

P.S.: I almost accused morganw of stealing my signature, until I realized his "-M" does not have a space or a period. But I'm still tempted to call it a derivative work.

Is shortest mp3 36 bytes?

Reply #3
Just keep in mind that the work I posted is copyright © 2004 Omion. All rights reversed! Prosecutors will be violated! No unauthorized use without authorization! Trespassers will be shot on sight! Objects in mirror are closer than they appear! If you even look at me funny, I'll unleash a hoard of slavering lawyers at you! Grrr... 
[takes pills]

I'm OK now. And still, I can't get it to play. Hmmph.
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

Is shortest mp3 36 bytes?

Reply #4
Guess what? It sounds even better when it's played backwards.

    - M.

Is shortest mp3 36 bytes?

Reply #5
What, you mean:
Code: [Select]
55 31 2E 36 39 2E 33 45 4D 41 4C 00 00 00 00 48 03 00 00 00 C4 14 F3 FF


[edit]That's it, I'm copyrighting this, too! Don't try anything funny, punks... 
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

Is shortest mp3 36 bytes?

Reply #6
Crazy crazy stuff here at HA...

That is cool though.  A 24-byte mp3 
Nero AAC 1.5.1.0: -q0.45

Is shortest mp3 36 bytes?

Reply #7
Hmm... I think I found a problem. I was resampling from 44100 down to 24000 with just one sample. 1 sample @ 44100 = 0.54 samples @ 24000. I think this was throwing off LAME.

I made a file with one sample at 24000, and it worked just fine, but it's 96 bytes long (horrors!) I looked at the file, and it seems to be made from 4 frames (the mp3 blows it up to 2304 samples). Deleting the last frame results in an unplayable file, so I think that's the minimum. So, here's an mp3 that actually plays:

Code: [Select]
FF F3 14 C4 00 00 00 03 48 00 00 00 00 4C 41 4D 45 33 2E 39 36 2E 31 55
FF F3 14 C4 0B 00 00 03 48 00 00 00 00 55 55 55 55 55 55 55 55 55 55 55
FF F3 14 C4 16 00 00 03 48 00 00 00 00 55 55 55 55 55 55 55 55 55 55 55
FF F3 14 C4 21 00 00 03 48 00 00 00 00 55 55 55 55 55 55 55 55 55 55 55

I think I'll donate this song to the public domain, since I'm such a nice guy
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2

Is shortest mp3 36 bytes?

Reply #8
You're so generous.  And that is still crazy that you can have a playable file that small!  Just madness.  Really really cool though.
Nero AAC 1.5.1.0: -q0.45

Is shortest mp3 36 bytes?

Reply #9
As the MDCT is overlapping, you need 3 windows to properly decode something. If you are using long blocks, it means 3 granules (so 3 frames for mpeg2).

But if you are using short blocks, a single short block granule should be enough.

If youo have only 1 window, some players might be smart enough to add some virtual zeroed windows before and after to manage to decode it, but this is quite a borderline case.

So I think that your 24bytes mp3 is undecodable by most decoders.

BTW, I'd be interested by your 44.1kHz monosample file.


Is shortest mp3 36 bytes?

Reply #11
My bad: I am interested by the wav sample, as it seems to puzzle lame.

Is shortest mp3 36 bytes?

Reply #12
I think we're onto a summer hit!
Wanna buy a monkey?

Is shortest mp3 36 bytes?

Reply #13
Quote
As the MDCT is overlapping, you need 3 windows to properly decode something. If you are using long blocks, it means 3 granules (so 3 frames for mpeg2).

But if you are using short blocks, a single short block granule should be enough.

If youo have only 1 window, some players might be smart enough to add some virtual zeroed windows before and after to manage to decode it, but this is quite a borderline case.

So I think that your 24bytes mp3 is undecodable by most decoders.

BTW, I'd be interested by your 44.1kHz monosample file.
[{POST_SNAPBACK}][/a]

Thanks for the advice! I got it down to 2 frames ('start' and 'short', I assume; I still can't get it down to 1) so now it's only 48 bytes long! Foobar plays it just fine.

Code: [Select]
FF F3 14 C4 00 00 00 03 48 01 40 00 00 4C 41 4D 45 33 2E 39 36 2E 31 55
FF F3 14 C4 0B 00 00 03 48 01 80 00 00 55 55 55 55 55 55 55 55 55 55 55


I looked at my initial file (the one that LAME doesn't like) and it looks like it was actually 1 sample at 48khz. I just tried a sample at 44.1, and it did give the same errors, though.
48khz [a href="http://people.ucsc.edu/~rswilson/other/OneSampleAt48000.wav][link][/url]:
"lame -b 8" > strange error flushing buffer
"lame -b 8 --resample 24" > 1 frame; undecodable
44.1khz [link]:
"lame -b 8" > strange error flushing buffer
"lame -b 8 --resample 24" > 2 frames; OK
"lame -b 8 --resample 22" > 1 frame; undecodable

(this was with LAME 3.96.1, BTW)

PS. Whats the difference between a 'granule' and a 'frame'?
[edit] Nevermind, I found that in MPEG-1 L3 a granule is 576 samples and a frame is 2 granules. And a granule can have either 1 long block or 3 short blocks, right?
So what are "start" and "stop" blocks? And "mixed" blocks? Any good pages to describe them?
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2