5

I'm coding a media streaming system in C# that needs to stream audio in the first place, the source is RAW PCM data as byte stream, but it needs to encode it to AAC (no other format is accepted), than it is needed to be forwarded as byte stream, then decoded to RAW PCM data again.

I just can not find any useful solution.

I've tried NAudio, but it does not support encoded stream reading, except by using MediaFoundationReader(URL_STRING) as source, but it accepts only file path ot URL. Creating a TCP HTTP stream server locally is not an option, as creating file from stream that can be read neither, and PCM->AAC encoding still not solved this way.

I've tried SharpDX, but i have not found any useful example for doing the conversion from stream to stream.

I've coded a buffer for NAudio as a Stream interface for buffering the PCM data stream so technically it can read from byte array, that may be used as an input and/or output object for the encoder/decoder.

I've also tried the MFLib to use the MediaFoundation library, but the lack of the examples or useful documentation did not make my job easier, and actually this is not the best for those users who want to use the application on older Windows OS, because MF works only on Win7+.

Is there any useful library that i can relatively simply use to these conversion, or i do have to figure out completely how this actually easy looking problem can be solved?

Since both the NAudio and the SharpDX are open source some modification of the classes are accepted.

Later this system also needs to support video streaming in MP4, so solution that can provide both AAC and MP4 audio/video encoding/decoding in the same time from/to streams would be the best.

I'd be thankful to get any hint and/or sources/examples that can give a clue getting closer my goals. Thank You.

beatcoder
  • 683
  • 1
  • 5
  • 19
  • _[Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.](http://stackoverflow.com/help/on-topic)_ –  Nov 10 '15 at 06:08
  • 1
    Libav/ffmpeg can do it, although I wouldn't call them simple. You'd also have to wrap them as they're written in c. Maybe check out libfdk_aac. – Rhythmic Fistman Nov 10 '15 at 13:15
  • Rhythmic Fistman: Thank You, libfdk_aac helped a lot, I've used windows binary dll-s, wrapped them in C# with Marshaling and worked just perfectly and fast. Handling the buffer was a bit of pain, but it works fine! It worked also under linux with mono using the libfdk aac so files. – beatcoder Oct 27 '17 at 10:23

0 Answers0