1
votes

I need to encode ACM stream on the fly to AAC ELD using the FDK lib.

My issue is that in my case, the AAC encoded data need to be 16 bytes aligned. I.E that the length of it will be divided by 16.

I am not sure then how to do that. I have tried to add 0 to the end of encoded data until it will be divided by 16 and then send it to the CBC but there are some Decoders do not like that.

I must add the padding to the ACC encoded data in a way that the ACC decoder on the other side will know what to do with that.

I do not think that the AAC lib i use ( the FDK Lib) has option to add padding so i think i will need to pad the encoded AAC data myself?

Can you please tell me to the best and simple way to do that

2
Aligning usually refers to the starting address of the data, not how big it is. Is it possible that you're misunderstanding the requirements?molbdnilo
Maybe i used not the right word but yes, i need that the encoded AAC data=the output will be divided by 16user3702017
@user3702017 Your terminology is fine. Why must you add this padding though? Why not just wait until you have the next buffer of AAC-encoded data, and chunk accordingly?Brad
I tried that but got bad noise when i did that so i assume this is not possible. Are you sure that if H is the AAC encode function then: H(chunk1)+H(chunk2)=H(chunk1+chunk2) in the eye of the AAC decoder?user3702017
@user3702017 is this solved? If yes put an answer...VC.One

2 Answers

0
votes

Did you try adding 0xE0 (0b11100000) instead of zeros?

If a byte is starting a frame, its three highest bits indicate the type of block. Type 0b111 indicates the end of the frame. Type 0 indicates a single channel element and requires encoded audio to follow, which is why you are getting an error when simply padding with zeros.

0
votes

There is a so called "fill element" in the AAC specification. However, does your encoder support it? It would be very difficult for you to add it, you would basically need to learn a great deal of AAC bistream syntax.

On the other hand, is it required that you transfer whole encoded frames? I don't see why this would be true. Just split your stream on a boundary you like, and concatenate it on the other end before decoding.