`
xpp02
  • 浏览: 1006788 次
社区版块
存档分类
最新评论

ffmpeg的编译(for x86,for arm)安装及使用(网络资料整理)

 
阅读更多
ffmpeg编译及使用


1 ffmpeg介绍
ffmpeg是音视频的分离,转换,编码解码及流媒体的完全解决方案,其中最重要的就是libavcodec库。它被mplayer或者xine使用作为解码器。还有,国内比较流行的播放器影音风暴或MyMPC的后端ffdshow也是使用ffmpeg的解码库的。

ffmpeg软件包经编译过后将生成三个可执行文件,ffmpeg,ffserver,ffplay。其中ffmpeg用于对媒体文件进行处理,ffserver是一个http的流媒体服务器,ffplay是一个基于SDL的简单播放器。
ffmpeg中有五个库文件,libavcodec,libavformat,libavutil,libswscale,libpostproc,其中库libavcodec,libavformat用于对媒体文件进行处理,如格式的转换;libavutil是一个通用的小型函数库,该库中实现了CRC校验码的产生,128位整数数学,最大公约数,整数开方,整数取对数,内存分配,大端小端格式的转换等功能;libswscale,libpostproc暂时不知道何用。


2 ffmpeg下载
最新的ffmpeg可以通过svn下载,SVN辅助的软件有:
SubVersion,从 http://subversion.tigris.org/ 下载,支持linux。
TortoiseSVN,从 http://tortoisesvn.tigris.org/ 下载,是很不错的SVN客户端程序,为windows外壳程序集成到windows资源管理器和文件管理系统的Subversion客户端,用起来很方便。

subversion安装,记住最好之前装过apr和apr-util,在apache.org网站能下到
wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
tar zvxf subversion-1.3.2.tar.gz
cd subversion-1.3.2
./configure --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd/
make
make install
如果安装了FC6,它已经带了svn,不用装了。
ffmpeg的下载:我们就可以通过svn命令获取最新的ffmpeg,命令如下:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

3 ffmpeg支持库的安装

* xvid
xvid的获取地址如下:
http://www.xvid.org/
wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
配置编译
for x86
#./configure --prefix=/usr/local
#make
#make install
for arm
#CC=arm-linux-gcc ./configure --prefix=/usr/local/arm/arm-linux --build=i686-pc-linux --host=arm-linux --target=arm-linux
#make
#make install


* x264
x264的获取地址如下:
svn co svn://svn.videolan.org/x264/trunk x264
配置编译
for x86
#./configure --enable-shared --prefix=/usr/local
#make
#make install
for arm
#CC=arm-linux-gcc ./configure --enable-pthread --enable-shared --host=arm-linux

--prefix=/usr/local/arm/arm-linux
#make
#make install


* 支持mp3
lame的获取地址如下:http://lame.sourceforge.net/index.php
配置编译
for x86
./configure --enable-shared --prefix=/usr/local


* 支持Ogg Vorbis:


* AC3和dts编码的支持
libdts编译参数
./configure --prefix=/usr
make
make install


* mpg4 aac格式支持,如果ffserver服务器还针对手机用户服务,所以,类似aac,mpg4铃声格式的支持,我们也得做。这里我们安装faad2和faac就行,下载请到http://www.audiocoding.com/modules/mydownloads/http://prdownloads.sourceforge.net/faac
FAAD2的编译
cd faad2
autoreconf -vif
./configure --prefix=/usr --with-mp4v2 --enable-shared
make
make install
faac的编译
cd faac
chmod +x bootstrap
./bootstrap
./configure --prefix=/usr --with-mp4v2 --enable-shared
make
make install
在编译ffmpeg,在configure时加上--enable-amr_nb --enable-faad --enable-faac参数。


* 支持3gp格式,这也是现在好多手机支持的格式,所以也得支持编译
编译的时候加上--enable-amr_nb --enable-amr_wb参数就行,根据编译系统的提示,所以我们得下载一些编译3gp所需得文件。
源码网址:http://www.3gpp.org/ftp/Specs
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip
解压以后把里面的文件都拷贝到libavcodec/amrwb_float
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip
解压以后把里面的文件都拷贝到libavcodec/amr_float


* ffmpeg支持VC1格式
微软ASF格式的三个版本,WMV1,WMV2,WMV3分别对应MediaPlayer的版本7,8和9,所以很多时候会称VC1为WMV3或 WMV9,都是它了,有时候在代码里,也能看到称呼它为VC9的。因为微软还没有正式公开这种格式,所以当前对VC1的支持还很不完善。本文基本是根据Multimedia Mike的一篇博客翻译和完善而来。
(1) 首先要下载 SMPTE VC-1 reference decoder,这个组织是要收费的,可以从这里下载免费的。
(2) 在ffmpeg目录下的libavcodec目录下面,建立目录libvc1。
(3) 将VC1_reference_decoder_release6/decoder/目录中的*.c和*.h文件全部copy到libvc1目录下。
(4) 将VC1_reference_decoder_release6/shared/目录中的*.c和*.h文件全部copy到libvc1目录下。
(5) 将 libvc1-makefile.txt放到libvc1下的Makefile文件。
(6) 将smpte-vc1.c文件放到libavcodec目录下。
(7) 修改libavcodec目录下的vc9.c,将文件最后的wmv3_decoder这个AVCodec的structure,用#if 0和#endif包含起来,也就是使它失效了。
(8) 修改libavcodec目录下的allcodecs.c,将register_avcodec(&wmv3_decoder)上下的注释去掉,使它发挥作用。
(9) 修改libavcodec目录下的Makefile,把OBJS的列表中加入smpte-vc1.o。
(10)修改ffmpeg主目录下的Makefile文件,把-L./libavcodec/libvc1 -lvc1$(BUILDSUF)加入到FFLIBS后面。
(11) 进入ffmpeg/libavcodec/libav1,执行make
(12) 到ffmpeg主目录下,执行config;make;make install。config时根据实际情况带参数。


* 采用ffmpeg转码制作FLV文件的方法
采用ffmpeg转码制作FLV文件,和转码成其它媒体类型的重要差别是一定要有lame库支持,因为FLV的声音编码采用mp3格式,非lame这个东东不行。编译ffmpeg中加入lame库真是一场灾难,特别在windows下,很多参数都不能发挥作用,最后直接手工copy和改一些文件,记录如下:
(1) 如果在Windows下编译,第一步当然是下载MinGW和MSYS来装上了。到http://mingw.sourceforge.net/去下载最新版的MinGW-5.0.2.exe和MSYS-1.0.11-2004.04.30-1.exe。
(2) 先安装MinGW,直接运行MinGW-5.0.2.exe安装,选择目录,譬如选择D:/MinGW为安装目录。安装时需要选择gcc和make模块,安装文件本身很小,会从网上下载模块来安装。
(3) 然后安装MSYS,也是直接运行MSYS-1.0.11-2004.04.30-1.exe安装。安装目录一般选择D:/MinGW/bin /1.0。,安装过程会询问刚才安装MinGW的目录,输入D:/MinGW,其它都回答'Y'就搞定了。如果不清楚,可以看这个图片效果。
(4) 运行MSYS,桌面上有个图标,双击就运行了,运行结果是一个模拟unix的命令窗口,后面的编译都在这种状态下进行。前面4步在linux不需要。
(5) 到http://lame.sourceforge.net/去下载最新版的lame-3.97b2.tar.gz,copy到你认为合适的地方,解压后进入lame解压出来的目录中。执行
./configure --prefix=PREFIX
make
make install
(6) 就把编译出来的include下的lame目录copy到/usr/include目录下,把lib下的几个库文件都copy到/usr/lib目录 下。这里注意有个变化,如果只copy lib目录下的静态库到/usr/lib下,就是只copy libmp3lame.a文件,编译出来的ffmpeg最终就不会对libmp3lame的动态库有依赖关系,这是因为编译首先找动态库,动态库没有才找 静态库。如果不做这个copy,后面编译ffmpeg时无论如何指定参数,都会报错LAME not found,不知道是哪里的bug。
(7) 从http://ffmpeg.mplayerhq.hu/取得最新的ffmpeg,现在自由软件都大量采用SVN了,要先装一个SVN,可以去http://tortoisesvn.tigris.org/下载windows版的SVN,去http://subversion.tigris.org/下载linux版的SVN。SVN如何编译安装这里就省略了。
(8) 如果在windows下,打开解压后的ffmpeg目录下的Makefile文件,在FFLIBS的那一行后面加上-lmp3lame$(BUILDSUF)。这个也不知道是哪个bug引起的,搞了好长时间才搞出来,郁闷。Linux下不用这样。


4 ffmpeg的编译

配置编译
for x86
#./configure --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
make
make install

补充1:
关于3gp的编译,如果大家要编译--enable-amr_nb-fixed,那就不能跟--enable-amr_nb同时编译,我不大清楚这两者到底有什么区别,似乎

fixed是修正版,管他呢,编译的方法:
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip
解压以后把里面的文件都拷贝到libavcodec/amr目录下

修改libavcodec/amr/makefile 找到CFLAGS = -Wall -pedantic-errors -I. $(CFLAGS_$(MODE)) -D$(VAD) 换成CFLAGS = -Wall -I.

$(CFLAGS_$(MODE)) -D$(VAD) -DMMS_IO

整体编译参数就是
#./configure --prefix=/usr --enable-gpl --enable-shared --enable-mp3lame --enable-amr_nb-fixed --enable-amr_wb --enable-amr_if2 --enable-libogg --enable-vorbis --enable-xvid --enable-a52 --enable-a52bin --enable-dts --enable-pp --enable-faad --enable-faadbin --enable-faac --enable-x264 --enable-pthreads --disable-ffserver --disable-ffplay
make
make install

for x86的简易配置
#./configure --prefix=./install --disable-shared --enable-pthreads --enable-libx264 --enable-libxvid --arch=i686 --enable-gpl
#make
#make install

for arm
配置编译
#./configure --prefix=/home/zht/redhatzht/sources/image-colletct/ffmpeg/install --enable-static --disable-shared --enable-libx264 --enable-libxvid --cross-compile --cc=arm-linux-gcc --arch=arm --enable-gpl --disable-strip --disable-network --disable-ipv6 --disable-vhook --disable-audio-beos --disable-audio-oss --disable-mpegaudio-hp --enable-pthreads --enable-small --disable-parsers --disable-debug
#make
#make install

注意:

(1)“/home/zht/redhatzht/sources/image-colletct/ffmpeg”为ffmpeg源码所在目录。
(2)“/usr/local/arm”为arm-linux-gcc交叉编译器所在目录。
(3) 如果库文件安装在/usr/local/lib目录中导致配置失败,可以在/etc/ld.so.conf文件中添加/usr/local/lib目录,然后执行#ldconfig。
x86上的ldconfig不能在arm上运行,arm上的ldconfig工具是在建立交叉编译器时,编译glibc是产生的,可以拷贝到arm-linux中。
(4) 本文大部分内容来自网络,其中xvid,x264的库,我亲手安装过,ffmpeg的配置编译for x86的简易配置,for arm,我亲手配置编译过,并在x86,arm上可用,编译配置都是采用静态库。


5 ffmpeg用法
ffmpeg作为媒体文件处理软件,基本用法如下:
ffmpeg -i INPUTfile [OPTIONS] OUTPUTfile
输入输出文件通常就是待处理的多媒体文件了。可以是纯粹的音频文件,纯粹的视频文件,或者混合的。ffmpeg支持绝大部分的常见音频,视频格式,象常见的各种mpeg,AVI封装的DIVX和Xvid等等,具体的格式支持列表可以使用ffmpeg -formats查看或直接查阅文档。
另外,由于Linux把设备视为文件,因此-i选项后可以跟设备名。比如DV,视频卡,光驱或者其它的各类设备。输出的内容通过

Options调整,其主要的选项如下:
-vcodec 视频流编码方式
-b 视频流码率(默认只有200k,一般都需要手动设置,具体的数值视codec选择而定)
-r 视频流帧数(一般说来PAL制式通常用25,NTSC制式通常用29)
-s 视频解析度(分辨率,也要视codec和你的需要而定。另:具体写法使用“数字x数字”的形式)
-t 处理持续时间。
-acodec 音频流编码方式
-ab 音频流码率(默认是同源文件码率,也需要视codec而定)
-ar 音频流采样率(大多数情况下使用44100和48000,分别对应PAL制式和NTSC制式,根据需要选择)
-vn屏蔽视频流
-an屏蔽音频流
-author 设置媒体文件的作者
-title设置媒体文件的题目
-f强制使用某种格式
-target type使用预置的格式转换(可以转成dvd,vcd或svcd)

除此之外还有些更高级的选项,如设定vbr,或设定high quality,或者设定vbr的buff和max/min码率,象一般我们自用的dvd抓轨啦,DV转vcd dvd啦,网上下载的电影转成vcd或dvd都不一定需要用到它们。

常用命令选项说明
-fromats 显示可用的格式
-f fmt 强迫采用格式fmt
-I filename 输入文件
-y 覆盖输出文件
-t duration 设置纪录时间 hh:mm:ss[.xxx]格式的记录时间也支持(截图需要)
-ss position 搜索到指定的时间 [-]hh:mm:ss[.xxx]的格式也支持
-title string 设置标题
-author string 设置作者
-copyright string 设置版权
-comment string 设置评论
-target type 设置目标文件类型(vcd,svcd,dvd),所有的格式选项(比特率,编解码以及缓冲区大小)自动设置,只需要输入如下的就可以了:ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
-hq 激活高质量设置

-b bitrate 设置比特率,缺省200kb/s
-r fps 设置帧频,缺省25
-s size 设置帧大小,格式为WXH,缺省160X128.下面的简写也可以直接使用:Sqcif 128X96 qcif 176X144 cif 252X288 4cif 704X576
-aspect aspect 设置横纵比 4:3 16:9 或 1.3333 1.7777
-croptop/botton/left/right size 设置顶部切除带大小,像素单位
-padtop/botton/left/right size 设置顶部补齐的大小,像素单位
-padcolor color 设置补齐条颜色(hex,6个16进制的数,红:绿:蓝排列,比如 000000代表黑色)
-vn 不做视频记录
-bt tolerance 设置视频码率容忍度kbit/s
-maxrate bitrate设置最大视频码率容忍度
-minrate bitreate 设置最小视频码率容忍度
-bufsize size 设置码率控制缓冲区大小
-vcodec codec 强制使用codec编解码方式. 如果用copy表示原始编解码数据必须被拷贝.(很重要)

-ab bitrate 设置音频码率
-ar freq 设置音频采样率
-ac channels 设置通道,缺省为1
-an 不使能音频纪录
-acodec codec 使用codec编解码

-vd device 设置视频捕获设备,比如/dev/video0
-vc channel 设置视频捕获通道 DV1394专用
-tvstd standard 设置电视标准 NTSC PAL(SECAM)
-dv1394 设置DV1394捕获
-av device 设置音频设备 比如/dev/dsp

-map file:stream 设置输入流映射
-debug 打印特定调试信息
-benchmark 为基准测试加入时间
-hex 倾倒每一个输入包
-bitexact 仅使用位精确算法 用于编解码测试
-ps size 设置包大小,以bits为单位
-re 以本地帧频读数据,主要用于模拟捕获设备
-loop 循环输入流。只工作于图像流,用于ffserver测试


5 example
(1) ffmpeg的使用

"Video and Audio grabbing"
FFmpeg can use a video4linux compatible video source and any Open Sound System audio source:
ffmpeg /tmp/out.mpg
Note that you must activate the right video source and channel before launching ffmpeg. You can use any TV viewer such as

xawtv (<http://bytesex.org/xawtv/>) by Gerd Knorr which I find very good. You must also set correctly the audio recording

levels with a standard mixer.
"Video and Audio file format conversion"

* You can input from YUV files:
ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
The Y files use twice the resolution of the U and V files. They are raw files, without header. They can be generated by all decent video decoders. You must specify the size of the image with the -s option if ffmpeg cannot guess it.

* You can input from a RAW YUV420P file:
ffmpeg -i /tmp/test.yuv /tmp/out.avi
The RAW YUV420P is a file containing RAW YUV planar, for each frame first come the Y plane followed by U and V planes, which are half vertical and horizontal resolution.

* You can output to a RAW YUV420P file:
ffmpeg -i mydivx.avi -o hugefile.yuv

* You can set several input files and output files:
ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
Convert the audio file a.wav and the raw yuv video file a.yuv to mpeg file a.mpg

* You can also do audio and video conversions at the same time:
ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.

* You can encode to several formats at the same time and define a mapping from input stream to output streams:
ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
Convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. "-map file:index" specify which input stream is used for each output stream, in the order of the definition of output streams.

* You can transcode decrypted VOBs
ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
This is a typical DVD ripper example, input from a VOB file, output to an AVI file with MPEG-4 video and MP3 audio, note that in this command we use B frames so the MPEG-4 stream is DivX5 compatible, GOP size is 300 that means an INTRA frame every 10

seconds for 29.97 fps input video. Also the audio stream is MP3 encoded so you need LAME support which is enabled using --enable-mp3lame when configuring. The mapping is particularly useful for DVD transcoding to get the desired audio language.

NOTE: to see the supported input formats, use ffmpeg -formats.


(2) ffplay的使用

ffplay - FFplay media player
SYNOPSIS

ffplay [options] input_file
DESCRIPTION

FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a test bench for the various APIs of FFmpeg.
OPTIONS

"Main options"

show help force displayed width force displayed height disable audio disable video disable graphical display force format
"Advanced options"

show the stream duration, the codec parameters, the current position in the stream, and the audio/video synchronisation drift. force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful if you are doing stream with the RTSP protocol.

set the master clock to audio ( type=audio), video ( type=video) or external ( type=ext). Default is audio. The master clock is used to control audio-video synchronization. Most media players use audio as master clock, but in some cases (streaming or high quality broadcast) it is necessary to change that. This option is mainly used for debugging purposes.


(3) ffserver的使用
ffsserver - FFserver video server
SYNOPSIS

ffserver [options]
DESCRIPTION

FFserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided you specify a big enough feed

storage in ffserver.conf).

This documentation covers only the streaming aspects of ffserver / ffmpeg. All questions about parameters for ffmpeg, codec questions, etc. are not covered here. Read ffmpeg-doc.html for more information.
OPTIONS

print the license print the help use configfile instead of /etc/ffserver.conf

6 其他(参考)

(1)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进行操作的常用方法:

* 转换成flv文件:ffmpeg -i infile.* -y (-ss second_offset -ar ar -ab ab -r vr -b vb -s vsize) outfile.flv
其中second_offset是从开始的多好秒钟.可以支持**:**:**格式,至于ar,ab是音频的参数,可以指定ar= 22050,24000,44100(PAL制式),48000(NTSC制式),后两种常见,ab=56(视音频协议的codec而定,如果要听高品质,则80以上).vr,vb,vsize是视频参数,可以指定vr=15,25(PAL),29(NTSC),vb=200,500,800,1500 (视视频协议的codec而定,可以通过查看专业的codec说明文档获取,如果你手头有一份详细的各种codec的文档,请提供一份给我,不胜感激.),还有一些参数-acodec ac -vcodec vc(ac指定音频codec,ar和ab可以省去,vc指定视频codec,vr和vb可以省去,自动采用相应的codec参数)还有很多高级参数,如-qmin,-qcale等,请查看详细文档。还有-an和-vn参数,分别从多媒体文件中提取出纯粹视频和音频。另,如果你是用shell批量处理,请使用-y参数覆盖生成flv.

* 截取图片:ffmpeg -i infile.* -y (-ss second_offset) -t 0.001 -s msize (-f image_fmt) outfile.jpg
其中second_offset同上,msize同vsize,图片大小.image_fmt=image2强制使用jpg,image_fmt=gif,强制使用gif格式.还可以用-vframes fn指定截取某帧图片,fn=1,2,3,...


2)mencoder操作
mencoder的作用主要在视频转码方面.在安装完mplayer后,mencoder也编译生成了.可以man mencoder获取mencoder的说明文档.mencoder的参数更加复杂,不过也无非是音频处理视频处理两个方面,可以参看网络例子:http://www.masoncn.com/pos...这里不作详细的列举了.

mencoder进行操作的常用方法: mencoder infile.* -o outfile.* [-ovc 目标视频格式] [-oac 目标音频格式] [-of 目标文件格式]

* 转换成flv文件: mencoder infile.* -o outfile.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts

vcodec=flv:vbitrate=150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050

* 转换成avi文件: mencoder infile.* -o outfile.avi -of avi -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts

bitrate=600

* 转换成wmv文件(复杂写法,其中高级参数可以省去): mencoder infile.* -o outfile.wmv -of lavf -ofps 25 -oac mp3lame -lameopts

cbr:preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=768:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=320:240 -srate

22050 -sws 9 -subcp cp936 -subpos 0 -subalign 0 -subfont-text-scale 3 -lavfopts i_certify_that_my_video_strea
其中-ovc,-oac和-of是必须的,-ovc是指定视频codec,指定了ovc之后通常带一个该codec的opt参数,-oac是指定音频 codec,也会在其后带一个codec的opt参数.可以指定细节以决定视频音频质量和转换速率.具体的细节可以参看专业的技术文档.

7 ffmpeg配置选项

[root@web ffmpeg]# ./configure --help
Usage: configure [options]
Options: [defaults in brackets after descriptions]

Standard options: 基本选项参数
--help 显示此帮助信息|print this message
--log[=FILE|yes|no] 记录测试并输出到config.err文件|log tests and output to FILE [config.err]
--prefix=PREFIX 安装程序到指定目录(默认/usr/local)|install in PREFIX [/usr/local]
--libdir=DIR 安装库到指定目录(默认prefix/lib)|install libs in DIR [PREFIX/lib]
--shlibdir=DIR 指定共享库路径(默认prefix/lib)|install shared libs in DIR [PREFIX/lib]
--incdir=DIR 指定includes路径(默认prefix/include/ffmpeg)|install includes in DIR[PREFIX/include/ffmpeg]
--mandir=DIR 指定man page路径(默认prefix/man)install man page in DIR [PREFIX/man]
--enable-mp3lame 启用mp3编码libmp3lame(默认关闭)enable MP3 encoding via libmp3lame[default=no]
--enable-libogg 启用ogg支持libogg(默认关闭)enable Ogg support via libogg [default=no]
--enable-vorbis 启用Vorbis支持libvorbis(默认关闭)enable Vorbis support via libvorbis [default=no]
--enable-faad 启用faad支持libfaad(默认关闭)enable FAAD support via libfaad [default=no]
--enable-faadbin 启用faad运行时链接支持(默认关闭)build FAAD support with runtime linking[default=no]
--enable-faac 启用faac支持libfaac(默认关闭)enable FAAC support via libfaac [default=no]
--enable-libgsm 启用GSM支持libgsm(默认关闭)enable GSM support via libgsm [default=no]
--enable-xvid 启用xvid支持xvidcore(默认关闭)enable XviD support via xvidcore [default=no]
--enable-x264 启用H.264编码(默认关闭)enable H.264 encoding via x264 [default=no]
--enable-mingw32 启用MinGW本地/交叉win环境编译|enable MinGW native/cross Windows compile
--enable-mingwce 启用MinGW本地/交叉winCE环境编译enable MinGW native/cross WinCE compile
--enable-a52 启用A52支持(默认关闭)enable GPLed A52 support [default=no]
--enable-a52bin 启用运行时打开liba52.so.0(默认关闭)open liba52.so.0 at runtime [default=no]
--enable-dts 启用DTS支持(默认关闭)enable GPLed DTS support [default=no]
--enable-pp 启用后加工支持(默认关闭)enable GPLed postprocessing support [default=no]
--enable-static 构建静态库(默认启用)build static libraries [default=yes]
--disable-static 禁止构建静态库(默认关闭)do not build static libraries [default=no]
--enable-shared 构建共享库(默认关闭)build shared libraries [default=no]
--disable-shared 禁止构建共享库(默认启用)do not build shared libraries [default=yes]
--enable-amr_nb 启用amr_nb float音频编解码器|enable amr_nb float audio codec
--enable-amr_nb-fixed 启用fixed amr_nb codec | use fixed point for amr-nb codec
--enable-amr_wb 启用amr_wb float音频编解码器|enable amr_wb float audio codec
--enable-amr_if2 启用amr_wb IF2音频编解码器|enable amr_wb IF2 audio codec
--enable-sunmlib 启用Sun medialib(默认关闭) | use Sun medialib [default=no]
--enable-pthreads 启用pthreads(多线程)(默认关闭)use pthreads [default=no]
--enable-dc1394 启用libdc1394、libraw1394抓取IIDC-1394(默认关闭)enable IIDC-1394 grabbing using libdc1394 and

libraw1394 [default=no]
--enable-swscaler 启用计数器支持?(默认关闭)software scaler support [default=no]
--enable-avisynth 允许读取AVISynth脚本本件(默认关闭)allow reading AVISynth script files [default=no]
--enable-gpl 允许使用GPL(默认关闭)allow use of GPL code, the resulting libav* and ffmpeg will be under GPL

[default=no]

Advanced options (experts only): 高级选项参数(供专业人员使用)
--source-path=PATH 源码的路径(当前为/root/flv/ffmpeg)| path to source code [/root/flv/ffmpeg]
--cross-prefix=PREFIX 为编译工具指定路径 | use PREFIX for compilation tools []
--cross-compile 假定使用了交叉编译 | assume a cross-compiler is used
--cc=CC 指定使用何种C编译器(默认gcc)use C compiler CC [gcc]
--make=MAKE 使用特定的make | use specified make [make]
--extra-cflags=ECFLAGS 添加ECFLAGS到CFLAGS | add ECFLAGS to CFLAGS []
--extra-ldflags=ELDFLAGS 添加ELDFLAGS到LDFLAGS(默认-Wl,--as-needed)| add ELDFLAGS to LDFLAGS [ -Wl,--as-needed]
--extra-libs=ELIBS 添加ELIBS | add ELIBS []
--build-suffix=SUFFIX 为专用程序添加后缀 | suffix for application specific build []
--arch=ARCH 选择机器架构(默认x86)select architecture [x86]
--cpu=CPU 选用最低的cpu(影响指令的选择,可以在老CPU上出错) | selects the minimum cpu required (affects

instruction selection, may crash on older CPUs)
--powerpc-perf-enable 启用PPC上面的性能报告(需要启用PMC)enable performance report on PPC
(requires enabling PMC)
--disable-mmx 禁用MMX | disable MMX usage
--disable-armv5te 禁用armv5te | disable armv5te usage
--disable-iwmmxt 禁用iwmmxt | disable iwmmxt usage
--disable-altivec 禁用AltiVec | disable AltiVec usage
--disable-audio-oss 禁用OSS音频支持(默认启用)disable OSS audio support [default=no]
--disable-audio-beos 禁用BeOS音频支持(默认启用)disable BeOS audio support [default=no]
--disable-v4l 禁用video4linux提取(默认启用)disable video4linux grabbing [default=no]
--disable-v4l2 禁用video4linux2提取(默认启用)disable video4linux2 grabbing [default=no]
--disable-bktr 禁用bktr视频提取(默认启用)disable bktr video grabbing [default=no]
--disable-dv1394 禁用DV1394提取(默认启用)disable DV1394 grabbing [default=no]
--disable-network 禁用网络支持(默认支持)disable network support [default=no]
--disable-ipv6 禁用ipv6支持(默认支持)disable ipv6 support [default=no]
--disable-zlib 禁用zlib(默认支持)disable zlib [default=no]
--disable-simple_idct 禁用simple IDCT例程(默认启用)disable simple IDCT routines [default=no]
--disable-vhook 禁用video hooking支持 | disable video hooking support
--enable-gprof enable profiling with gprof [no]
--disable-debug 禁用调试符号 | disable debugging symbols
--disable-opts 禁用编译器最优化 | disable compiler optimizations
--disable-mpegaudio-hp 启用更快的解码MPEG音频(但精确度较低)(默认禁用)faster (but less accurate) MPEG audio decoding

[default=no]
--disable-protocols 禁用 I/O 协议支持(默认启用)disable I/O protocols support [default=no]
--disable-ffserver 禁用生成ffserver | disable ffserver build
--disable-ffplay 禁用生成ffplay | disable ffplay build
--enable-small 启用优化文件尺寸大小(牺牲速度)optimize for size instead of speed
--enable-memalign-hack 启用模拟内存排列,由内存调试器干涉? | emulate memalign, interferes with memory debuggers
--disable-strip 禁用剥离可执行程序和共享库 | disable stripping of executables and shared libraries
--disable-encoder=NAME 禁用XX编码器 | disables encoder NAME
--enable-encoder=NAME 启用XX编码器 | enables encoder NAME
--disable-decoder=NAME 禁用XX解码器 | disables decoder NAME
--enable-decoder=NAME 启用XX解码器 | enables decoder NAME
--disable-encoders 禁用所有编码器 | disables all encoders
--disable-decoders 禁用所有解码器 | disables all decoders
--disable-muxer=NAME 禁用XX混音器 | disables muxer NAME
--enable-muxer=NAME 启用XX混音器 | enables muxer NAME
--disable-muxers 禁用所有混音器 | disables all muxers
--disable-demuxer=NAME 禁用XX解轨器 | disables demuxer NAME
--enable-demuxer=NAME 启用XX解轨器 | enables demuxer NAME
--disable-demuxers 禁用所有解轨器 | disables all demuxers
--enable-parser=NAME 启用XX剖析器 | enables parser NAME
--disable-parser=NAME 禁用XX剖析器 | disables parser NAME
--disable-parsers 禁用所有剖析器 | disables all parsers


8 参考资料

ffmpeg的编译大全
ffmpeg的使用
ffmpeg_mencoder环境搭建和视频处理总结
自译的ffmpeg ./configure参数


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics