[FFmpeg-trac] #6891(ffplay:new): FFplay: WASAPI can't initialize audio client (zeranoe's FFmpeg 3.4 MS Windows binaries)
FFmpeg
trac at avcodec.org
Mon Dec 4 07:23:32 EET 2017
#6891: FFplay: WASAPI can't initialize audio client (zeranoe's FFmpeg 3.4 MS
Windows binaries)
-------------------------------------+-------------------------------------
Reporter: unknown | Type: defect
Status: new | Priority: normal
Component: ffplay | Version:
Keywords: ffplay | unspecified
windows win32 sdl_openaudio | Blocked By:
wasapi coinitialize | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
When I try to play an audio file with ffplay, it fails with errors such as
this one:
{{{
SDL_OpenAudio (1 channels, 48000 Hz): WASAPI can't initialize audio
client: No se ha llamado a CoInitialize.
}}}
How to reproduce:
{{{
C:\Users\Public\Documents>ffplay.exe C:\Users\Public\Documents\test.mp3
ffplay version 3.4 Copyright (c) 2003-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-
version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls
--enable-iconv --enable-libass --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-
libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-
libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-
libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma
--enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis
--enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-
dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mp3, from 'C:\Users\Public\Documents\test.mp3': 0B f=0/0
Metadata:
encoder : Lavf53.32.100
Duration: 01:00:00.26, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p, 128 kb/s
SDL_OpenAudio (2 channels, 48000 Hz): WASAPI can't initialize audio
client: No se ha llamado a CoInitialize.
SDL_OpenAudio (1 channels, 48000 Hz): WASAPI can't initialize audio
client: No se ha llamado a CoInitialize.
SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can't initialize audio
client: No se ha llamado a CoInitialize.
SDL_OpenAudio (1 channels, 44100 Hz): WASAPI can't initialize audio
client: No se ha llamado a CoInitialize.
No more combinations to try, audio open failed
Failed to open file 'C:\Users\Public\Documents\test.mp3' or configure
filtergraph
nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
}}}
Last working version: ffplay from ffmpeg-20170921-183fd30-win32-shared
There is a workaround to this issue, according to this
[https://stackoverflow.com/questions/46835811/ffplay-wasapi-cant-
initialize-audio-client-ffmpeg-3-4-binaries question] at
''stackoverflow'':
{{{
A workaround is to specify an alternate output driver.
Set SDL_AUDIODRIVER environment variable value to the
driver you want to use. Under windows 7, directsound
and winmm both solved my issue.
}}}
And there is a
[https://ffmpeg.zeranoe.com/forum/viewtopic.php?t=5192#p12845 proposed
fix] to this issue at ''ffmpeg.zeranoe.com'' forum:
{{{
Re: I can't run ffplay because of errors of SDL_OpenAudio
Post by jackyxinli ยป Wed Nov 29, 2017 2:43 am
I find a new method to resolve this problem, the ffplay
not call CoInitialize according to error message. So,
add code to call CoInitialize, ffplay can work. And the
same time, I checked SDL2's source code, the WASAPI
module doesn't set member ProvidesOwnCallbackThread, so
SDL2 should call CoInitialize before open audio device.
But no idea why ffplay gives us this error message.
here is my modification look like.
#ifdef _WIN32
#include <windows.h>
#endif
static int audio_open(void *opaque, int64_t wanted_channel_layout, int
wanted_nb_channels, int wanted_sample_rate, struct AudioParams
*audio_hw_params)
{
......
#ifdef _WIN32
CoInitialize(NULL);
#endif
while (!(audio_dev = SDL_OpenAudioDevice(NULL, 0, &wanted_spec, &spec,
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))) {
......
}
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6891>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list