Ubuntu 16.04下安装ffmpeg和opencv的安装与简介
文章目录
- ffmpeg简介
- 资料准备
- 0. 检查依赖yasm与gcc,以及pkg-config
- 1. 下载ffmpeg
- 2. 解压进入解压目录
- 3. 准备执行编译配置操作,执行如下操作
- 4. 编译与安装
- 5. 检查安装情况
- 5.1 这里有两个问题:
- 5.2 执行细节如下:
- 6. ffmpeg -version出现 ffmpeg command not found解决办法
- 7. 安装opencv
- 参考链接
ffmpeg简介
关于音视频解码的学习内容:推荐雷神的音频视频编解码的学习地址!
ffmpeg一种完整的跨平台解决方案,用于录制,转换和流式传输音频和视频
编译好的windows可用版本的下载地址(官网中可以连接到这个网站,和官方网站保持同步): http://ffmpeg.zeranoe.com/builds/
该网站中的FFMPEG分为3个版本:Static,Shared,Dev。
缩略语 | 全称 | 中文名字 |
---|---|---|
ffmpeg | fast forward mpeg | 音频转换器 |
ffplay | fast forward play | 用ffmpeg实现的播放器 |
ffserver | fast forward server | 用ffmpeg实现的rstp服务器 |
资料准备
名称 | 值 | 描述 |
---|---|---|
gcc | gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 | c编译器 |
linux | Ubuntu 6.04 | 操作系统 |
yasm | yasm 1.3.0 | 汇编编译器 |
源码 | git clone https://github.com/FFmpeg/FFmpeg.git | (Github)源码 |
源码 | http://ffmpeg.org/download.html#build-linux | (官网)源码 |
二进制文件(win) | http://ffmpeg.zeranoe.com/builds/ | 二进制程序 |
注: 18.04 直接执行命令: sudo apt install ffmpeg
就可以了;
但是!默认安装的ffmpeg是3.7版本,对ffmpeg版本有要求的不建议使用此方法。
0. 检查依赖yasm与gcc,以及pkg-config
linux默认安装了gcc,如果你确实没有安装gcc,那么你需要安装一下gcc;
FFmpeg中有部分汇编代码,因此需要编译该部分代码,安装yasm即可,你可以认为yasm就是一个汇编编译器,安装 yasm 的目的在于提高 ffmpeg 的编译速度。
root@test-2288H-V5:~# yasm --version
yasm 1.3.0
Compiled on May 6 2015.
Copyright (c) 2001-2014 Peter Johnson and other Yasm developers.
Run yasm --license for licensing overview and summary.root@test-2288H-V5:~# gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
如果没有就安装
# apt-get install yasm
# apt-get install gcc
检查pkg-config
如果显示以下信息,请参考我另一篇博文《Ubuntu 16.04 下pkg-config的安装与简介》
注: 18.04 直接执行命令: sudo apt-get install pkg-config
就可以了
root@test-2288H-V5:/home/wang/ffmpeg-4.2# pkg_config
bash: pkg_config: command not found
1. 下载ffmpeg
下载地址1:https://ffmpeg.org/download.html#releases
下载地址2:https://pkgs.org/download/ffmpeg
下载地址3以及安装说明:http://www.linuxfromscratch.org/blfs/view/svn/multimedia/ffmpeg.html
2. 解压进入解压目录
注: 建议下载这个tar -jxvf ffmpeg-4.2.tar.bz2
;我这 tar.gz
不能编译。。。
tar -jxvf ffmpeg-4.2.tar.bz2
cd ffmpeg-4.2
详细信息
root@test-2288H-V5:/home/wang# cd ffmpeg-4.2
root@test-2288H-V5:/home/wang/ffmpeg-4.2# ll
total 640
drwx------ 18 test test 4096 8月 6 05:11 ./
drwxr-x--- 3 wang wang 4096 8月 16 23:51 ../
-rw-r----- 1 test test 61453 8月 6 04:52 Changelog
drwxr-xr-x 12 test test 4096 8月 6 04:52 compat/
-rwxr-xr-x 1 test test 251982 8月 6 05:11 configure*
-rw-r--r-- 1 test test 418 11月 2 2018 CONTRIBUTING.md
-rw-r--r-- 1 test test 18092 3月 29 2016 COPYING.GPLv2
-rw-r--r-- 1 test test 35147 3月 29 2016 COPYING.GPLv3
-rw-r--r-- 1 test test 26526 3月 29 2016 COPYING.LGPLv2.1
-rw-r--r-- 1 test test 7651 3月 29 2016 COPYING.LGPLv3
-rw-r--r-- 1 test test 274 3月 29 2016 CREDITS
drwxr-xr-x 4 test test 4096 8月 6 04:52 doc/
drwxr-xr-x 2 test test 4096 8月 6 04:52 ffbuild/
drwxr-xr-x 2 test test 4096 8月 6 04:52 fftools/
-rw-r--r-- 1 test test 50 7月 9 01:45 .gitattributes
-rw-r----- 1 test test 596 8月 6 04:52 INSTALL.md
drwxr-xr-x 14 test test 45056 8月 6 04:52 libavcodec/
drwxr-xr-x 3 test test 4096 8月 6 04:52 libavdevice/
drwxr-xr-x 6 test test 20480 8月 6 04:52 libavfilter/
drwxr-xr-x 3 test test 20480 8月 6 04:52 libavformat/
drwxr-xr-x 6 test test 4096 7月 9 01:45 libavresample/
drwxr-xr-x 12 test test 12288 8月 6 04:52 libavutil/
drwxr-xr-x 2 test test 4096 8月 6 04:52 libpostproc/
drwxr-xr-x 6 test test 4096 8月 6 04:52 libswresample/
drwxr-xr-x 7 test test 4096 8月 6 04:52 libswscale/
-rw-r----- 1 test test 3825 8月 6 04:52 LICENSE.md
-rw-r----- 1 test test 29540 8月 6 04:52 MAINTAINERS
-rw-r----- 1 test test 5633 8月 6 04:52 Makefile
drwxr-xr-x 2 test test 4096 3月 29 2016 presets/
-rw-r--r-- 1 test test 1790 7月 9 01:45 README.md
-rw-r----- 1 test test 4 8月 6 04:52 RELEASE
-rw-r----- 1 test test 830 8月 6 04:52 RELEASE_NOTES
drwxr-xr-x 7 test test 4096 8月 6 04:52 tests/
drwxr-xr-x 3 test test 4096 8月 6 04:52 tools/
-rw-r----- 1 test test 531 8月 6 04:52 .travis.yml
-rw-r----- 1 test test 4 8月 6 05:11 VERSION
3. 准备执行编译配置操作,执行如下操作
注: 如果是要装多个ffmpeg
, 把这个配置修改为:
./configure --prefix=/home/xxx/tools/ffmpegxxx --enable-shared --enable-pic install
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-pic install
root@test-2288H-V5:/home/wang/ffmpeg-4.2# ./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-pic
install
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
standalone assembly yes
x86 assembler yasm
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AESNI enabled yes
AVX enabled yes
AVX2 enabled yes
4. 编译与安装
make
sudo make install
细节如下:
License: LGPL version 2.1 or later
root@test-2288H-V5:/home/wang/ffmpeg-4.2# make
GEN libavutil/libavutil.version
GEN libswscale/libswscale.version
GEN libswresample/libswresample.version
GEN libavcodec/libavcodec.version
GEN libavformat/libavformat.version
GEN libavfilter/libavfilter.version
GEN libavdevice/libavdevice.version
CC libavdevice/alldevices.o
CC libavdevice/avdevice.o
libavdevice/avdevice.c: In function ‘device_next’:
libavdevice/avdevice.c:88:13: warning: ‘av_oformat_next’ is deprecated [-Wdeprecated-declarations]if (!(prev = av_oformat_next(prev)))^
In file included from libavdevice/avdevice.h:51:0,from libavdevice/avdevice.c:23:
./libavformat/avformat.h:2095:17: note: declared hereAVOutputFormat *av_oformat_next(const AVOutputFormat *f);^
libavdevice/avdevice.c:92:13: warning: ‘av_iformat_next’ is deprecated [-Wdeprecated-declarations]if (!(prev = av_iformat_next(prev)))
root@test-2288H-V5:/home/wang/ffmpeg-4.2# sudo make install
INSTALL libavdevice/libavdevice.a
INSTALL libavdevice/libavdevice.so
STRIP install-libavdevice-shared
INSTALL libavfilter/libavfilter.a
INSTALL libavfilter/libavfilter.so
STRIP install-libavfilter-shared
INSTALL libavformat/libavformat.a
INSTALL libavformat/libavformat.so
STRIP install-libavformat-shared
INSTALL libavcodec/libavcodec.a
INSTALL libavcodec/libavcodec.so
STRIP install-libavcodec-shared
INSTALL libswresample/libswresample.a
INSTALL libswresample/libswresample.so
STRIP install-libswresample-shared
INSTALL libswscale/libswscale.a
INSTALL libswscale/libswscale.so
STRIP install-libswscale-shared
INSTALL libavutil/libavutil.a
INSTALL libavutil/libavutil.so
STRIP install-libavutil-shared
INSTALL doc/ffmpeg.1
这里有warning,查了一些资料emmm不好不好,有大佬知道如何解决,可以附在评论,我学习一下,完善资料。
5. 检查安装情况
5.1 这里有两个问题:
资料说必须到安装所在的文件夹查看版本信息,当我执行 :ffmpeg --version
时
报错:
Unrecognized option '-version'.
Error splitting the argument list: Option not found
当我执行 :ffmpeg -version
时
不会报错。。。
root@test-2288H-V5:/home/wang/ffmpeg-4.2# /usr/local/ffmpeg/bin/ffmpeg -version
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --prefix=/usr/local/ffmpeg --enable-shared --enable-pic
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
5.2 执行细节如下:
root@test-2288H-V5:/home/wang/ffmpeg-4.2# /usr/local/ffmpeg/bin/ffmpeg --version
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developersbuilt with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609configuration: --prefix=/usr/local/ffmpeg --enable-shared --enable-piclibavutil 56. 31.100 / 56. 31.100libavcodec 58. 54.100 / 58. 54.100libavformat 58. 29.100 / 58. 29.100libavdevice 58. 8.100 / 58. 8.100libavfilter 7. 57.100 / 7. 57.100libswscale 5. 5.100 / 5. 5.100libswresample 3. 5.100 / 3. 5.100
Unrecognized option '-version'.
Error splitting the argument list: Option not found
root@test-2288H-V5:/home/wang/ffmpeg-4.2# /usr/local/ffmpeg/bin/ffmpeg -version
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --prefix=/usr/local/ffmpeg --enable-shared --enable-pic
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
root@test-2288H-V5:/home/wang/ffmpeg-4.2# /usr/local/ffmpeg/bin/ffmpeg -help
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developersbuilt with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609configuration: --prefix=/usr/local/ffmpeg --enable-shared --enable-piclibavutil 56. 31.100 / 56. 31.100libavcodec 58. 54.100 / 58. 54.100libavformat 58. 29.100 / 58. 29.100libavdevice 58. 8.100 / 58. 8.100libavfilter 7. 57.100 / 7. 57.100libswscale 5. 5.100 / 5. 5.100libswresample 3. 5.100 / 3. 5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...Getting help:-h -- print basic options-h long -- print more options-h full -- print all options (including all format and codec specific options, very long)-h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsfSee man ffmpeg for detailed description of the options.
6. ffmpeg -version出现 ffmpeg command not found解决办法
如果显示以下信息,请参考我另一篇博文《ffmpeg 检查版本:ffmpeg -version出现 ffmpeg command not found解决办法》
7. 安装opencv
这里就简单了
依赖:opencv2.4版本以上
为达到减少验证工作量的目的,这里样例在ubuntu16.04上验证基本功能,安装opencv使用apt工具,安装步骤如下:
$ sudo apt update
$ sudo apt install libopencv-dev python-opencv
安装结束。检查一下是否安装成功:
$ pkg-config --modversion opencv
结果输出:
2.4.9.1
最后检测版本如果报错,记得在~/.bashrc
添加环境变量。
或者直接export PKG_CONFIG_PATH=/path/of/opencv.pc
不太懂的,可以参考这个地址。
参考链接
- 下载地址1:https://ffmpeg.org/download.html#releases
- 下载地址3:https://pkgs.org/download/ffmpeg
- 下载地址2,以及安装说明:http://www.linuxfromscratch.org/blfs/view/svn/multimedia/ffmpeg.html
- ffmpeg使用博客:https://blog.csdn.net/leixiaohua1020
- https://www.it399.com/blog/ffmpeg/201807011604
- https://blog.csdn.net/openswc/article/details/52575742
- https://www.jianshu.com/p/ec941193ac79?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
- https://blog.csdn.net/zhangwu1241/article/details/52354604
- https://prateekvjoshi.com/2013/10/18/package-opencv-not-found-lets-find-it/
Ubuntu 16.04下安装ffmpeg和opencv的安装与简介相关推荐
- Ubuntu 18.04下的Python和OpenCV的安装
最近在做深度学习和计算机视觉的有关内容,因此要在python中用到opencv.我的电脑装的是Ubuntu 18.04,python 3.6和OpenCV 3.4.2 .按照官网的安装方法出了个问题, ...
- Ubuntu 16.04下为Android编译OpenCV 3.1.0 Manager
http://johnhany.net/2016/07/build-opencv-manager-for-android-on-ubuntu/
- Ubuntu 16.04 下pkg-config的安装与简介
Ubuntu 16.04 下pkg-config的安装与简介 原创 BRUCE_WUANG 最后发布于2019-08-19 11:33:06 阅读数 2957 收藏 展开 1. 什么是pkg-conf ...
- Ubuntu 16.04下安装Caffe(GPU版本 GTX970)
Ubuntu 16.04下安装Caffe(GPU版本 GTX970) 个人分类: Deep Learning 2018年8月6日更新说明:距上次安装成功没多久,显卡驱动莫名失效,没有解决,索性重装了系 ...
- ubuntu 环境下调试mysql源码_【转】Ubuntu 16.04下 Mysql 5.7.17源码编译与安装
Ubuntu 16.04下 Mysql5.7.17源码编译与安装 系统环境 一. 系统安装条件 1.cmake MySQL使用cmake跨平台工具预编译源码,用于设置mysql的编译参数. sudo ...
- Ubuntu 16.04 下安装VMware Tools(三行命令搞定,亲测好使)
Ubuntu 16.04 下安装VMware Tools(三行命令搞定,亲测好使): 第一行命令:sudo apt-get upgrate 第二行命令:sudo apt-get install ope ...
- ubuntu 16.04下安装mysql
ubuntu 16.04下安装mysql 从官网下载mysql-apt-config_0.8.12-1_all.deb,下载地址为:https://dev.mysql.com/downloads/re ...
- Ubuntu 16.04 下安装运行 Suricata
介绍 Suricata是一个免费.开源.成熟.快速.健壮的网络威胁检测引擎.Suricata引擎能够进行实时入侵检测(IDS).内联入侵预防(IPS).网络安全监控(NSM)和离线pcap处理.Sur ...
- Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用【转】
本文转载自:http://www.linuxdiyf.com/linux/24086.html Ubuntu 16.04下EasyOpenJTAG+OpenOCD的安装和使用 发布时间:2016-09 ...
最新文章
- freebsd mysql删_FreeBSD 下 mysql 的相关问题
- flask蓝图的使用
- shell下function报错
- Kafka官方文档翻译——简介
- boost::statechart模块实现状态迭代测试
- gitlab 2.7版本升级到2.8
- 安装数据库windows 安装redmine 详解
- git和gitlab安装
- 图片服务 - thumbor安装
- web小知识与问题串烧(html,css,js)
- python三大神器_常用Python代码及花式写法(函数调用自身+三大神器)
- matlab-lsqcurvefit函数
- 回顾 | Apache Flink Meetup 杭州站圆满结束(附PPT下载)
- 16进制颜色与UIColor互转
- css修改图标字体大小,css-更改AngularJS材质图标的图标大小
- vs2017配置 opengl + glfw + glad 环境
- 对话框不响应WM_KEYDOWN消息,可以通过重载BOOL PreTranslateMessage(MSG * pMsg)来实现
- 阿里云搭建完全分布式
- unity画一条流动的弧线(贝塞尔线)
- 写给永动机接触者的一封信
热门文章
- 内核编译提示内存不足解决办法
- 蓝懿ios 技术内容交流和学习心得 11.13
- NXP S32K144学习系列3----基于FreeRTOS进行多个ms级任务的创建
- 科学家在人类身上发现155个新基因!都是“从0出现”
- RabbitMQ原理及SpringBoot整合RabbitMQ
- 【Gorm】增删改查使用入门
- android编译51单片机,GitHub - whaoming/SCMAndroidCommunicate: Android与51单片机的信息交互...
- html中的电话号码
- Python笔记_64_Vue_M-V-VM思想_显示数据_常用指令_操作属性_绑定事件_操作样式_条件渲染指令_列表渲染指令
- L9110S芯片:小功率直流电机的驱动电路方案