**windows使用ffplay播放没有声音**
ffplay播放没有声音SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can’t initialize audio client
在window7 64bit下安装了ffmpeg,然后用ffplay命令播放声音时发生这个错误:
SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can’t initialize audio client
那么只能播放视频图像而不能播放视频声音。
在SO上找到解决方法:resolve
只要设置环境一个变量SDL_AUDIODRIVER=directsound或者winmm即可,那么就可以播放了。原因不清楚,可能跟sdl库有关吧
写一个start.bat加入下面代码:
set SDL_AUDIODRIVER=directsound
使用mingw环境终端播放时,可以在msys.bat文件第一行中写入:
set SDL_AUDIODRIVER=directsound
使用MSYS2环境,在msys2.ini中加入:
SDL_AUDIODRIVER=directsound
ffmpeg官网解决方案
@转载 http://trac.ffmpeg.org/ticket/6891
#6891 new defect
FFplay: WASAPI can’t initialize audio client (zeranoe’s FFmpeg 3.4 MS Windows binaries)
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 © 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 -