1 VLC简介
VLC是一款自由、开源的跨平台多媒体播放器及框架,可播放大多数多媒体文件,以及DVD、音频CD、VCD及各类流媒体协议。可以播放MPEG-1、MPEG-2、MPEG-4、DivX、DVD/VCD、卫星数字电视频道、地面数字电视频道(digital terrestrial television channels)、在许多作业平台底下透过宽带IPv4、IPv6 网络播放线上影片。
VLC支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影音光盘及各类流式协议。VLC也能作为unicast或multicast的流式服务器在IPv4或IPv6的高速网络连接下使用。VLC融合了FFmpeg计划的解码器与libdvdcss程序库使其有播放多媒体文件及加密DVD影碟的功能。
官方链接: http://www.videolan.org/
类别:播放器
语言:C/C++/Objective-C/QML/Lua
2 鲲鹏环境信息
3 编译前系统依赖安装
3.1 配置本地yum源
注:系统联网情况下,此步骤可忽略。
挂载OS镜像:
执行mv /etc/yum.repos.d /etc/yum.repos.d.bak备份默认yum源,然后mkdir /etc/yum.repos.d/创建/etc/yum.repos.d/路径,执行vim /etc/yum.repos.d/local.repo文件,配置yum本地源:
运行下面的命令,使yum源配置生效:
3.2 安装GCC等相关依赖
yum安装GCC、alsa、yasm等相关依赖:
4 VLC编译依赖安装
4.1 编译安装ffmpeg-4.0
1、进入/hom目录获取ffmpeg-4.0源码
注:如果系统环境无法联网,则手动单击链接https://www.ffmpeg.org/releases/ffmpeg-4.0.tar.gz下载安装包,并上传到系统的/home/目录下。
2、安装ffmpeg-4.0

3、设置PKG_CONFIG_PATH环境变量
在/etc/profile最后一行增加如下内容
然后执行source /etc/profile使环境变量生效。
4.2 编译安装a52dec-0.7.4
1、进入/hom目录获取a52dec-0.7.4源码
注:如果系统环境无法联网,则手动单击链接https://liba52.sourceforge.io/files/a52dec-0.7.4.tar.gz下载安装包,并上传到系统的/home/目录下。
2、修改autotools/config.sub适配aarch64架构


3、安装a52dec-0.7.4

5 VLC编译安装
1、下载VLC 3.0.16源码
注:如果系统环境无法联网,则手动点击http://get.videolan.org/vlc/3.0.16/vlc-3.0.16.tar.xz下载vlc-3.0.16.tar.xz后传到系统/home/路径下。
2、进入解压目录

3、定义临时PKG_CONFIG_PATH变量
4、执行./bootstrap

5、执行./configure

6、执行make或./compile编译

7、执行make install编译安装

6 VLC安装验证
1、创建非root用户,以vlc为例
2、切换到vlc用户
3、查看vlc版本

注:更多帮着查看vlc --help
4、使用vlc播放视频
注:需要在桌面环境下执行(无桌面环境会报“window not available”错误),xxx.mp4为视频文件,如果不在当前路径则需要带绝对路径。
7 参考信息
8 FAQ
1、编译ffmpeg-4.0报nasm/yasm not found or too old错误
【详细描述】:编译ffmpeg-4.0执行./configure报nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.错误,详细报错如下:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

