Musepack Forums  

Go Back   Musepack Forums > Main > Tech

Reply
 
Thread Tools Search this Thread Display Modes
Old 28 October 2005, 03:12 pm   #1
yar
Member
 
Join Date: Oct 2005
Posts: 2
Default 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!
yar is offline   Reply With Quote
Old 28 October 2005, 03:37 pm   #2
Shy
Admin
 
Shy's Avatar
 
Join Date: Jul 2004
Posts: 372
Default

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).
Shy is offline   Reply With Quote
Old 28 October 2005, 04:32 pm   #3
Lefungus
Procrastinator
 
Lefungus's Avatar
 
Join Date: Jul 2004
Posts: 131
Default

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
Lefungus is offline   Reply With Quote
Old 06 November 2005, 04:30 pm   #4
yar
Member
 
Join Date: Oct 2005
Posts: 2
Default

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?
yar is offline   Reply With Quote
Old 06 November 2005, 08:00 pm   #5
Shy
Admin
 
Shy's Avatar
 
Join Date: Jul 2004
Posts: 372
Default

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.
Shy is offline   Reply With Quote
Old 16 May 2007, 07:42 am   #6
gurdiga
Member
 
Join Date: May 2007
Posts: 1
Default

Quote:
Originally Posted by Shy View Post
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?

Last edited by gurdiga; 16 May 2007 at 09:17 am.
gurdiga is offline   Reply With Quote
Old 16 May 2007, 05:46 pm   #7
Lefungus
Procrastinator
 
Lefungus's Avatar
 
Join Date: Jul 2004
Posts: 131
Default

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 ?
Lefungus is offline   Reply With Quote
Old 22 May 2007, 10:55 am   #8
r2d
Musepack developer
 
Join Date: Sep 2006
Location: Villeurbanne - France
Posts: 36
Default

Quote:
Originally Posted by gurdiga View Post
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 View Post
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 View Post
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 View Post
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
r2d is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mp3infp modified to support musepack files kmart MPC for Windows 3 15 November 2011 01:03 pm
Musepack magic(5) rules for file(1) bucciarati MPC for UNIX 1 13 December 2005 04:43 am
Xine now supports Musepack quimbaya MPC for UNIX 3 24 January 2005 11:28 pm
musepack support for prokyon3 mkalkbrenner MPC for UNIX 3 07 September 2004 09:06 am


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.