Gad Hayisraeli wrote:
To achieve sub 5ms accuracy, you would have to decode the whole of the frame containing the desired seek destination (OK maybe just a granule - ie 1/2 of a frame - but this would require significant changes to the decoder internals) and then discard samples up to the desired start point. As you rightly say, this increases latency....
could it be possible to use smaller frames, for example: in 22050 hz mpeg file, the frame size is only 207 bytes, while in 44100 its 417 bytes. could it be acheived without lowering the quality ?
The frame size depends on the sampling frequency and the bit rate. Lower sampling frequencies will actually *increase* the frame size if the bit rate is held constant. That's because frames always hold the same number of samples.
The formula for the size of a frame in bytes is:
For Layer I: ((12000 * bitrate / samplerate) + pad_slot) * 4 For Layer II or Layer III (not LSF): (144000 * bitrate / samplerate) + pad_slot For Layer III LSF: (72000 * bitrate / samplerate) + pad_slot
where `bitrate' is the bit rate in kbps, `samplerate' is the sampling frequency in Hz, `pad_slot' is either 0 or 1 depending on the padding_bit from the frame's header, and `/' is integer division (discarding the remainder.)
Therefore, to reduce the frame size in bytes, you can either *increase* the sampling frequency or *decrease* the bit rate. Both basically require re-encoding the bitstream, and both will reduce the overall quality of the output (although how much depends entirely on the quality of your encoder.)
-rob