The Matroska Container support for NextAudio library.
$ dotnet add package NextAudio.MatroskaSee Documentation
You can add this lib via nuget package manager.
dotnet cli example:
dotnet add package NextAudio.Matroska
The stable builds are available from NuGet.
The development builds are availabe from Myget feed https://www.myget.org/F/next-audio/api/v3/index.json.
These builds target the main branch.
The lib will always use audio frame buffers for read/write operations.
This makes the streaming data very easy.
using var output = new MemoryStream();
using var file = AudioStream.CreateFromFile("test1.mkv");
using var demuxer = new MatroskaDemuxer(file);
var bytesRead = 0;
Span<byte> buffer = new byte[1024];
while ((bytesRead = demuxer.Demux(buffer)) > 0)
{
// Always slice the buffer to bytesRead,
// the lib always will return an audio frame
// when using a read operation.
var frame = buffer.Slice(0, bytesRead);
output.Write(frame);
}
For more usage and guides check the documentation
Matroska Website OlegZee/NEbml sedmelluq/lavaplayer hasenbanck/matroska-demuxer StefH/Matroska