当前位置: 首页 > 技术支持 > 服务器维护>> Linux安装ffmpeg具体步骤

Linux安装ffmpeg具体步骤

Linux安装ffmpeg具体步骤

Linux如何安装ffmpeg?Fmpeg 是领先的多媒体框架,能够解码、编码、转码、混合、解密、流媒体、过滤和播放人类和机器创造的几乎所有东西。它支持最晦涩的古老格式,直到最尖端的格式,下面为大家分享一下Linux安装ffmpeg具体步骤。

  • 1.Linux下安装ffmpeg
 官网下载:http://ffmpeg.org/download.html
  • 2.下载之后上传至Linux准备安装,首先解压安装包
 tar -xjvf ffmpeg-4.1.tar.bz2`   `cd ffmpeg-4.1/
  • 3.如果现在执行configure配置的话,可能会报如下的错误:
     [root@slave ffmpeg-4.1]# ./configure   gcc is unable to create an executable file.   If gcc is a cross-compileruse the --enable-cross-compile option.   Only do this if you know what cross compiling means.   C compiler test failed.      If you think configure made a mistakemake sure you are using the latest   version from Git.  If the latest version failsreport 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/nasm 包不存在或者很旧,可以使用–disable-yasm禁用这个选项编译,yasm是一款汇编器,并且是完全重写了nasm的汇编环境,接收nasm和gas语法,支持x86和amd64指令集,所以这里安装一下yasm即可

  • 4.Linux下安装yasm
 官网下载:http://yasm.tortall.net/Download.html
  • 5.下载之后上传至Linux准备安装,解压、安装
 tar -xvzf yasm-1.3.0.tar.gz`   `cd yasm-1.3.0/`   `./configure`   `make`   `make install
  • 6.安装成功之后继续回到ffmpeg解压后的目录,执行下面命令编译并安装
 ./configure --enable-shared --prefix=/opt/ffmpeg`   `make`:编译过程有点长   `make install
  • 7.make install会把ffmpeg相关执行程序、头文件、lib库安装在/opt/ffmpeg/

耐心等待完成之后执行 cd /opt/ffmpeg/ 进入安装目录,查看一下发现有bin,include,lib,share这4个目录 bin是ffmpeg主程序二进制目录 include是C/C++头文件目录 lib是编译好的库文件目录 share是文档目录

  • 8.然后进入bin目录,执行

./ffmpeg -version 查看当前版本的详细信息,默认情况下一般会报

 libavdevice.so.57: cannot open shared object file: No such file or directory

原因是lib目录未加载到链接到系统库中 系统ld目录列表在/etc/ld.so.conf中,打开文件会发现, 里面引用了/etc/ld.so.conf.d/下面所有的.conf文件,比如mariadb-x86_64.conf

  • 9.创建一个文件并写入lib路径即可

执行命令:vim /etc/ld.so.conf.d/ffmpeg.conf 然后添加一行内容:/opt/ffmpeg/lib 之后保存并退出,然后执行 ldconfig使配置生效, 现在再次执行./ffmpeg -version 显示就正常了

 [root@slave ffmpeg-4.1]#  ffmpeg -ersion   ffmpeg version 4.1 Copyright (c2000-2018 the FFmpeg developers   built with gcc 4.8.5 (GCC20150623 (Red Hat 4.8.5-28)   configuration: --enable-shared --prefix=/opt/ffmpeg-4   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
  • 10.配置环境变量

vim /etc/profile:编辑写入 PATH=/opt/python364/bin/:/opt/ffmpeg-4/bin/:$PATH source /etc/profile:重新读取文件使其生效

  • 11.检测使用
    • which ffmpeg或者直接输入

    • ffmpeg或者使用文件进行测试(文件自备)

    • ffmpeg -y -i a.wav -acodec pcm_s16le -f s16le -ac 1 -ar 16000 b.wav.pcm

以上就是良许教程网为各位朋友分享的Linux系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你!

本文来源:www.lxlinux.net/2588.html,若引用不当,请联系修改。


服务器购买/咨询热线:1563700917115617636856

本文链接:http://43.134.181.216/jishuzhichiyuweihu/14696.html
tags:LinuxVPSLinux系统HTTPHTTPSHTMLOSSPythonUbuntuAMD
腾讯云服务器特惠

  • 关注微信
是否收录:

猜你喜欢

微信公众号