protected override Matroska.AudioSink CreateAudioSink() { var fileIndex = 0; var fileExtension = "mka"; var filePathWithoutExtension = ProcessFilePath(Path.Combine(Options.OutputPath, Options.OutputFileName), RemoteConnectionInfo); var filePath = $"{filePathWithoutExtension}-{fileIndex}.{fileExtension}"; while (File.Exists(filePath)) { filePath = $"{filePathWithoutExtension}-{++fileIndex}.{fileExtension}"; } //TODO: should the JSON here follow the media server conventions? var jsonPath = filePath + ".json"; File.WriteAllText(jsonPath, RemoteConnectionInfo.ToJson()); Console.WriteLine(jsonPath); var format = AudioFormat.Clone(); format.IsPacketized = false; return(new Matroska.AudioSink(filePath, format)); }