Musepack Forums

Musepack Forums (https://forum.musepack.net/index.php)
-   Tech (https://forum.musepack.net/forumdisplay.php?f=7)
-   -   Musepack bitstream format (https://forum.musepack.net/showthread.php?t=245)

yar 28 October 2005 03:12 pm

Musepack bitstream format
 
Once upon a time I got sick and tired of broken mp3 files floating around and wrote a small utility called mp3ck that just parsed MPEG frames and ID3 tags one by one to see if their stream was continuous. The utility made no attempt to actually decode the stream, but it proved to catch most defects that resulted from broken transfers over the net, buggy FTP and HTTP servers, etc.

With more and more files in Musepack format appearing around, I'd like to extend my little utility to verify such files, too, if possible at all. However, I failed to find a document on the format except for the source code. Is there any out there? Of course, I mean a rather cursory description allowing one just to parse the stream.

Thanks!

Shy 28 October 2005 03:37 pm

libmpcdec contains Doxygen documentation (docs/html/index.html) which you may find helpful.
Sure it's possible, in fact a tool for verifying MPCs' validity already exists - MPCscan (written by Case, available on our Windows page).

Lefungus 28 October 2005 04:32 pm

Well, you won't find much info in the doxygen doc. Instead, you must get libmpcdec and read the code which, IMO, is quite ok to understand (but yes, it can't replace real specs). The hard part will be to keep wanting to support musepack when you'll understand the bitstream layout :D

yar 06 November 2005 04:30 pm

Dear Shy and Lefungus, your suggestions are much appreciated!
By the way, is MPCscan closed-source, or its author just didn't care to release the source code as well?

Shy 06 November 2005 08:00 pm

The MPCscan source used to be available publicly but since Case closed his site it's not anymore. I'm not sure whether he'd be OK if we make it public, so I'll send it to you personally.

gurdiga 16 May 2007 07:42 am

Quote:

Originally Posted by Shy (Post 1109)
libmpcdec contains Doxygen documentation (docs/html/index.html) which you may find helpful.

Hello, the current version of the package of libmpcdec (http://files.musepack.net/source/lib...-1.2.6.tar.bz2) does not have a "doc" directory, nor it has any "*.htm*" files. I'm trying to write a decoder in Java, and, guided by SV7Specification (http://trac.musepack.net/trac/wiki/SV7Specification) I've managed to decode the MPC header of the file (first six 32-bit words + 8 bits for EncoderVersion). Next comes the encoded audio data but I could not find any documentation about it.

Wikipedia (http://en.wikipedia.org/wiki/Musepack) says that Musepack format uses for audio data compression the Huffman coding which as per Wikipedia (http://en.wikipedia.org/wiki/Huffman...ain_properties), should contain the Huffman Coding Tree with the compressed data. The problem now is that I cannot figure out how to identify the Huffman Coding Tree in the file.

Is there any documentation (other than the source code itself) about the encoded stream format?

Lefungus 16 May 2007 05:46 pm

Some documentation is generated through doxygen
Code:

doxygen Doxyfile
Unfortunately, it's not quite maintained so it doesn't compile with current version.
As for your specific question, even with working doxygen, that part wasn't documented so you will need to dig into the code.
If you find it too complex to read, I advise taking a look at ffmpeg decoder as it contains another implementation. Having two different versions usually help.
I can't give you an answer as I am as clueless as yourself about how frames are compressed. r2d should know though.
If you do manage to implement your decoder, may I suggest sending back a small documentation or text that could be inserted into the sv7 specifications wiki ?

r2d 22 May 2007 10:55 am

Quote:

Originally Posted by gurdiga (Post 1572)
Next comes the encoded audio data but I could not find any documentation about it.

After the header and before each audio frame there is the frame size coded on 20bits (which is documented in the file you mentioned)

Quote:

Originally Posted by gurdiga (Post 1572)
Wikipedia (http://en.wikipedia.org/wiki/Musepack) says that Musepack format uses for audio data compression the Huffman coding

This is true.

Quote:

Originally Posted by gurdiga (Post 1572)
which as per Wikipedia (http://en.wikipedia.org/wiki/Huffman...ain_properties), should contain the Huffman Coding Tree with the compressed data. The problem now is that I cannot figure out how to identify the Huffman Coding Tree in the file.

Huffman tables are not stored in the bitstream. Musepack uses static huffman coding, the tables are in the decoder source code : http://trac.musepack.net/trac/browse.../src/huffsv7.c

Quote:

Originally Posted by gurdiga (Post 1572)
Is there any documentation (other than the source code itself) about the encoded stream format?

I fear there is no documentation on the bitstream. If you want to use the code to understand the bitstream, I suggest you start with mpc_decoder_read_bitstream_sv7() in http://trac.musepack.net/trac/browse.../mpc_decoder.c

If you need any help I can answer your questions as it's a part of the code I know quite well.

Nicolas


All times are GMT. The time now is 12:15 pm.

Powered by vBulletin® Version 3.8.11 Beta 2
Copyright ©2000 - 2019, vBulletin Solutions Inc.