Poor audio quality with LibVLCSharp
Hello,
I am a newbie in C# and WinForm and i'm developing a Windows Form application in C#, .NET Framework 4.8, with the LibVLCSharp.Winforms library (the latest version downloaded from NuGet).
It works like that : you import a file (video file, for exemple), you select it, you press a button, it open a new window on the 2nd screen, it get in fullscreen and it launch the video.
I am facing a persistent audio quality issue : the sound in my application seems really weird (compressed, or poor quality). However when i play the exact same video file with the official VLC software, the audio quality is perfect.
I have tried a lot of things, such as forcing the audio ouput module.
The code that initialize the player
I would really like to know why the audio quality is so bad, or where I made a mistake.
11 Replies
I have a bad feeling that WinForms library has a poor quality. In WPF or Avalonia I never had issues like this.
Can you share full source code?
as zip file
what file do you need exactly ? Or do you want the full project files ?
I need project file yes
exclude bin, obj.
what is "AxWMPLib"?
Its for the Windows media player
I use it for the preview of the video
that is the problem. You are using old windows media player. Not the LibVLC.
You should use just
https://github.com/videolan/libvlcsharp
GitHub
GitHub - videolan/libvlcsharp: Cross-platform .NET/Mono bindings fo...
Cross-platform .NET/Mono bindings for LibVLC. Contribute to videolan/libvlcsharp development by creating an account on GitHub.
I don't understand, i use the old Windows Media Player for the preview in the 1rst window of the software (and the audio if fine here), and for the main video viewer on the 2nd screen, it use the LibVLCSharp, not the Windows media player.
Hi there, I just had the same issue.
In my case the audio resampler was the problem because it defaulted to the "ugly" resampler.
Setting
--audio-resampler=speex_resampler
in the LibVLC
constructor fixed the issue.
I hope it helpsOh bro it works, thank you so much ! How did you find that ?
You are welcome
I enabled the debug logs (by passing
true
to the LibVLC
constructor) and found these two lines:
I thought "ugly" doesn't sound good so I checked how I can change the resampler and found that CLI option.
The CLI arguments are listed here btw: https://wiki.videolan.org/VLC_command-line_help/