ffmpeg 安装bzlib_centos6中yum安装ffmpeg
本章中为虚拟环境所以防火墙是关闭的,线上的防火墙可添加或酌情修改
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1935 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
1.升级系统
yum install epel-release -y
yum update -y
reboot
2.环境
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# hostname -I
192.168.1.96
[root@localhost ~]# hostname
localhost.localdomain
3.下载yum依赖包
yum -y install gcc gcc-c++ autoconf automake make openssl openssl-devel pcre-devel git
4.nginx-rtmp-module安装
cd /opt
git clone https://github.com/arut/nginx-rtmp-module.git
5.nginx 安装略,编译时需加上此模块:--add-module=/root/nginx-rtmp-module
6.ffmpeg安装
7.安装ffmpeg和ffmpeg开发包
yum install ffmpeg ffmpeg-devel -y
8.测试
ffmpeg
ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 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'
9.nginx配置
worker_processes 1;
events {
worker_connections 1024;
}
rtmp { #RTMP 服务 此处共添加9行
server {
listen 1935; #服务端口
chunk_size 4096; #数据传输块的大小
application vod {
play /opt/video/vod; #视频文件存放位置。需要创建此目录(可放入视频进行播放)
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
10.新建存放视频的位置并放视频
mkdir -p /opt/video/vod
/etc/init.d/nginx restart重启nginx服务
11.添加nginx配置两个server并重启服务
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application vod {
play /opt/video/vod;
}
application live { #第一处添加的直播字段 此处共添加3行
live on;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /stat { #第二处添加的 location 字段。 此处共添加7行
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl { #第二处添加的 location 字段。
root /usr/local/nginx/nginx-rtmp-module/; ##注意需要把这个模块放到 nginx 目录中
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
12.使用ffmpeg推送流
ffmpeg -re -i next.mp4 -vcodec libx264 -acodec aac -strict -2 -f flv rtmp://192.168.1.96:1935/live
显示如下:
ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'next.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2016-08-09 09:35:02
encoder : HandBrake 0.10.5 2016021100
Duration: 00:00:05.00, start: 0.000000, bitrate: 739 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 960x540 [SAR 1:1 DAR 16:9], 735 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2016-08-09 09:35:02
handler_name : VideoHandler
[libx264 @ 0x214c520] using SAR=1/1
[libx264 @ 0x214c520] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x214c520] profile High, level 3.1
[libx264 @ 0x214c520] 264 - core 142 r2438 af8e768 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://192.168.1.96:1935/live':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Stream #0:0(und): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
creation_time : 2016-08-09 09:35:02
handler_name : VideoHandler
encoder : Lavc56.26.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[flv @ 0x214ba60] Failed to update header with correct duration.ate= 719.0kbits/s
[flv @ 0x214ba60] Failed to update header with correct filesize.
frame= 125 fps= 25 q=-1.0 Lsize= 221kB time=00:00:04.92 bitrate= 368.7kbits/s
video:219kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.284308%
[libx264 @ 0x214c520] frame I:1 Avg QP:21.33 size: 17488
[libx264 @ 0x214c520] frame P:45 Avg QP:17.88 size: 3758
[libx264 @ 0x214c520] frame B:79 Avg QP:17.46 size: 463
[libx264 @ 0x214c520] consecutive B-frames: 11.2% 9.6% 12.0% 67.2%
[libx264 @ 0x214c520] mb I I16..4: 22.8% 67.5% 9.8%
[libx264 @ 0x214c520] mb P I16..4: 6.9% 11.8% 0.3% P16..4: 25.2% 4.4% 1.3% 0.0% 0.0% skip:50.0%
[libx264 @ 0x214c520] mb B I16..4: 0.1% 0.2% 0.0% B16..8: 9.3% 0.4% 0.0% direct: 0.5% skip:89.6% L0:30.0% L1:67.6% BI: 2.4%
[libx264 @ 0x214c520] 8x8 transform intra:62.4% inter:89.6%
[libx264 @ 0x214c520] coded y,uvDC,uvAC intra: 19.3% 46.4% 6.9% inter: 3.7% 10.0% 0.2%
[libx264 @ 0x214c520] i16 v,h,dc,p: 32% 34% 11% 23%
[libx264 @ 0x214c520] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 23% 31% 2% 4% 3% 4% 2% 2%
[libx264 @ 0x214c520] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 25% 16% 5% 8% 5% 7% 4% 4%
[libx264 @ 0x214c520] i8c dc,h,v,p: 61% 21% 15% 3%
[libx264 @ 0x214c520] Weighted P-Frames: Y:33.3% UV:33.3%
[libx264 @ 0x214c520] ref P L0: 75.2% 16.2% 6.7% 1.9% 0.0%
[libx264 @ 0x214c520] ref B L0: 91.7% 7.7% 0.7%
[libx264 @ 0x214c520] ref B L1: 94.2% 5.8%
[libx264 @ 0x214c520] kb/s:357.07
RTMP #clients Video Audio In bytes Out bytes In bits/s Out bits/s State Time
Accepted: 0 codec bits/s size fps codec bits/s freq chan 0 KB 0 KB 0 Kb/s 0 Kb/s 41m 25s
vod
vod streams 0
live
live streams 0
Generated by nginx-rtmp-module 1.1.4, nginx 1.8.0, pid 1767, built Nov 16 2017 12:39:43 gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
转码mpg4转h264
ffmpeg -i next.mp4 -r 25 -s 1920*1080 -aspect 16:9 -b:v 2000K -bufsize 2000k -maxrate 2500k -vcodec h264 -strict -2 -acodec aac -ab 48k -ar 48000 -ac 2 n2.mp4
next.mp4 #源视频
n2.mp4 #转后的视频名
ffmpeg 安装bzlib_centos6中yum安装ffmpeg相关推荐
- CentOS7中yum安装mysql_CentOS7中YUM 安装mysql
1.下载 YUM 仓库文件 # wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm 2.安装 YUM R ...
- 在Centos中yum安装和卸载软件的使用方法
在Centos中yum安装和卸载软件的使用方法 安装方法 安装一个软件时 yum -y install httpd 安装多个相类似的软件时 yum -y install httpd* 安装多个非类似软 ...
- linux php7 yum 卸载,Linux_在Centos中yum安装和卸载软件的使用方法,安装一个软件时
yum -y install h - phpStudy...
在Centos中yum安装和卸载软件的使用方法 安装一个软件时 yum -y install httpd 安装多个相类似的软件时 yum -y install httpd* 安装多个非类似软件时 yu ...
- yum安装一个软件不知道名字时_yum卸载软件_Centos中yum安装和卸载软件的方法
摘要 腾兴网为您分享:Centos中yum安装和卸载软件的方法,杂志迷,粤警民通,优美图,鲜时光等软件知识,以及联想手表app,读书郎点读机,小米杂货铺,小学英语冀教版,appgo加速器,mhdd4. ...
- 解决Linux安装过程中不能安装Grub的问题
参考,部分转载和万分感谢:解决Linux安装过程中不能安装Grub的问题 关卡1: 从前段时间折腾了很久,刚开始是因为/boot区已经占满了,那么为什么会占满呢?因为当时尝试初次手动分区,然后参考了网 ...
- FFmpeg 在 Python 中的安装使用方法详解
目录 一.了解 FFmpeg 二.FFmpeg 的组成 三.FFmpeg for Windows 3.1 下载 3.2 安装 3.3 测试 四.用法 五.附录 一.了解 FFmpeg FFmpeg是一 ...
- 超详细的CentOS7中安装Git,yum安装和自己编译安装
预备知识很长,请耐心看,对后面安装过程的理解及其对linux 的理解都很有帮助 一.预备知识 1)什么是自由软件运动? 自由软件运动致力于通过自由软件使计算机用户获得自由权利.自由软件的用户可以自主控 ...
- 如何保留linux中yum安装后的rpm软件包
在linux上,使用yum安装,默认安装完成之后会删除下载的rpm包:想要yum安装软件后,还保留安装包,那么需要修改/etc/yum.conf配置文件中的keepcache参数. [root@bog ...
- fedora15中yum安装卸载libreoffice中文版
yum安装卸载libreoffice中文版 fedora15已经把默认office套件更换为libreoffice LibreOffice是OpenOffice.org 办公套件衍生版, 同样免费开源 ...
最新文章
- 2021西南位育高考成绩查询,上海近40所高中2020高考录取情况汇总!
- CISCO ACL的匹配数问题
- Jzoj4845 寻找
- 将一个域下的cookie传到另一个域_单点登录那些事儿(二)同域下的单点登录
- 使用单例模式加载properties文件
- python如何自定义函数_python如何自定义函数_后端开发
- 计算机网络(二十七)-IPv4
- struts2 防止重复提交 与 进入等待画面
- Redis(十三):Redis实现乐观锁
- android 本地 播放器,Android 本地播放器
- 《TensorFlow深度学习应用实践》学习笔记1
- python获取文件修改时间_Python-获取文件最后修改时间 | 学步园
- for input string:是什么原因出现的_「汽车空调异味」周期性出现:原因是什么呢?...
- SVN 删除文件及其恢复大全
- 最简单的直播礼物连刷特效制作(带源码)
- php微信退款结果通知,微信支付退款结果通知解密
- 参考文献类型标识码--中英文对照
- Photoshop---PS2017软件安装与破解
- 【NCC】NCC 附件管理按钮开发,从ftp下载附件到文件服务器开发笔记
- 基于hadoop的商品推荐系统_[零基础入门推荐系统(1)]基于用户和基于物品的协同过滤方法(python代码实现)...
热门文章
- 使用C#.NET WebBrowser控件导航到不同的网站出现 所请求的资源正在使用中。 (从HRESULT异常:0x800700AA)
- CentOS7开启Google TCP-BBR优化算法
- Springboot+vue项目零食销售商城
- Myeclipse反向工程后造成的SQL syntax
- TP5简单实现类似京东淘宝多级商品筛选功能。
- 计算机一级表格函数公式,计算机一级:《Excel表格的基本操作》函数和公式编辑技巧...
- java paint 覆盖_Java paintComponent覆盖版本5和6之间的差异
- nodejs模块加载的猜想
- JS中“use strict”的含义以及使用它的区别
- can not be represented as java.sql.Timestamp