ffmpeg+mencoder几乎可以完成目前基于web的播客平台任何音视频处理的操作.如果还需要添加一些什么的话,那么就是视频在线录制功能了,这个也可以用ffmpeg+fms来完成,因此一般的类似于YouTube的一些可见功能都可以在ffmpeg+mencoder+fms来做后台实现.由于fms没有实践,因此这里不描述.
 本文档有三部分:
 1)ffmpeg+mencoder环境搭建
 2)常见操作说明
 3)个人的一些使用心得

1.ffmpeg+mencoder环境搭建

1)概论
 音视频界众多的编解码协议和各个公司定义的专用格式导致目前的视频音频文件纷繁复杂,单纯的ffmpeg支持的格式并不完全包括所有种类,至少swf,rmvb(rv4)目前的版本是不支持的.同时wma9似乎可以支持了.但没有测试.同时mencoder能支持rm,rmvb等格式,但是从视频中获取某帧截图的工作只能由ffmpeg完成.因此可以采用ffmpeg+mencoder完成目前所有流行格式的视频压缩转换,设置视频信息,截取视频中的图片等功能了,同时,采用其他的一些开源工具如MediaInfo可以获取视频的元数据信息.

2)ffmpeg篇
 首先获取软件包:ffmpeg,lame(支持mp3),ogg vorbis,x264(h264 codec),xvid,3gp,libdts,mpeg4 aac.这些软件包在71.21的/home/zhengyu/tools里面都能找到.如果需要网上下载的话,可以提供下载地址.
   ffmpeg官网下载:http://ffmpeg.mplayerhq.hu...
   如果官网下载有问题的,xplore也提供了1月30的snapshot:下载ffmpeg.

lame下载:当前版本为3.97,http://sourceforge.net/pro...
    或者到xplore下载lame.
   ogg vorbis:这个一般的redhat自带,不需要下载.可以去看看/usr/lib/libvorbis.a在不在,如果不在可以yum install或apt-get install.
   xvid下载:http://downloads.xvid.org/..., xplore下载xvid.
   x264下载:这个可以去ftp://ftp.videolan.org/下寻找最近的snapshot下载,或者svn获取,注意如果ffmpeg是什么时候的,x264的snapshot也应该是什么时候的,不然编译的时候容易报错.ftp://ftp.videolan.org/pub...
   xplore下载x264的1月29日的snapshot.
   libdts:http://download.chinaunix...., xplore下载libdts:
 上面的软件包除了ffmpeg之外,在下载完成后解包,编译的参数都是./configure --prefix=/usr --enable-shared;make;sudo make install

mpeg4 aac/aad2:http://www.audiocoding.com...,http://www.audiocoding.com...
 faac和faad2在下载解包之后需要自己automake生成编译文件.其中faac的1.25版本需要将内置的configure.in文件最后的AM_OUTPUT中的几个续行去掉,并取消分行.然后按照bootstrap里面的操作进行,无非是aclocal -I .;autoheader;libtoolize --automake;automake -a --copy;autoconfig(或者前面的由autoreconf -vif替代);./configure --prefix=/usr --enable-shared;make;sudo make install;
 faad2的2.5版本需要修改内置的configure.in文件,不然会在没有libbmp时编译会通不过.找到configure.in中下面一段:

引用
if test x$WITHBMP = xyes; then
 AC_DEFINE([HAVE_BMP], 1, [User wants beep media player plugin built])
 AM_CONDITIONAL([HAVE_XMMS], true)
 AM_CONDITIONAL([HAVE_BMP], true)
fi

if test x$WITHDRM = xyes; then
 改成
if test x$WITHBMP = xyes; then
 AC_DEFINE([HAVE_BMP], 1, [User wants beep media player plugin built])
 AM_CONDITIONAL([HAVE_XMMS], true)
 AM_CONDITIONAL([HAVE_BMP], true)
else
 AC_MSG_NOTICE(no bmp build configured)
 AM_CONDITIONAL([HAVE_BMP], false)
fi

if test x$WITHDRM = xyes; then

然后autoreconf -vif;./configure --prefix=/usr --enable-shared;make;sudo make install;
     这里提供两个已经修改好的.只需要make clean;make;sudo make install;的tar包.faac1.25下载,faad2.5下载.

3gp支持:在编译ffmpeg加入--enable-amr_nb --enable-amr_wb的时候,会有提示,下载:http://www.3gpp.org/ftp/Sp...,解压的源代码文件以后把里面的文件都拷贝到ffmpeg的源代码目录下libavcodec/amrwb_float;然后下载:http://www.3gpp.org/ftp/Sp...,解压得源代码文件以后把里面的文件都拷贝到ffmpeg解包目录下的libavcodec/amr_float,然后交给ffmpeg编译去做了.
   也可以在这里下载这两个包:amrwb_float下载,amr_float下载.

