FFmpeg是一套可以用来记录、转换数字音视频,并能将其转化为流的开源计算机程序。它包括了目前领先的音/视频编码库libavcodec等。
libavformat :用于各种音视频封装格式的生成和解析,包括获取解码所需信息以生成解码上下文结构和读取音视频帧等功能;
libavcodec :用于各种类型声音/图像编解码;
libavutil :包含一些公共的工具函数;
libswscale :用于视频场景比例缩放、色彩映射转换;
libpostproc:用于后期效果处理;
ffmpeg :该项目提供的一个工具,可用于格式转换、解码或电视卡即时编码等;
ffsever :一个 HTTP 多媒体即时广播串流服务器;
ffplay :是一个简单的播放器,使用ffmpeg 库解析和解码,通过SDL显示;
编译方法1:
1、下载ffmpeg1.1.2
apt-get install subversion //安装svn,
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg //下载ffmpeg源代码,保存目录/home/parallels/Documents/ffmpeg/test/ffmpeg.
//output:Checked out revision 26402.
apt-get install git//安装git
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg //http://ffmpeg.org/download.html官方下载ffmpeg方法,Receiving objects: 100% (314377/314377), 77.14 MiB | 145//KiB/s, done..
//保存目录://home/parallels/Documents/ffmpeg/test/test/ffmpeg
2、配置ffmpeg
2.1、./configure --enable-shared --prefix=/usr/local/ffmpeg //执行该命令,报如下的错误:yasm not found, use --disable-yasm for a crippled build
//解决方法:安装yasm
3、安装yasm
3.1、下载yasm
http://download.csdn.net/detail/reboot2009/4424607 //yasm是汇编编译器,因为ffmpeg中为了提高效率用到了汇编指令,比如MMX和SSE
3.2、配置yasm
./configure
注意:不要使用prefix指定安装路径什么的,否则后患无穷啊!
3.3、编译yasm
make
3.4、安装yasm
make install
###########
output:
root@parallels-Parallels-Virtual-Platform:~/Documents/ffmpeg/yasm-1.2.0# make install
make install-recursive
make[1]: Entering directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
Making install in po
make[2]: Entering directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0/po'
/bin/mkdir -p /usr/local/share
if test "yasm" = "gettext-tools"; then \
/bin/mkdir -p /usr/local/share/gettext/po; \
for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot Makevars.template; do \
/usr/bin/install -c -m 644 ./$file \
/usr/local/share/gettext/po/$file; \
done; \
for file in Makevars; do \
rm -f /usr/local/share/gettext/po/$file; \
done; \
else \
: ; \
fi
make[2]: Leaving directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0/po'
Making install in .
make[2]: Entering directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
make[3]: Entering directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c yasm ytasm vsyasm '/usr/local/bin'
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/usr/bin/install -c -m 644 libyasm.a '/usr/local/lib'
( cd '/usr/local/lib' && ranlib libyasm.a )
make install-exec-hook
make[4]: Entering directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
make[4]: Nothing to be done for `install-exec-hook'.
make[4]: Leaving directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
/usr/bin/install -c -m 644 libyasm.h '/usr/local/include'
test -z "/usr/local/share/man/man1" || /bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 yasm.1 '/usr/local/share/man/man1'
test -z "/usr/local/share/man/man7" || /bin/mkdir -p "/usr/local/share/man/man7"
/usr/bin/install -c -m 644 yasm_arch.7 yasm_parsers.7 yasm_dbgfmts.7 yasm_objfmts.7 '/usr/local/share/man/man7'
test -z "/usr/local/include/libyasm" || /bin/mkdir -p "/usr/local/include/libyasm"
/usr/bin/install -c -m 644 libyasm/arch.h libyasm/assocdat.h libyasm/bitvect.h libyasm/bytecode.h libyasm/compat-queue.h libyasm/coretype.h libyasm/dbgfmt.h libyasm/errwarn.h libyasm/expr.h libyasm/file.h libyasm/floatnum.h libyasm/hamt.h libyasm/insn.h libyasm/intnum.h libyasm/inttree.h libyasm/linemap.h libyasm/listfmt.h libyasm/md5.h libyasm/module.h libyasm/objfmt.h libyasm/parser.h libyasm/phash.h libyasm/preproc.h libyasm/section.h libyasm/symrec.h libyasm/valparam.h libyasm/value.h '/usr/local/include/libyasm'
test -z "/usr/local/include" || /bin/mkdir -p "/usr/local/include"
/usr/bin/install -c -m 644 libyasm-stdint.h '/usr/local/include'
make[3]: Leaving directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
make[2]: Leaving directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
make[1]: Leaving directory `/home/parallels/Documents/ffmpeg/yasm-1.2.0'
root@parallels-Parallels-Virtual-Platform:~/Documents/ffmpeg/yasm-1.2.0#
###########
4、重新配置ffmpeg
./configure //OK
##########
output:
root@parallels-Parallels-Virtual-Platform:~/Documents/ffmpeg/test/ffmpeg# ./configure
install prefix /usr/local
source path /home/parallels/Documents/ffmpeg/test/ffmpeg
C compiler gcc
ARCH x86 (generic)
big-endian no
runtime cpu detection no
yasm yes
MMX enabled yes
MMX2 enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
CMOV enabled yes
CMOV is fast yes
EBX available yes
EBP available yes
10 operands supported yes
debug symbols yes
strip symbols yes
optimizations yes
static yes
shared no
postprocessing support no
new filter support yes
network support yes
threading support pthreads
SDL support no
Sun medialib support no
AVISynth enabled no
frei0r enabled no
libdc1394 support no
libdirac enabled no
libfaac enabled no
libgsm enabled no
libmp3lame enabled no
libnut enabled no
libopencore-amrnb support no
libopencore-amrwb support no
libopencv support no
libopenjpeg enabled no
librtmp enabled no
libschroedinger enabled no
libspeex enabled no
libtheora enabled no
libvorbis enabled no
libvpx enabled no
libx264 enabled no
libxavs enabled no
libxvid enabled no
zlib enabled no
bzlib enabled no
Enabled decoders:
aac dsicinaudiompeg1video
aac_latm dsicinvideompeg2video
aasc dvbsub mpeg4
ac3 dvdsub mpegvideo
adpcm_4xm dvvideomsmpeg4v1
adpcm_adx eac3msmpeg4v2
adpcm_ct eacmvmsmpeg4v3
adpcm_ea eamadmsrle
adpcm_ea_maxis_xa eatgqmsvideo1
adpcm_ea_r1 eatgvmszh
adpcm_ea_r2 eatqinellymoser
adpcm_ea_r3 eightbpsnuv
adpcm_ea_xas eightsvx_exppam
adpcm_g722 eightsvx_fibpbm
adpcm_g726 escape124pcm_alaw
adpcm_ima_amv ffv1pcm_bluray
adpcm_ima_dk3 ffvhuffpcm_dvd
adpcm_ima_dk4 flacpcm_f32be
adpcm_ima_ea_eacs flicpcm_f32le
adpcm_ima_ea_sead flvpcm_f64be
adpcm_ima_iss fourxmpcm_f64le
adpcm_ima_qt frapspcm_lxf
adpcm_ima_smjpeg frwupcm_mulaw
adpcm_ima_wav gifpcm_s16be
adpcm_ima_ws gsmpcm_s16le
adpcm_ms gsm_mspcm_s16le_planar
adpcm_sbpro_2 h261pcm_s24be
adpcm_sbpro_3 h263pcm_s24daud
adpcm_sbpro_4 h263ipcm_s24le
adpcm_swf h264pcm_s32be
adpcm_thp huffyuvpcm_s32le
adpcm_xa idcinpcm_s8
adpcm_yamaha iff_byterun1pcm_u16be
alac iff_ilbm pcm_u16le
als imc pcm_u24be
amrnb indeo2 pcm_u24le
amrwb indeo3 pcm_u32be
amv indeo5 pcm_u32le
anm interplay_dpcmpcm_u8
ansi interplay_videopcm_zork
ape jpegls pcx
ass kgv1 pgm
asv1 kmvc pgmyuv
asv2 lagarith pgssub
atrac1 loco pictor
atrac3 mace3 ppm
aura mace6 ptx
aura2 mdec qcelp
avs mimic qdm2
bethsoftvid mjpegqdraw
bfi mjpegb qpeg
bink mlp qtrle
binkaudio_dct mmvideor10k
binkaudio_rdft motionpixelsr210
bmp mp1 ra_144
c93 mp1float ra_288
cavs mp2 rawvideo
cdgraphics mp2floatrl2
cinepak mp3 roq
cljr mp3adu roq_dpcm
cook mp3adufloatrpza
cscd mp3float rv10
cyuv mp3on4 rv20
dca mp3on4floatrv30
dnxhd mpc7 rv40
dpx mpc8 sgi
shorten truemotion1vp6a
sipr truemotion2vp6f
smackaud truespeechvp8
smacker tta vqa
smc twinvq wavpack
snow txd wmapro
sol_dpcm ulti wmav1
sonic v210 wmav2
sp5x v210x wmavoice
srt vb wmv1
sunrast vc1 wmv2
svq1 vcr1 wmv3
svq3 vmdaudio wnv1
targa vmdvideows_snd1
theora vmnc xan_dpcm
thp vorbis xan_wc3
tiertexseqvideo vp3xl
tiff vp5 xsub
tmv vp6 yop
truehd
Enabled encoders:
a64multi jpeglspcm_u24le
a64multi5 ljpegpcm_u32be
aac mjpeg pcm_u32le
ac3 mp2 pcm_u8
ac3_fixed mpeg1videopcm_zork
adpcm_adx mpeg2videopcx
adpcm_g722 mpeg4pgm
adpcm_g726 msmpeg4v1pgmyuv
adpcm_ima_qt msmpeg4v2ppm
adpcm_ima_wav msmpeg4v3qtrle
adpcm_ms nellymoserra_144
adpcm_swf pam rawvideo
adpcm_yamaha pbmroq
alac pcm_alaw roq_dpcm
ass pcm_f32be rv10
asv1 pcm_f32lerv20
asv2 pcm_f64besgi
bmp pcm_f64le snow
dnxhd pcm_mulawsonic
dvbsub pcm_s16besonic_ls
dvdsub pcm_s16lesvq1
dvvideo pcm_s24betarga
ffv1 pcm_s24daudtiff
ffvhuff pcm_s24lev210
flac pcm_s32bevorbis
flv pcm_s32le wmav1
gif pcm_s8 wmav2
h261 pcm_u16bewmv1
h263 pcm_u16lewmv2
h263p pcm_u24bexsub
huffyuv
Enabled hwaccels:
Enabled parsers:
aac dvdsub mpeg4video
aac_latm flac mpegaudio
ac3 h261 mpegvideo
cavsvideo h263pnm
dca h264 vc1
dirac mjpeg vp3
dnxhd mlp vp8
dvbsub
Enabled demuxers:
aac ipmovie pcm_u32be
ac3 iss pcm_u32le
aea iv8 pcm_u8
aiff ivf pva
amr lmlm4 qcp
anm lxf r3d
apc m4v rawvideo
ape matroska rl2
applehttp mjpegrm
asf mlp roq
ass mm rpl
au mmf rso
avi mov rtp
avs mp3 rtsp
bethsoftvid mpcsap
bfi mpc8 sdp
bink mpegps segafilm
c93 mpegts shorten
caf mpegtsraw siff
cavsvideo mpegvideosmacker
cdg msnwc_tcp sol
daud mtv sox
dirac mvi spdif
dnxhd mxf srt
dsicin mxg str
dts nc swf
dv nsv thp
dxa nut tiertexseq
ea nuv tmv
ea_cdata ogg truehd
eac3 oma tta
ffm pcm_alaw tty
ffmetadata pcm_f32betxd
filmstrip pcm_f32levc1
flac pcm_f64bevc1t
flic pcm_f64levmd
flv pcm_mulaw voc
fourxm pcm_s16bevqf
g722 pcm_s16lew64
gsm pcm_s24be wav
gxf pcm_s24le wc3
h261 pcm_s32bewsaud
h263 pcm_s32lewsvqa
h264 pcm_s8 wtv
idcin pcm_u16bewv
iff pcm_u16le xa
image2 pcm_u24beyop
image2pipe pcm_u24leyuv4mpegpipe
ingenient
Enabled muxers:
a64 ipod pcm_s16le
ac3 m4v pcm_s24be
adts matroska pcm_s24le
aiff matroska_audiopcm_s32be
amr md5 pcm_s32le
asf mjpeg pcm_s8
asf_stream mlppcm_u16be
ass mmf pcm_u16le
au mov pcm_u24be
avi mp2 pcm_u24le
avm2 mp3 pcm_u32be
cavsvideo mp4 pcm_u32le
crc mpeg1systempcm_u8
daud mpeg1vcd psp
dirac mpeg1videorawvideo
dnxhd mpeg2dvdrm
dts mpeg2svcd roq
dv mpeg2video rso
eac3 mpeg2vob rtp
ffm mpegts rtsp
ffmetadata mpjpegsap
filmstrip mxf sox
flac mxf_d10 spdif
flv null srt
framecrc nut swf
framemd5 ogg tg2
g722 pcm_alaw tgp
gif pcm_f32be truehd
gxf pcm_f32le vc1t
h261 pcm_f64bevoc
h263 pcm_f64lewav
h264 pcm_mulawwebm
image2 pcm_s16beyuv4mpegpipe
image2pipe
Enabled protocols:
concat mmst rtmpt
file pipe rtmpte
gopher rtmp rtp
http rtmpe tcp
md5 rtmps udp
mmsh
Enabled filters:
anull gradfun scale
anullsink hflipsetdar
anullsrc noformatsetpts
buffer null setsar
color nullsinksettb
copy nullsrc slicify
crop overlay transpose
drawbox pad unsharp
fifo pixdesctestvflip
format
Enabled bsfs:
aac_adtstoasc mjpeg2jpegmp3_header_decompress
chomp mjpega_dump_headernoise
dump_extradata mov2textsubremove_extradata
h264_mp4toannexb mp3_header_compresstext2movsub
imx_dump_header
Enabled indevs:
dv1394 oss v4l2
Enabled outdevs:
oss
License: LGPL version 2.1 or later
Creating config.mak and config.h...
root@parallels-Parallels-Virtual-Platform:~/Documents/ffmpeg/test/ffmpeg#
##########
5、编译ffmpeg
make
6、安装ffmpeg
make install
7、安装ffmpeg
apt-get install ffmpeg
##############
root@parallels-Parallels-Virtual-Platform:~/Documents/ffmpeg/ffmpeg-1.1.2# sudo apt-get install ffmpeg
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libav-tools libavcodec53 libavdevice53 libavfilter2 libavformat53 libavutil51 libpostproc52 libswscale2
The following NEW packages will be installed:
ffmpeg libav-tools libavdevice53 libavfilter2
The following packages will be upgraded:
libavcodec53 libavformat53 libavutil51 libpostproc52 libswscale2
5 upgraded, 4 newly installed, 0 to remove and 447 not upgraded.
Need to get 4,360 kB of archives.
After this operation, 2,251 kB of additional disk space will be used.
##############