ffmpeg:SDL编译,相关问题解决

ffmpeg调用SDL相关问题解决

简介

最近在做一些关于视频的工作,ffmpeg编译一些相关的事情,说一下碰到的问题。

编译:

SDL2版本:SDL2.0.8

	(注意:SDL 依赖与X11,Xorg库,检查是否存在,不存在,安装)
		1)./configure –prefix=/usr/local/
		2)chmod 777 configure
		3)make 
		4)make install 

相关问题:

1.Could not initialize SDL - No available video device (Did you set the DISPLAY variable?)
SDL初始化,失败不能找到视频驱动。
解决方案:
安装X11,XORG相关库Lib
2.SDL_OpenAudio (2 channels, 44100 Hz): WASAPI can’t initialize audio client
SDL打开音频通道,不能初始化音频服务。
解决方案:
安装ALSA音频驱动
3.ALSA:Couldn’t open audio dedvice:Connection refused
不能打开音频驱动,拒绝访问。
解决方案

1.先去打开声音驱动 - system->preferences->Sound
2.如果出现:waiting sound system to respond
3.然后:检测pulseaudio 是否启动:ps -A|grep pulseaudio 如果有打印消息索引出现:例如: 3284 ? 00:00:01 pulseaudio
如果没出现,说明没有打开。
4.运行:sudo usermod -a -G pulse-access root (在终端中将root加到pulse-access组)
或者 pulseaudio --start -D (测试没有问题)
5.解释:root是超级管理员,主要是用来管理的,所以默认没有声音权限

4.ALSA: Couldn’t open audio device: No such device

1.查看环境变量: export ,确认 SDL_AUDIODRIVER没有设置为alsa
2.export SDL_AUDIODRIVER=alsa
3.export AUDIODEV=pulse
4.export SDL_AUDIODRIVER=alsa 设置SDL声音驱动:ALSA export AUDIODEV=pulse 设置audiodev为脉冲

详细说明:

在执行‘“./configure --prefix=/use/local”命令时,最后打印消息如下了两种:

SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss
Video drivers   : dummy opengl_es2 vulkan
Input drivers   : linuxev linuxkd
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss alsa(dynamic) (音频库)
Video drivers   : dummy x11(dynamic) opengl opengl_es2 vulkan (视频库)
X11 libraries   : xdbe xrandr xshape xvidmode
Input drivers   : linuxev linuxkd
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO

第一个打印消息,为音视频全不能播放,第二个全部都可以。两个打印消息对比:发现有几处不同, Audio drivers ,Video drivers。
alsa(dynamic):alsa驱动,动态音频播放

Audio drivers   : disk dummy oss alsa(dynamic) 
Audio drivers   : disk dummy oss

X11 视频动态播放

Video drivers   : dummy x11(dynamic) opengl opengl_es2 vulkan 
X11 libraries   : xdbe xrandr xshape xvidmode

Video drivers   : dummy opengl_es2 vulkan

相关库获取如下:
我的系统是Centos,为了把相关包保留所以都下载到本地,如果不知道用哪些包,打印相关列表,对比系统版本,自己的所需的库版本,对应下载,或直接安装。
下载SDL依赖包,如果支持在线安装,直接安装就可以,然后在编译自己所需版本,迭代替换就可以。

yum list *SDL* /*SDL相关包列表*/
yum install --downloadonly --downloaddir=/home/SDLpack SDL-devel.x86_64 /*下载SDL依赖包到本地*/
yum install --downloadonly --downloaddir=/home/pack/xorg-x11-pack/ xorg-x11-server-devel /*下载xorg-x11服务驱动依赖包到本地*/

相关网址:

https://www.gog.com/forum/thimbleweed_park/linux_unable_to_init_sdl_mixer_alsa_couldnt_open_audio_device_no_such_device
https://www.baidu.com/link?url=QjevLZqfr7E4-sOrX_1VwCTa1F8P7dOGUteEOQ-gfSUmc5lLxfIjTMPyhQrudjjrkzQYmIT6rnBrLA1-WjJ_q_&wd=&eqid=e31f58750006258e000000025d1dc909
https://segmentfault.com/a/1190000008549666

其他(注意事项)

在做一些开源库编译时,注意配置文件打印消息,查看本地是否缺少一些主要依赖库。在SDL遇到一些问题时,根据提示消息,如果是系统问题,解决系统问题,如果不是SDL自身问题,返回配置编译环境,查看相关打印消息

SDL依赖库包下载地址

SDL依赖库

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值