linux ffmpeg 源码编译及运行

一、下载

我在华为openEuler 20.03 LTS linux测试通过。
wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar -xvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
上面速度慢的可以在下面下载
git clone https://gitee.com/mirrors/ffmpeg
===========================================
FFmpeg常用模块
libavformat   格式库
libavcodec    音视频库
libavfilter   字幕滤镜库
libswscale    图像转换库
libswresample 采样库
libavutil     工具库
==============================================

二、编译

sudo yum install yasm nasm

./configure --help里面可选项有很多,按需选择,基本安装如下:

./configure --enable-shared --prefix=/usr
make -j16
sudo make install

编译时所需要依赖基础包估计有几十个,太多了,当时没有记录,按提示逐个安装就可以了。

/usr/bin/ld: libavcodec/mqc.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libavcodec/mqcdec.o: relocation R_X86_64_32S against symbol `ff_mqc_qe' can not be used when making a shared object; recompile with -fPIC
有上面类错误提示,添加参数
./configure --prefix=/usr --enable-shared --enable-gpl --enable-pic --extra-cflags="-fPIC"

三、运行参数

$ ffplay -version
ffplay version N-101113-g04dfdde Copyright (c) 2003-2021 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --prefix=/usr
libavutil      56. 65.100 / 56. 65.100
libavcodec     58.123.100 / 58.123.100
libavformat    58. 67.100 / 58. 67.100
libavdevice    58. 12.100 / 58. 12.100
libavfilter     7.107.100 /  7.107.100
libswscale      5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100

-version显示版本内容

-help 几千个帮助解释。

-x 300横大小

-y 200竖大小

-autoexit播放自动退出

扫描二维码关注公众号,回复: 13135090 查看本文章

-window_title "测试“窗口标题

-exitonkeydown键盘按键退出

-exitonmousedown鼠标点击退出

-nodisp关闭图形显示

-noborder无边框

-nostats无状态

-showmode 0或1或2显示模式

-loop 0播放循环次数0为永久

 -hide_banner 隐藏欢迎语

用法

ffplay song.mp3不用启动桌面可以在纯命令行运行。

ffplay tassel.mp3 -showmode 2 -loop 0

ffplay tassel.mp3 -nostats -nodisp -noborder

q esc 退出

m静音

p 空格暂停

猜你喜欢

转载自blog.csdn.net/lenovo8088/article/details/114004687