Open tarekgh opened 1 year ago
Tagging subscribers to this area: @dotnet/area-microsoft-win32 See info in area-owners.md if you want to be subscribed.
Author: | tarekgh |
---|---|
Assignees: | - |
Labels: | `area-Microsoft.Win32`, `untriaged` |
Milestone: | - |
As a note, "Lavf58.29.100" respectively " Lavf59.33.100" are not encoding formats, it is simply a meta tag of ffmpeg
's libavformat
library in the .wav
file.
The first (working) file is encoded in WAVE_FORMAT_ADPCM, the second (not working) is encoded in WAVE_FORMAT_PCM. (https://learn.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-waveformatex)
#define WAVE_FORMAT_PCM 0x0001
#define WAVE_FORMAT_ADPCM 0x0002
(this is what ffmpeg
prints as audio tag)
In the second image ffmpeg
is complaining, that the 'data' chunk has an invalid size. This has most likely caused the issue with the SoundPlayer, the .wav
file is simply corrupt.
See yellow text: Ignoring maximum wave data size, file may be invalid
A solution would be for the .wav parser in the SoundPlayer to correct an invalid 'data' chunk size. I've seen many times that wave-writers set the value to int.MaxValue when recording as the final size is (still) unknown when they start.
Description
This is reported through the VS community portal https://developercommunity.visualstudio.com/t/SystemMediaSoundPlayer-doesnt-play-sp/10169184. We moved this here as the issue reproduce on .NET too.
have a wav audio file with
Lavf58.29.100
meta tag that is getting an error saying that is not a wav valid audio file, but when using FFMpeg to change the encoding to 59.33.100 and using ADPCM as well, the new wav audio start to work on this code, so i was wondering if this encoding is not supported on System.Media.PlayerSoundusing (var sound = new System.Media.SoundPlayer(path)) { sound.PlaySync(); }
The first image is about the converted audio file, that has Lavf59.33.100 ADPCM Encoding and the second has the Lavf58.29.100.
Reproduction Steps
Try to play any WAV file encoded with
Lavf58.29.100
using (var sound = new System.Media.SoundPlayer(path)) { sound.PlaySync(); }
Expected behavior
The sound will play.
Actual behavior
It fail to play with error message
Regression?
No
Known Workarounds
Convert the WAV file to use other encoding
Configuration
All .NET and .NET Framework versions
Other information
No response