Many thanks for the great BASSenc_ACC add-on.
I just start using
BASS_Encode_AAC_Start(stream1, "--object-type 2 --vbr 0 --bitrate 96000", 0, SELF_Encode_AAC_Proc, &self);
to join encoded Data in my own callback function
CALLBACK SELF_Encode_AAC_Proc(HENCODE handle, DWORD channel, const void* buffer, DWORD length, QWORD offset, void* user) {
... some code here ...
}
to generate an stereo.m3u8 playlist and in this context also the stereo-00001.ts, stereo-00002.ts, ... files on the fly for HLS streaming this via IIS Webserver.
Currently I managed to successfully interpret the ADTS header (the first 7 Bytes of the buffer on each CALLBACK call).
But I failed at the point joining multiple CALLBACK calls to e.g. ~4 seconds of 48000 samples @ 96000 bits/s stereo audio, calculate the exact audio length in seconds so i can save/deliver the ready to go .m3u8 and .ts file on the fly.
The main problem is that i do not know how many CALLBACK calls buffer to join to get ~4 seconds audio and then get te exact seconds (with e.g. 6 decimal places) since i have to declarate the exact duration time in the .m3u8 file.
Sample .m3u8 file:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:5 or 4??
#EXTINF:4.010667,
stereo-00000.ts
#EXTINF:3.989333,
stereo-00001.ts
#EXTINF:4.010667,
stereo-00002.ts
#EXTINF:3.989333,
stereo-00003.ts
Can anyone give me any hints on how to do this?
Thanx in advance,
Martin