Is shortest mp3 36 bytes?
Reply #1 – 2004-08-19 20:58:11
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: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: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.