这些codec都安装完毕之后便可以编译ffmpeg了,编译参数如下:
 ./configure --prefix=/usr/local --enable-gpl --enable-shared --enable-mp3lame --enable-amr_nb --enable-amr_wb --enable-amr_if2 --enable-libogg --enable-vorbis --enable-xvid --enable-a52 --enable-a52bin --enable-faadbin --enable-dts --enable-pp --enable-faad --enable-faac --enable-x264 --enable-pthreads --disable-ffserver --disable-ffplay
 make
 (sudo make install)
 然后就可以尝试用ffmpeg做视频转换截图了.
   当然,上面那些codec的编译是相当乏味的.你也可以根本不理会这些.因为最新版本的ffmpeg已经比以前支持更多的格式了.因此也可以只安装lame,xvid,x264就可以了.下面是两种配置下支持的格式diff -w的结果:

引用
2c2
<   configuration:  --prefix=/usr --enable-gpl --enable-shared --enable-mp3lame --enable-amr_nb --enable-amr_wb --enable-amr_if2 --enable-libogg --enable-vorbis --enable-xvid --enable-a52 --enable-a52bin --enable-faadbin --enable-dts --enable-pp --enable-faad --enable-faac --enable-x264 --enable-pthreads --disable-ffserver --disable-ffplay
---
>   configuration:  --prefix=/usr/local --enable-mp3lame
6c6
<   built on Jan 30 2007 17:55:22, gcc: 4.1.1 20061011 (Red Hat 4.1.1-30)
---
>   built on Jan 30 2007 17:46:19, gcc: 4.1.1 20061011 (Red Hat 4.1.1-30)
40c40
<  DE gxf             GXF format
---
>  D  gxf             GXF format
72c72
<  DE ogg             Ogg Vorbis
---
>  D  ogg             Ogg
111d110
<  DEA    aac
113c112
<  DEA    ac3
---
>   EA    ac3
132,133d130
<  DEA    amr_nb
<  DEA    amr_wb
147d143
<  D A    dts
164c160
<  DEV DT h264
---
>  D V DT h264
190d185
<  D A    mpeg4aac
275d269
<   EV    xvid

3)mencoder篇
   首先获取mplayer软件包极其mplayer官网上自带的codecs.如果喜欢mplayer,也可以下载gui和font.关于mplayer-1.0rc1在71.21的/home/zhengyu/tools中能找到.如果需要网上下载,可以去官网:http://www.mplayerhq.hu/de...下载rc1地址如下:http://www1.mplayerhq.hu/M...最新的svn版本:http://www1.mplayerhq.hu/M...官网同时也给出了一些codec,其中就有rm格式的codec:http://www1.mplayerhq.hu/M...
    xplore也提供下载,mplayer1.0rc1下载,codec下载.

