deepch / RTSPtoWebRTC

RTSP to WebRTC use Pion WebRTC
MIT License
1.53k stars 410 forks source link

AAC Audio support #101

Open moh-mhtech opened 3 years ago

moh-mhtech commented 3 years ago

Great application! I'm using it to stream from a UniFi Video G3 Flex IP camera, which also has a built in microphone. Is there any possibility of adding AAC audio support?

Currently i get the following message: Codec Not Supported WebRTC ignore this track AAC

deepch commented 3 years ago

Unfortunately aac will require transcoding. Try my projects mse and hls they have aac out of the box, webrtc just can't aac need pcm-alaw or pcm-ulaw, if the camera has a choice it will help.

moh-mhtech commented 3 years ago

As far as I can see there are no such options for the camera.

I've tried using all your other RTSPtoXXX projects, but I need video in real-time, and there's just too much delay with the other technologies. With WebRTC I get it down to 0.5s which is the best I've achieved.

Maybe I can ask if there are any options to add other audio codecs to the webcam by SHH'ing into it.

deepch commented 3 years ago

the best way to develop native an AAC decoder for golang analogue faad

yourchanges commented 3 years ago

after some search, here is a go native aac decoder: https://github.com/Comcast/gaad

and we also need a native golang pcm encoder, like: https://github.com/winlinvip/go-fdkaac/blob/master/fdkaac/example_test.go#L29

so we can trans the aac to pcm in real-time and add the transferred pcm buf to webrtc audio track.

JeDiE99 commented 2 years ago

Using https://github.com/aler9/rtsp-simple-server + ffmpeg: rtsp-simple-server.yml: ... aac_topcm_mulaw : runOnDemand: ffmpeg -rtsp_transport tcp -i rtsp://admin:admin@IP:PORT/live/main -acodec pcm_mulaw -vcodec copy -f rtsp -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH runOnDemandRestart: yes

For RTSPtoWebRTC use rtsp://rtsp-simple-server-ip:8554/aac_topcm_mulaw: