C
C#10mo ago
Lexan

Convert to wave file gives COMException

Hello! I have rest API using ASP.NET Core app .net 7 and I'm trying to convert a WebM file into a wav file in runtime, I'm using NAudio and this code : using (var reader = new MediaFoundationReader(WebMFilePath)) { WaveFileWriter.CreateWaveFile(WaveFilePath, reader); } This works perfectly locally. But when I deploy and run it gives me this exception: "error": { "message": "The data specified for the media type is invalid, inconsistent, or not supported by this object. (0xC00D36B4)", "exception": "COMException" } I have no clue on what to do with it or how to move forward. Any help is appreciated 🙏
21 Replies
Pobiega
Pobiega10mo ago
This works perfectly locally. But when I deploy and run it in Chrome
.. run it in chrome? As a blazor app? always include project type and .NET version when opening a thread btw
Lexan
LexanOP10mo ago
Right sorry. It's a rest API. Using .net 7. The WebM is sent from a react web app. But when I think about it, that is kinda irrelevant. I'm removing that part from the question. Thanks for the input
Pobiega
Pobiega10mo ago
Ah okay so the C# code pasted above runs in an ASP.NET Core app? but not a wasm blazor COMException... I wonder if it has to do with the target framework host
Lexan
LexanOP10mo ago
Yes exactly. That would be good info to have in the post 😅
Pobiega
Pobiega10mo ago
you say it works locally, but not deployed. is your local machine a windows OS, and the deployment host is linux?
Lexan
LexanOP10mo ago
I think both are windows. I'm at least using Windows locally and the Operating System is Windows in Azure. But not sure if that is what you are asking 🤔
Pobiega
Pobiega10mo ago
okay, then I dunno tbh
Lexan
LexanOP10mo ago
Yeah... Me and my team is also kinda out of ideas
Pobiega
Pobiega10mo ago
maybe some missing codec or something on the host? I dont know how NAudio works internally
Lexan
LexanOP10mo ago
mmm, maybe. It definitely feels like it's something with the host
Pobiega
Pobiega10mo ago
ah yep I just googled it. MediaFoundation is a windows subsystem that uses codecs MediaFoundationEncoder.SelectMediaType use that and pass in webm, if you get a non-null result back you have the right codec
Lexan
LexanOP10mo ago
Mmm, okej. I will try that after lunch. Thanks for the help!
Pobiega
Pobiega10mo ago
you'll very likely get a null on the server, but a non-null locally. so it wont fix your issue, but it will explain why
Lexan
LexanOP10mo ago
Can you send me that link, Not really sure what you meant I should do😅
Pobiega
Pobiega10mo ago
Determining Codec Availability
is the part you want to look at
Lexan
LexanOP10mo ago
Thanks! I will give that a try it seems to be non-null even on the server 😅
Pobiega
Pobiega10mo ago
did you pass the correct parameters thou? that article wasn't about webm specifically and webm is just a matroska container format so you need to know what the actual format of your file is
Lexan
LexanOP10mo ago
I see. That changes things. How do I find out what format it is? Media info is just saying it's a webm file 🤔
Pobiega
Pobiega10mo ago
open it in VLC and press CTRL+J or https://mediaarea.net/en/MediaInfo
Lexan
LexanOP10mo ago
it is an Opus. I think... I have never worked with media types before 😅
Want results from more Discord servers?
Add your server