Linux视频编解码库,Ubuntu 18.04 FFMPEG最新版本安装总结

安装ffmpeg,发现过程还是挺复杂的,安装过程中遇到不少问题,一一解决后,总结了详细的安装过程

1、安装各种库:

sudo apt-get install -y autoconf automake build-essential git libass-dev libfreetype6-dev libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev

sudo apt-get install -y yasm cmake mercurial

2、安装ysam

git clone git://github.com/yasm/yasm.git

cd yasm

./configure

make

sudo make install

3、下载安装最新版nasm:Index of /pub/nasm/releasebuilds/2.13.03

解压后,进入目录,执行:

./configure

make

sudo make install

4、安装x264

git clone VideoLAN / x264 · GitLab - 如果超时,到Download - The Yasm Modular Assembler Project下载

cd x264.git

./configure --enable-shared --enable-static

sudo make install

5、安装ffmpeg

下载:Download FFmpeg,解压后,进入目录,执行:

./configure --enable-static --enable-shared --enable-ffmpeg --enable-libx264 --enable-gpl

make

sudo make install

make时间很长。

instal以后,执行ffmpeg会失败:

ffmpeg: error while loading shared libraries: libavdevice.so.59: cannot open shared object file: No such file or directory

6、修改环境变量

sudo gedit /etc/ld.so.conf

打开文本后,加入如下路径:

/usr/local/lib/

#最后面的斜杠一定要带上,别忘了!

#该路径为libavdevice.so.59所在路径

sudo ldconfig

至此,终于能运行ffmpeg了。

$ ffmpeg
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --enable-static --enable-shared --enable-ffmpeg --enable-libx264 --enable-gpl
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
 

也可以播放一个视频试试:

$ ffplay media1.mp4

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu 18.04安装ffmpeg,你可以按照以下步骤进行操作: 1. 首先,确保你已经安装了必要的编译工具和依赖项。你可以使用以下命令安装它们: ```shell sudo apt-get update sudo apt-get install build-essential ``` 2. 下载ffmpeg的源代码。你可以在官方网站或者其他可信的资源中找到最新版本的源代码。 3. 解压下载的源代码文件。你可以使用以下命令进入解压后的文件夹: ```shell cd ffmpeg-<version> ``` 4. 配置和编译ffmpeg。你可以按照以下命令依次执行: ```shell ./configure make sudo make install ``` 5. 安装完成后,你可以通过以下命令检查ffmpeg是否成功安装: ```shell ffmpeg -version ``` 如果你想卸载或重新安装ffmpeg,你可以按照以下步骤进行操作: 卸载ffmpeg: 1. 删除相关的软链接: ```shell sudo rm /usr/bin/ffmpeg sudo rm /usr/bin/ffprobe ``` 2. 清空环境变量中修改的地方并更新: ```shell sudo ldconfig ``` 重新安装ffmpeg: 1. 如果你需要更新、回退或增加支持,你可以按照以下步骤进行操作: - 删除ffbuild目录下带"config"字段的文件:`rm ffmpeg-<version>/ffbuild/config` - 删除相关的软链接: ```shell sudo rm /usr/bin/ffmpeg sudo rm /usr/bin/ffprobe ``` - 重新编译和安装ffmpeg: ```shell cd ffmpeg-<version> ./configure make sudo make install ``` - 配置ffmpeg依赖环境并更新环境变量: ```shell sudo nano /etc/ld.so.conf ``` 在打开的文件中添加ffmpeg所在的目录,保存并关闭文件。然后运行以下命令更新环境变量: ```shell sudo ldconfig ``` 通过以上步骤,你可以在Ubuntu 18.04安装、卸载或重新安装ffmpeg。请根据你的需求选择相应的操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu 18.04 安装FFmpeg](https://blog.csdn.net/weixin_43804210/article/details/108198399)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Ubuntu 18.04 安装ffmpeg(支持GPU硬件加速)](https://blog.csdn.net/txf1931783593/article/details/128250457)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值