To answer your first question, you need an encoder to create an MP3 or OGG. NAudio does not include MP3 or OGG encoder. All he does is provide you with ways to access all the encoders that are already installed on your computer (for example, ACM or Media Foundation Transforms). However, in both MP3 and OGG, you will find that the easiest way is to find an unmanaged DLL or command line utility and access it from .NET. In the article I wrote above, you will find a brief explanation of how you can use LAME.exe with stdin and stdout to convert PCM to MP3 on the fly.
As for your second question, yes. Whenever you transcode, you first decode in PCM and then transcode in the target codec. I think that theoretically you can put audio encoded in any format into an OGG container, but in practice, audio in an OGG container is usually encoded with Vorbis. FLAC and OPUS may be parameters, but again you will need to find an application or library that can write the OGG container format for you, because I do not know about fully controlled OGG autographs.
source share