IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Algorithm to cut mp3 into fully decodable segments
darkbyte
post May 23 2013, 19:32
Post #1





Group: Members
Posts: 145
Joined: 14-June 11
Member No.: 91517



I'm thinking about writing a HTML5 audio player which uses it's own streaming mechanism to pull audio data on HTTP. The code on the page would download smaller segments of the audio files then decode the audio frames in a JavaScriptNode which this way provides the buffer to the playback engine. The server have to tell the player about the possible segments of the audio file. The playtime doesn't have to be equally distributed among frames.

As i understand mp3 can be cut at any arbitary elementary stream frame and decoders can decode these segments without any problem. However because of the bit reservoir the proceeding frame(s) may refer back to the bits of the previous frame(s). This can introduce audio loss because the next segment may have data which can be only decoded with the data of the previous frame which is not available in the context of the current segment.
So the correct solution would be reordeing each segments bits to contain only bits used in the current segment. I think mp3repacker does something similar to achieve maximum frame dataspace usage.

I wonder how this thing works in the technical perspective. Can somebody suggest me documents describing the logical bitstream of an mp3 file? I've found the MPEG audio format's documentation but this only describes how the elementary stream works and provides information about the MPEG Layer III stream.

This post has been edited by darkbyte: May 23 2013, 19:32


--------------------
Wavpack -b450x1c
Go to the top of the page
+Quote Post
darkbyte
post May 23 2013, 23:34
Post #2





Group: Members
Posts: 145
Joined: 14-June 11
Member No.: 91517



I don't know how up to date this document is but this seems like a great start to learn how logical bitstream is organized: Letís build an MP3-decoder!


--------------------
Wavpack -b450x1c
Go to the top of the page
+Quote Post
2Bdecided
post May 24 2013, 10:15
Post #3


ReplayGain developer


Group: Developer
Posts: 5059
Joined: 5-November 01
From: Yorkshire, UK
Member No.: 409



You know that, even without the bitreservoir, the decoded segments must overlap in the time domain?

Cheers,
David.
Go to the top of the page
+Quote Post
darkbyte
post May 24 2013, 12:06
Post #4





Group: Members
Posts: 145
Joined: 14-June 11
Member No.: 91517



QUOTE (2Bdecided @ May 24 2013, 11:15) *
You know that, even without the bitreservoir, the decoded segments must overlap in the time domain?

Cheers,
David.

sad.gif No, i haven't thought about that.
I think i have to look for a Javascript mp3 decoder then and customize it for my needs.

This post has been edited by darkbyte: May 24 2013, 12:07


--------------------
Wavpack -b450x1c
Go to the top of the page
+Quote Post
Sebastian Mares
post May 24 2013, 13:59
Post #5





Group: Members
Posts: 3629
Joined: 14-May 03
From: Bad Herrenalb
Member No.: 6613



http://audiocogs.org/codecs/mp3/


--------------------
http://listening-tests.hydrogenaudio.org/sebastian/
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th July 2014 - 20:55