webrtc
                                
                                
                                
                                    webrtc copied to clipboard
                            
                            
                            
                        need help! Audio stream with PCM to encode AAC
It's my first time to know pion, webrtc.
And I'm looking for find some methods or functions can encode audio stream with PCM to AAC in pion.
I know that use cgo to call some "xx.so" library like ffmpeg orfacc will be useful, but I still hope someone could give me some tips or  functions in Pion.
Thanks!
Looking for something similar, to be able to store audio in a MP4 container (next to WebRTCing)
Did you find any solution?
I'm planning to work on it as part of the https://github.com/kerberos-io/agent. At the moment we confirm PCM is working for WebRTC, works great to be honest in the Kerberos Agent. However for recording in an MP4, you'll need AAC, therefore we requested some guidance.
We did some research and this is how we plan to do it:
- We'll fetch the audio track from the RTSP stream
 - Check if it's PCM
 - Transcode to AAC on the fly (or when required) using FFmpeg or other transcoder
 - Write the new audio track to the MP4
 
This is just one part of the solution, you might also have cameras with no PCM, and only AAC codec onboard, therefore you'll need to cover the other end as well, as WebRTC only works with PCM and not AAC. This means you'll need to transcode AAC to PCM before adding it to your WebRTC audio track.
Hey @JackMin1314 @jianzhiyao @cedricve
Sorry Pion doesn't do more to make this easier! It would be nice to have a library that abstracts this away.
If I had to build this I would probably use something like https://github.com/gen2brain/aac-go or maybe GStreamer? If someone starts a library or puts up a repo happy to help!