2

I've tried to play out an 24 bit PCM audio(s24le) by using Vlcsharp and NAudio.

I set audio play callback by calling libvlc_audio_set_callbacks() to get raw sample data firstly.

Next, I tried two sample video. The one has 24-bit PCM audio, and the another has 16-bit one(converted by using ffmpeg CLI from 24-bit), except of it, everything is the same. They're played well, but when I saw the data by debugger, the sample data got by vlc's audio play callback is the same.

After some researches, I found out the general PC can't play 24-bit PCM audio without a proper sound card.

If It's right, Is there some bit-depth convert(24->16) process to play? so, the sample data got by callback is same?

Ray
  • 55
  • 1
  • 5
  • It's probably been a decade since I've seen even a basic PC sound card that didn't support 24-bit. However, it isn't always enabled. I'm not familiar with the API your'e using, but it sounds like it's also going to be dependent on the VLC output plugin and OS. – Brad Jul 06 '20 at 04:52
  • Does that work with VLC? It sounds more like an issue with NAudio than VLC. – cube45 Jul 06 '20 at 05:14

1 Answers1

0

You could set the format parameter here if you wanted to force vlc to convert the format : https://code.videolan.org/mfkl/libvlcsharp-samples/-/blob/master/AudioCallbacks/Program.cs#L59

int AudioSetup(ref IntPtr opaque, ref IntPtr format, ref uint rate, ref uint channels)

see the doc here format should be a 4 ascii chars string, but I don't know the available formats you can pass here.

cube45
  • 3,429
  • 2
  • 24
  • 35