BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
706 stars 284 forks source link

rstp audio stream to wav format for Accord.Audio #65

Open rossbuggins opened 4 years ago

rossbuggins commented 4 years ago

Hi, I'm doing some audio analysis using the Accord.Audio framework, and looking to take the frames from the rtsp client through into there. However, currently struggling to get the aac mp4a format (?) from the audio frames (currently similar code to the player demo) through into the correct uncompressed format. I've also looked at NAudio for doing the mp4a to unompressed conversion (https://github.com/naudio/NAudio/issues/398). Any pointers regarding this please? Thanks, Ross

crtassos commented 4 years ago

Hi @rossbuggins . From what i discovered i do not think it is possible to play AAC audio files or open a stream to play AAC audio with NAudio. To play the stream i ended up realising that i have to do it manually by opening a socket. Now my plan is to test the RtspClientSharp client which is basically a wrapper around Microsoft's TCP socket. I see that you already use or have used this client? Did it work? Never the less, with NAudio you can convert the audio file from one format to another. Have you tried this with your stream?

rossbuggins commented 4 years ago

I’m taking the raw frames and/or decided frames from here (as per demo) but not able to even get them to just play at the moment. Let me know if you manage to get that working here

BogdanovKirill commented 4 years ago

Hi !

Please take a look at RealtimeAudioSource.cs in SimpleRtspPlayer project. It will give you decoded audio frames which physically are PCM frames. They could be played or analyzed (e.g. WaveOut class in NAudio to play it)

crtassos commented 4 years ago

Hi @BogdanovKirill i tried to use the SimpleRtspPlayer app from file ..RtspClientSharp\Examples\SimpleRtspPlayer\bin\Debug as a console app to test my rtsp address but it throws an exception. My address is ..rtsp://192.168.0.215:554/testStream. It works on Vlc. Thanks in advance