我是靠谱客的博主 结实心情,最近开发中收集的这篇文章主要介绍linux安装ffmpeg,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

 

1、下载解压

wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz

tar -zxvf ffmpeg-3.1.tar.gz

2、 进入解压后目录,输入如下命令/usr/local/ffmpeg为自己指定的安装目录

cd ffmpeg-3.1

./configure --prefix=/usr/local/ffmpeg

make && sudo make install

3、配置变量

vi /etc/profile

在最后PATH添加环境变量:

export PATH=$PATH:/usr/local/ffmpeg/bin

保存退出

查看是否生效

source /etc/profile  设置生效

4、查看版本

ffmpeg -version    查看版本

FFmpeg编译

  1. 下载代码:git clone https://git.ffmpeg.org/ffmpeg.git
  2. 然后输入命令进行编译:找到下载的目录下,然后用命令进入这个文件夹下cd ffmpeg,然后输入./configure。
  3. 竟然没有编译过出现错误是
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.

分析:yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm时,就会报上面错误。

解决错误:安装yasm编译器。安装方法如下:

 

1)下载:wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

tar -zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure

make && sudo make install(提示:Permission denied,就执行sudo make install)

 

  1. 安装成功yasm你可以在进入到ffmpeg的文件夹下,进行./configure
  2. make
  3. make install(提示:Permission denied,就执行sudo make install)
  4. 然后打出ffmpeg
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration:
libavutil
56. 22.100 / 56. 22.100
libavcodec
58. 35.100 / 58. 35.100
libavformat
58. 20.100 / 58. 20.100
libavdevice
58.
5.100 / 58.
5.100
libavfilter
7. 40.101 /
7. 40.101
libswscale
5.
3.100 /
5.
3.100
libswresample
3.
3.100 /
3.
3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'

这样ffmpeg就安装成功了。

ffplay: command not found
如果你要用到ffplay的时候,发现没有这个命令的时候,是因为ffplay和ffmpeg不是在一起的,需要单独下载。ffplay下载地址 http://evermeet.cx/ffmpeg/ 。把下载下来的文件双击打开运行,如果提示Permission denied,到系统偏好设置,打开安全与隐私,允许ffplay运行就可以了。运行完之后,再在.bash_profile文件配置ffplay path就可以了(这个路径就是ffplay文件的位置)。

./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-small --arch=x86_64 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-shared --enable-libfreetype

##安装libx264
下载地址http://download.videolan.org/pub/videolan/x264/snapshots/
./configure --enable-shared
#make
#make install

libfdk_aac not found

fdk_aac 下载地址https://sourceforge.net/projects/opencore-amr/files/fdk-aac/
1.解压缩
2.
./configure
3. make
4. make install (sudo make install)

 

最后

以上就是结实心情为你收集整理的linux安装ffmpeg的全部内容,希望文章能够帮你解决linux安装ffmpeg所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部