C
C#5mo 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
Pobiega5mo 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
Lexan5mo 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
Pobiega5mo 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
Lexan5mo ago
Yes exactly. That would be good info to have in the post 😅
Pobiega
Pobiega5mo ago
you say it works locally, but not deployed. is your local machine a windows OS, and the deployment host is linux?
Lexan
Lexan5mo 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
Pobiega5mo ago
okay, then I dunno tbh
Lexan
Lexan5mo ago
Yeah... Me and my team is also kinda out of ideas
Pobiega
Pobiega5mo ago
maybe some missing codec or something on the host? I dont know how NAudio works internally
Lexan
Lexan5mo ago
mmm, maybe. It definitely feels like it's something with the host
Pobiega
Pobiega5mo 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
Lexan5mo ago
Mmm, okej. I will try that after lunch. Thanks for the help!
Pobiega
Pobiega5mo 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
Lexan5mo ago
Can you send me that link, Not really sure what you meant I should do😅
Pobiega
Pobiega5mo ago
Determining Codec Availability
is the part you want to look at
Lexan
Lexan5mo ago
Thanks! I will give that a try it seems to be non-null even on the server 😅
Pobiega
Pobiega5mo 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
Lexan5mo 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
Pobiega5mo ago
open it in VLC and press CTRL+J or https://mediaarea.net/en/MediaInfo
Lexan
Lexan5mo ago
it is an Opus. I think... I have never worked with media types before 😅
Want results from more Discord servers?
Add your server
More Posts
confused, passing tuple?```cs // fixes times like more than 60 seconds // int, int, int public (intUWP Digest credentials not supported?i have the following code in my xamarin.forms project. (yeah i know its deprecated, but thats what iHow can I convert null entries in JSON data to a default value?I have JSON data that contains null entries for some values. It would make the business code a lot eHow do I take text from input element of a form and put it in AspNetUsers table properly?I'm passing it from view to controller action through parameters, if that's relevant. This input eleWindows keyboard hook (SetWindowsHookExA) doesn't get called.Simplified version: ```cs KeyboardListener.KeyPress += (key) => { Console.WriteLine(Enum.GetName✅ What's a good strategy to load serverside resources into your controller?Right now I have a few images and videos that so far i've been loading to views using Directory callhow can i get the data from database and put them to a dropdownhow can i get the data from database and put them to a dropdown , when im trying to do that it showsDont know what i did, program now giving CS0101 and CS0111 errors.Cant launch the debug thingamabob. How would I fix it?✅ Changed something manually in AspNetUsers and now can't loginI went in with SQL Server Object Explorer and manually changed the NormalizedUserName column and now✅ How to automate update-databaseI am bilding a Web server but i have to typ in update-database how can i automate this in Blazor in