下载完成之后,将tar vxjf essential-20061022.tar.bz2;sudo mkdir -p /usr/lib/codecs;sudo cp -rf essential-20061022/* /usr/lib/codecs;然后解包mplayer,按如下方式编译:

./configure --prefix=/usr/local --enable-gui --enable-largefiles  --enable-gif --enable-png --enable-jpeg --language=zh_CN --with-codecsdir=/usr/lib/codecs/
make
(sudo make install)

然后就可以使用mencoder,当然也有一个没有gui的mplayer可以播放各种视频了.不过我们需要的是mencoder.至此,ffmpeg+mencoder搭建完成.

2.常见操作说明
 对于ffmpeg,可以将除swf,rmvb,wmav9以外的视频/音频格式转换成flv/mp3,同时可以截取这些视频文件中的某个时间的该帧图片.这些实际上就是一个视频播客显示的部分.对于mencoder,支持各种常见格式的视频/音频转换成flv/mp3.或者转换成avi.
 1)ffmpeg篇:
 ffmpeg的命令行参数因为太多,这里不列出,可以用ffpmeg -h可以查看到.列出非高级参数如下:

引用
Main options:
-L                  show license
-h                  show help
-version            show version
-formats            show available formats, codecs, protocols, ...
-f fmt              force format
-i filename         input file name
-y                  overwrite output files
-t duration         set the recording time
-fs limit_size      set the limit file size
-ss time_off        set the start time offset
-itsoffset time_off  set the input ts offset
-title string       set the title
-timestamp time     set the timestamp
-author string      set the author
-copyright string   set the copyright
-comment string     set the comment
-album string       set the album
-v verbose          control amount of logging
-target type        specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ...)
-dframes number     set the number of data frames to record
-scodec codec       force subtitle codec ('copy' to copy stream)
-newsubtitle        add a new subtitle stream to the current output stream
-slang code         set the ISO 639 language code (3 letters) of the current subtitle stream

Video options:
-vframes number     set the number of video frames to record
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-croptop size       set top crop band size (in pixels)
-cropbottom size    set bottom crop band size (in pixels)
-cropleft size      set left crop band size (in pixels)
-cropright size     set right crop band size (in pixels)
-padtop size        set top pad band size (in pixels)
-padbottom size     set bottom pad band size (in pixels)
-padleft size       set left pad band size (in pixels)
-padright size      set right pad band size (in pixels)
-padcolor color     set color of pad bands (Hex 000000 thru FFFFFF)
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-sameq              use same video quality as source (implies VBR)
-pass n             select the pass number (1 or 2)
-passlogfile file   select two pass log file name
-newvideo           add a new video stream to the current output stream

Subtitle options:
-scodec codec       force subtitle codec ('copy' to copy stream)
-newsubtitle        add a new subtitle stream to the current output stream
-slang code         set the ISO 639 language code (3 letters) of the current subtitle stream

ffmpeg+mencoder环境搭建和视频处理总结相关推荐

  1. Linux 下ffmpeg的环境搭建与安装

    Linux下ffmpeg的环境搭建与安装 背景 [FFmpeg是什么] 1· FFmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源软件.采用LGPL或GPL许可证,提供了录制.转 ...

  2. Qt开发笔记(一):Qt+FFmpeg开发环境搭建以及工程模板

    原博主博客地址:https://blog.csdn.net/qq21497936 本文章博客地址:https://blog.csdn.net/qq21497936/article/details/90 ...

  3. windows下ffmpeg+nginx-rtmp环境搭建及opencv+ffmpeg+python实现拉流和rtmp直播推流

    由于工作需要最近在研究rtsp拉流与直播推流的问题,目前先在我本机上进行了实验,本博客记录学习的内容,包含windows下ffmpeg.nginx-rtmp环境搭建及opencv+ffmpeg+pyt ...

  4. gentoo ffmpeg+mencoder快速搭建视频处理系统笔记

    软件说明: MP3支持:lame xvid支持:xvid H264/AVC支持:x264 AC3支持:liba52 MPEG4 ACC支持:faac.faad2 3GPP AMR Floating p ...

  5. WINCE的FFMPEG交叉编译环境搭建

    1.下载MinGW,cygwin两个WINCE的MAKEFILE交叉编译工具,并安装到D盘根目录下. 2.配置用户环境变量,新建path目录,并将值设为如下: C:\cygwin\opt\mingw3 ...

  6. ffmpeg+mencoder的视频格式转换

    一.ffmpeg+mencoder知识普及 "  ffmpeg+mencoder几乎可以完成目前基于web的播客平台任何音视频处理的操作.如果还需要添加一些什么的话,那么就是视频在线录制功能 ...

  7. atlas200dk开发板环境搭建踩坑

    一.安装VMWare12虚拟机 安装包: 安装教程:https://jingyan.baidu.com/article/37bce2beb3c36f1002f3a22d.html 安装完成: 二.在虚 ...

  8. fusionsphere环境搭建_fusioncompute 环境搭建

    华为FusionSphere 环境搭建系列视频包括如下内容: 本系列视频以实操为主(中间部署环境等待时间没有录制,这样可以节省我们大量的播放时间),模拟生产环境多台服务器集群+共享存储的一个场景,对服 ...

  9. ffmpeg编译gb28181_RTSP/GB28181协议/海康SDK/Ehome协议视频上云网关EasyCVR视频平台在linux环境下ffmpeg源码单步调试环境搭建...

    目前TSINGSEE青犀视频研发的视频上云服务平台EasyCVR已经可集成海康EHome私有协议,并且在前文中我也跟大家讲过EHome协议的配置和调用流程,有兴趣的可以阅读一下:配置及协议介绍.Eho ...

最新文章

  1. 2021年大数据HBase(十二):Apache Phoenix 二级索引
  2. 新一代开源Android渠道包生成工具Walle
  3. 成为程序员ing日记
  4. springboot集成swagger2,以及swagger-ui.html访问404的问题解决:拦截器造成的
  5. 如何开启需要的垃圾收集器
  6. 将一个正方形分成4个大小一样的小正方形,再将其中一个小正方形分成4个小正方形,如此类推,分割n次是几个正方形?
  7. uci数据集_数据分析找不到数据集?快来看这个盘点
  8. C#LeetCode刷题之#172-阶乘后的零(Factorial Trailing Zeroes)
  9. MySQL二进制日志文件格式
  10. 技术美术知识学习4200:SSAO算法
  11. 第1章 Dev C++的使用
  12. MAC OS升级记录
  13. java毕业设计宠物寄养预约系统Mybatis+系统+数据库+调试部署
  14. 分段函数的期望和方差_题组25随机变量的分布列、期望与方差、正态分布
  15. 房天下二手交易平台房源数据采集
  16. Bluetooth core 5.0 Generic Access Profile ---------- 模式 - BR/EDR 物理传输(physical transport)
  17. C++添加防火墙例外——检测目标程序不在例外列表时才进行添加,防止重复添加
  18. 计算机网络战队名称大全,游戏战队名字大全要霸气
  19. 全栈大前端高频面试题
  20. iOS11下UITableView侧滑删除详解

热门文章

  1. Dart 2为移动开发做出改进
  2. Android如何使用so文件和Android studio中导入so
  3. STL源码剖析之算法:lower_bound
  4. TurboMail最新版本4.1.0之我见(一)
  5. 确认过眼神(*╹▽╹*),这就是大家想要的BCH
  6. Login rule 权限规则设置自动跳转页面
  7. 《为了你我愿意热爱整个世界》
  8. Fragment使用小技巧
  9. 手机QQ会员H5加速方案——sonic技术内幕
  10. String的那一大堆事儿--1