Video surveillance industry G711 codec [continued] collection knowledge, video surveillance g711
1. reference factors for Buffer collection:
A. How long does the buffer take, for example, ms or 50 ms;
B. The number of bytes received per second;
BufferSizeM = dwBytesPerSec * dwLatencyInMilliseconds/1000;
2. Examples:
Collect sound: If the encoding format is G711
BufferSize = 16/8*8000*(TimeMs)/1000
Note:
16/8 occupies 2 bytes for each Sample of G711,
8000 indicates the sampling rate, that is, 8000 samples of G711 need to be sampled every 1 s,
TimeMs is buffer time (ms), assuming TimeMs is 50 ms,
Then BufferSize = 2*8000*50/1000 = 800 Bytes, that is, the size before compression is 800;
In this way, the size of each package after G711 compression is 400 Bytes.
3. How long does the standard practice usually take?
TimeMs * sampling frequency.
For example, 20*8000/1000 = 160 (20 is PTime, 8000 is the sampling frequency). Generally, a single frame of audio data is 20 ms, which improves the playback latency.