MediaFoundationReader doesnt work with opus format
Mrgaton opened this issue · comments
My code
MediaFoundationReader reader = new MediaFoundationReader(videoPath);
BufferedWaveProvider bufferedWaveProvider = new BufferedWaveProvider(reader.WaveFormat);
bufferedWaveProvider.BufferDuration = TimeSpan.FromMilliseconds(audioBufferLengh * 4);
bufferedWaveProvider.DiscardOnBufferOverflow = true;
bufferedWaveProvider.ReadFully = true;
WaveOut player = new WaveOut();
player.Init(bufferedWaveProvider);
player.Play();
the exception:
Excepcion no controlada: System.Runtime.InteropServices.COMException: No se encontro ninguna transformacion adecuada para codificar o descodificar el contenido. (Excepcion de HRESULT: 0xC00D5212)
en NAudio.MediaFoundation.IMFSourceReader.SetCurrentMediaType(Int32 dwStreamIndex, IntPtr pdwReserved, IMFMediaType pMediaType)
en NAudio.Wave.MediaFoundationReader.CreateReader(MediaFoundationReaderSettings settings)
en NAudio.Wave.MediaFoundationReader.Init(MediaFoundationReaderSettings initialSettings)
en NAudio.Wave.MediaFoundationReader..ctor(String file)
en AsciiPlayer.Program.Main(String[] arg) en AsciiPlayer\Program.cs:linea 160
the video:
J.Balvin.-.Amarillo.Official.Video.390.39.Kbit_s.mp4
MediaFoundationReader relies on the codecs installed in Windows, so if your version of Windows can't play the file in Windows Media Player then its likely that MediaFoundationPlayer also won't be able to play it