解答:
方法1:
先执行yum -y install yasm或yum -y install nasm安装yasm或nasm
然后再次执行./configure
方法2:
直接执行./configure --disable-x86asm
2、编译vlc 3.0.16执行make过程报relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol等错误
【详细描述】:执行make过程报relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol等错误,具体报错如下:
/usr/bin/ld: /usr/local/lib/libavutil.a(log.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libavutil.a(log.o)(.text+0x28): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:18807: libswscale_plugin.la] Error 1
make[4]: *** Waiting for unfinished jobs....
/usr/bin/ld: /usr/local/lib/libavformat.a(md5proto.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stdout@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libavformat.a(md5proto.o)(.text+0xc0): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stdout@@GLIBC_2.17'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:14981: libavio_plugin.la] Error 1
make[4]: Leaving directory '/home/vlc-3.0.16/modules'
make[3]: *** [Makefile:28009: all-recursive] Error 1
make[3]: Leaving directory '/home/vlc-3.0.16/modules'
make[2]: *** [Makefile:12802: all] Error 2
make[2]: Leaving directory '/home/vlc-3.0.16/modules'
make[1]: *** [Makefile:1559: all-recursive] Error 1
make[1]: Leaving directory '/home/vlc-3.0.16'
make: *** [Makefile:1446: all] Error 2

解答:
1)、重新编译ffmpeg-4.0,先执行CFLAGS=-fPIC ./configure,然后支持make && make install编译;
2)、然后重新编译vlc 3.0.16,先执行./bootstrap,接着执行./configure,然后支持make && make install编译。
1 VLC简介
VLC是一款自由、开源的跨平台多媒体播放器及框架,可播放大多数多媒体文件,以及DVD、音频CD、VCD及各类流媒体协议。可以播放MPEG-1、MPEG-2、MPEG-4、DivX、DVD/VCD、卫星数字电视频道、地面数字电视频道(digital terrestrial television channels)、在许多作业平台底下透过宽带IPv4、IPv6 网络播放线上影片。
VLC支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影音光盘及各类流式协议。VLC也能作为unicast或multicast的流式服务器在IPv4或IPv6的高速网络连接下使用。VLC融合了FFmpeg计划的解码器与libdvdcss程序库使其有播放多媒体文件及加密DVD影碟的功能。
官方链接: http://www.videolan.org/
类别:播放器
语言:C/C++/Objective-C/QML/Lua
2 鲲鹏环境信息
类别
子项
版本
获取地址(方法)
硬件
CPU
Kunpeng 920
iBMC
网络
Ethernet-10GE
iBMC
存储
SATA 4T
iBMC
内存
xxG xxxMHz
iBMC
OS
openEuler
20.03 LTS SP1
cat /etc/os-release
Kernel
4.19.90
cat /proc/version
软件
GCC
7.3.0
参考下面安装说明 gcc -v
OpenJDK
1.8.0_272
参考下面安装说明
VLC
3.0.16
参考下面安装说明
3 编译前系统依赖安装
3.1 配置本地yum源
注:系统联网情况下,此步骤可忽略。
挂载OS镜像:
mkdir /mnt/iso/
mount -o loop /home/openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso /mnt/iso/
执行mv /etc/yum.repos.d /etc/yum.repos.d.bak备份默认yum源,然后mkdir /etc/yum.repos.d/创建/etc/yum.repos.d/路径,执行vim /etc/yum.repos.d/local.repo文件,配置yum本地源:
[local]
name=local
baseurl= file:///mnt/iso
gpgcheck=0
enabled=1
运行下面的命令,使yum源配置生效:
yum clean all
yum makecache
3.2 安装GCC等相关依赖
yum安装GCC、alsa、yasm等相关依赖:
sudo yum install -y gcc gcc-c++ gcc-objc++ alsa* libxml2-devel yasm nasm lua* libmodplug libmpg123 libnfs libxcb-devel libxcb snappy snappy-devel autoconf automake libtool git make cmake openssl openssl-devel zlib zlib-devel bzip2 bzip2-devel bzip2-libs readline readline-devel bison zip unzip tar tcl java-1.8.0* bison* ncurses* wget
4 VLC编译依赖安装
4.1 编译安装ffmpeg-4.0
1、进入/hom目录获取ffmpeg-4.0源码
cd /home/
wget https://www.ffmpeg.org/releases/ffmpeg-4.0.tar.gz
注:如果系统环境无法联网,则手动单击链接https://www.ffmpeg.org/releases/ffmpeg-4.0.tar.gz下载安装包,并上传到系统的/home/目录下。
2、安装ffmpeg-4.0
tar xf ffmpeg-4.0.tar.gz
cd /home/ffmpeg-4.0
CFLAGS=-fPIC ./configure
make -j 64
make install -j 64
3、设置PKG_CONFIG_PATH环境变量
在/etc/profile最后一行增加如下内容
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
然后执行source /etc/profile使环境变量生效。
4.2 编译安装a52dec-0.7.4
1、进入/hom目录获取a52dec-0.7.4源码
cd /home/
wget https://liba52.sourceforge.io/files/a52dec-0.7.4.tar.gz
注:如果系统环境无法联网,则手动单击链接https://liba52.sourceforge.io/files/a52dec-0.7.4.tar.gz下载安装包,并上传到系统的/home/目录下。
2、修改autotools/config.sub适配aarch64架构
vim autotools/config.sub
a.修改下述内容,第263行
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
修改后为:
| x86 | aarch64 | xscale | xscalee[bl] | xstormy16 | xtensa \
b.修改下述内容,第331行
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
修改后为:
| x86-* | aarch64-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
3、安装a52dec-0.7.4
tar xf a52dec-0.7.4.tar.gz
cd /home/a52dec-0.7.4
CFLAGS=-fPIC ./configure --enable-shared
make -j 64
make install -j 64
5 VLC编译安装
1、下载VLC 3.0.16源码
wget http://get.videolan.org/vlc/3.0.16/vlc-3.0.16.tar.xz
tar xf vlc-3.0.16.tar.xz
注:如果系统环境无法联网,则手动点击http://get.videolan.org/vlc/3.0.16/vlc-3.0.16.tar.xz下载vlc-3.0.16.tar.xz后传到系统/home/路径下。
2、进入解压目录
cd vlc-3.0.16/
3、定义临时PKG_CONFIG_PATH变量
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
4、执行./bootstrap
./bootstrap
5、执行./configure
./configure
6、执行make或./compile编译
make -j 64
7、执行make install编译安装
make install -j 64
6 VLC安装验证
1、创建非root用户,以vlc为例
useradd vlc
2、切换到vlc用户
su vlc
3、查看vlc版本
vlc --version
注:更多帮着查看vlc --help
4、使用vlc播放视频
vlc ./xxx.mp4
注:需要在桌面环境下执行(无桌面环境会报“window not available”错误),xxx.mp4为视频文件,如果不在当前路径则需要带绝对路径。
7 参考信息
8 FAQ
1、编译ffmpeg-4.0报nasm/yasm not found or too old错误
【详细描述】:编译ffmpeg-4.0执行./configure报nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.错误,详细报错如下:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
解答:
方法1:
先执行yum -y install yasm或yum -y install nasm安装yasm或nasm
然后再次执行./configure
方法2:
直接执行./configure --disable-x86asm
2、编译vlc 3.0.16执行make过程报relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol等错误
【详细描述】:执行make过程报relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol等错误,具体报错如下:
/usr/bin/ld: /usr/local/lib/libavutil.a(log.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stderr@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libavutil.a(log.o)(.text+0x28): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:18807: libswscale_plugin.la] Error 1
make[4]: *** Waiting for unfinished jobs....
/usr/bin/ld: /usr/local/lib/libavformat.a(md5proto.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `stdout@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libavformat.a(md5proto.o)(.text+0xc0): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stdout@@GLIBC_2.17'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:14981: libavio_plugin.la] Error 1
make[4]: Leaving directory '/home/vlc-3.0.16/modules'
make[3]: *** [Makefile:28009: all-recursive] Error 1
make[3]: Leaving directory '/home/vlc-3.0.16/modules'
make[2]: *** [Makefile:12802: all] Error 2
make[2]: Leaving directory '/home/vlc-3.0.16/modules'
make[1]: *** [Makefile:1559: all-recursive] Error 1
make[1]: Leaving directory '/home/vlc-3.0.16'
make: *** [Makefile:1446: all] Error 2
解答:
1)、重新编译ffmpeg-4.0,先执行CFLAGS=-fPIC ./configure,然后支持make && make install编译;
2)、然后重新编译vlc 3.0.16,先执行./bootstrap,接着执行./configure,然后支持make && make install编译。