View Single Post
Old 17th January 2015, 12:05   #17  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by Overdrive80 View Post
Hey, somebody could tell me max. frame size in ms for flac? Thanks
It's not easy to know that, using info from https://xiph.org/flac/documentation_..._overview.html and https://xiph.org/flac/format.html#frame_header

Quote:
...Like most audio codecs, FLAC splits the unencoded audio data into blocks, and encodes each block separately. The encoded block is packed into a frame and appended to the stream. The reference encoder uses a single block size for the whole stream but the FLAC format does not require it.
Quote:
...In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples. This range covers the optimal size for all of the audio data FLAC supports.

Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input. Future versions may vary the block size depending on the characteristics of the signal.
but:
Quote:
FLAC specifies a subset of itself as the Subset format. The purpose of this is to ensure that any streams encoded according to the Subset are truly "streamable",...

The Subset makes the following limitations on what may be used in the stream:
- The blocksize must be <=16384; if the sample rate is <= 48000Hz, the blocksize must be <=4608.
...
Like FLAC support:
Sample size in bits: 8, 16, 20 and 24 (1 to 3 bytes)
Channels: 1 to 8
Samplerate: 8 to 96 KHz

A theoric max framesize in ms. can be for a 1 channel, 8 bits (1 byte) and 8 KHz (8000 samples/s, 8 samples/ms):

Max framesize in ms: Max_BlockSize / (Channels x ByteDepth x Samples/ms)

Max framesize in ms: 65535 / (1 x 1 x 8) = 8191,875 ms

But blocksize is "optimized on the sample rate" and with limits in "Subset format" maybe we can have for a 2 channel, 16 bits (2 bytes) 48 KHz ( 48 samples/ms):

Max framesize in ms: 4608 / (2 x 2 x 48) = 24 ms

For 6 channels, 24 bits (3 bytes) and 48 KHz:

Max framesize in ms: 4608 / (6 x 3 x 48) = 10,667 ms
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 17th January 2015 at 12:14.
tebasuna51 is offline   Reply With Quote