1,在Win10上安装了VirtualBox,安装了Ubuntu16.0.4以后,想安装ffmpeg。但是编译完成后出现了sdl-init错误,提示如下所示:
Could not initialize SDL - No available video device
(Did you set the DISPLAY variable?)
如下图所示:
2,在网上找了很多资料,一般都是如下的方法:
环境:ubuntu10.04
问题1:编译不生成ffplay
ffplay依赖sdl,安装之前要先安装SDL。
下载地址:http://www.libsdl.org/download-1.2.php
问题2:ffplay不可用,不能播放视频。
“SDL:”
x86下需要安装x11的库文件,才能加载视频设备。
下载安装
sudo apt-get install libx11-dev
sudo apt-get install xorg-dev
这些方法对我的问题没有用,贴出来也算是一种解决方法,看对大家是不是有用。
3,我的环境是:win10操作系统,VirtualBox版本 5.0.24 r108355,Ubuntu16.04。如下图:
4,我的ffmpeg配置参数为:
./configure --enable-static --enable-version3 --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libilbc --enable-libvpx --enable-libx264 --enable-libopenjpeg --enable-pic --enable-libass --enable-libvpx --enable-libx265
如果配置编译ffmpeg有错误,可以在我的博客里面找到各个错误的解决办法。下面是解决
Could not initialize SDL - No available video device
(Did you set the DISPLAY variable?)的解决方法;
5,解决Could not initialize SDL - No available video device (Did you set the DISPLAY variable?):
(1)上 https://www.libsdl.org/download-1.2.php,下载SDL-1.2.15.tar.gz,解压后进入SDL-1.2.15。
(2)执行
./configure --enable-video-x11 --enable-x11-shared --enable-video-x11-vm
会报错,如下:
l -c ./src/main/dummy/SDL_dummy_main.c -o build/SDL_dummy_main.o >/dev/null 2>&1
./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for ‘_XData32’ SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
^
./src/video/x11/SDL_x11dyn.c:95:5: note: in definition of macro ‘SDL_X11_SYM’ rc fn params { ret p##fn args ; }
^
In file included from ./src/video/x11/SDL_x11dyn.h:34:0,
from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlibint.h:568:12: note: previous declaration of ‘_XData32’ was here
extern int _XData32(
build-deps:1154: recipe for target 'build/SDL_x11dyn.lo' failed
make: *** [build/SDL_x11dyn.lo] Error 1
make: *** Waiting for unfinished jobs....
解决办法:
vi src/video/x11/SDL_x11sym.h
跳到168行,将
SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
修改为
SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
执行:
make -j32 && sudo make install
编译完成。
6,重新进入ffmpeg,执行
./configure --enable-static --enable-version3 --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libilbc --enable-libvpx --enable-libx264 --enable-libopenjpeg --enable-pic --enable-libass --enable-libvpx --enable-libx265
make -32 && sudo make install
7,可以正常播放了。