参考:
ubuntu14.04下安装ffmpeg
linux安装ffmpeg:ubuntu14.04+ffmpeg
1 安装各种依赖包
1.1 yasm(libx264需要依赖yasm)
sudo apt-get install yasm
1.2 libx264
sudo apt-get install libx264-dev
1.3 libfaac
sudo apt-get install libfaac-dev
1.4 libmp3lame
sudo apt-get install libmp3lame-dev
1.5 libtheora
sudo apt-get install libtheora-dev
1.6 libvorbis
sudo apt-get install libvorbis-dev
1.7 libxvid
sudo apt-get install libxvidcore-dev
1.8 libxext
sudo apt-get install libxext-dev
1.9 libxfixes
sudo apt-get install libxfixes-dev
2 编译ffmpeg源码
2.1 个人笔记本在原win10系统上新装的ubuntu14.04双系统,从官网下载最新版本的FFmpeg 4.1.1和4.1都make的时候不成功(另外一台ubuntu14.04台式机可以编译成功),configure也提示失败
ame@ame-yume:~/ffmpeg/ffmpeg-4.1$ ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
Unknown option "--enable-libfaac".
See ./configure --help for available options.
ame@ame-yume:~/ffmpeg/ffmpeg-4.1$ ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
Unknown option "--enable-x11grab".
See ./configure --help for available options.
去掉"--enable-libfaac"和"--enable-x11grab",或者不带任何参数都可以configure通过,但make时又报错如下:
fftools/ffmpeg.c:3999:13: warning: ‘codec’ is deprecated (declared at ./libavformat/avformat.h:878) [-Wdeprecated-declarations]
input_streams[i]->st->codec->debug = debug;
^
LD ffmpeg_g
/usr/bin/ld: libavfilter/libavfilter.a(bbox.o):普通ELF重定位(M: 183)
/usr/bin/ld: libavfilter/libavfilter.a(bbox.o):普通ELF重定位(M: 183)
/usr/bin/ld: libavfilter/libavfilter.a(bbox.o):普通ELF重定位(M: 183)
/usr/bin/ld: libavfilter/libavfilter.a(bbox.o):普通ELF重定位(M: 183)
libavfilter/libavfilter.a: error adding symbols: 文件格式错误
collect2: error: ld returned 1 exit status
make: *** [ffmpeg_g] 错误 1
暂时无法解决,尝试以前的旧版本可以编译通过。
2.2 使用FFmpeg 2.7.7 configure和make都成功
ame@ame-yume:~/ffmpeg$ cd ffmpeg-2.7.7
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ls
arch.mak cmdutils_opencl.c COPYING.GPLv3 ffmpeg.c ffmpeg_vda.c ffserver_config.c libavfilter library.mak Makefile tests
Changelog common.mak COPYING.LGPLv2.1 ffmpeg_dxva2.c ffmpeg_vdpau.c ffserver_config.h libavformat libswresample presets tools
cmdutils.c compat COPYING.LGPLv3 ffmpeg_filter.c ffplay.c INSTALL.md libavresample libswscale README.md VERSION
cmdutils_common_opts.h configure CREDITS ffmpeg.h ffprobe.c libavcodec libavutil LICENSE.md RELEASE version.sh
cmdutils.h COPYING.GPLv2 doc ffmpeg_opt.c ffserver.c libavdevice libpostproc MAINTAINERS RELEASE_NOTES
2.2.1 编译前执行configure配置:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
install prefix /usr/local/ffmpeg
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
yasm yes
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AVX enabled yes
XOP enabled yes
FMA3 enabled yes
FMA4 enabled yes
i686 features enabled yes
CMOV is fast yes
EBX available yes
EBP available yes
debug symbols yes
strip symbols yes
optimize for size no
optimizations yes
static yes
shared no
postprocessing support yes
new filter support yes
network support yes
threading support pthreads
safe bitstream reader yes
SDL support no
opencl enabled no
texi2html enabled no
perl enabled yes
pod2man enabled yes
makeinfo enabled no
makeinfo supports HTML no
External libraries:
iconv libtheora libxcb
libfaac libvorbis libxvid
libmp3lame libx264 xlib
Enabled decoders:
aac bink h263i
aac_latm binkaudio_dct h263p
aasc binkaudio_rdft h264
ac3 bintext hevc
ac3_fixed bmp hnm4_video
adpcm_4xm bmv_audio hq_hqa
adpcm_adx bmv_video hqx
adpcm_afc brender_pix huffyuv
adpcm_ct c93 iac
adpcm_dtk cavs idcin
adpcm_ea ccaption idf
adpcm_ea_maxis_xa cdgraphics iff_byterun1
adpcm_ea_r1 cdxl iff_ilbm
adpcm_ea_r2 cinepak imc
adpcm_ea_r3 cljr indeo2
adpcm_ea_xas cllc indeo3
adpcm_g722 comfortnoise indeo4
adpcm_g726 cook indeo5
adpcm_g726le cpia interplay_dpcm
adpcm_ima_amv cscd interplay_video
adpcm_ima_apc cyuv jacosub
adpcm_ima_dk3 dca jpeg2000
adpcm_ima_dk4 dfa jpegls
adpcm_ima_ea_eacs dirac jv
adpcm_ima_ea_sead dnxhd kgv1
adpcm_ima_iss dpx kmvc
adpcm_ima_oki dsd_lsbf lagarith
adpcm_ima_qt dsd_lsbf_planar libvorbis
adpcm_ima_rad dsd_msbf loco
adpcm_ima_smjpeg dsd_msbf_planar mace3
adpcm_ima_wav dsicinaudio mace6
adpcm_ima_ws dsicinvideo mdec
adpcm_ms dss_sp metasound
adpcm_sbpro_2 dvbsub microdvd
adpcm_sbpro_3 dvdsub mimic
adpcm_sbpro_4 dvvideo mjpeg
adpcm_swf dxtory mjpegb
adpcm_thp eac3 mlp
adpcm_vima eacmv mmvideo
adpcm_xa eamad motionpixels
adpcm_yamaha eatgq movtext
aic eatgv mp1
alac eatqi mp1float
alias_pix eightbps mp2
als eightsvx_exp mp2float
amrnb eightsvx_fib mp3
amrwb escape124 mp3adu
amv escape130 mp3adufloat
anm evrc mp3float
ansi ffv1 mp3on4
ape ffvhuff mp3on4float
ass ffwavesynth mpc7
asv1 fic mpc8
asv2 flac mpeg1video
atrac1 flic mpeg2video
atrac3 flv mpeg4
atrac3p fourxm mpegvideo
aura fraps mpl2
aura2 frwu msa1
avrn g723_1 msmpeg4v1
avrp g729 msmpeg4v2
avs gif msmpeg4v3
avui gsm msrle
ayuv gsm_ms mss1
bethsoftvid h261 mss2
bfi h263 msvideo1
mszh qpeg twinvq
mts2 qtrle txd
mvc1 r10k ulti
mvc2 r210 utvideo
mxpeg ra_144 v210
nellymoser ra_288 v210x
nuv ralf v308
on2avc rawvideo v408
opus realtext v410
paf_audio rl2 vb
paf_video roq vble
pam roq_dpcm vc1
pbm rpza vc1image
pcm_alaw rv10 vcr1
pcm_bluray rv20 vima
pcm_dvd rv30 vmdaudio
pcm_f32be rv40 vmdvideo
pcm_f32le s302m vmnc
pcm_f64be sami vorbis
pcm_f64le sanm vp3
pcm_lxf sgi vp5
pcm_mulaw sgirle vp6
pcm_s16be shorten vp6a
pcm_s16be_planar sipr vp6f
pcm_s16le smackaud vp7
pcm_s16le_planar smacker vp8
pcm_s24be smc vp9
pcm_s24daud smvjpeg vplayer
pcm_s24le snow vqa
pcm_s24le_planar sol_dpcm wavpack
pcm_s32be sonic webp
pcm_s32le sp5x webvtt
pcm_s32le_planar srt wmalossless
pcm_s8 ssa wmapro
pcm_s8_planar stl wmav1
pcm_u16be subrip wmav2
pcm_u16le subviewer wmavoice
pcm_u24be subviewer1 wmv1
pcm_u24le sunrast wmv2
pcm_u32be svq1 wmv3
pcm_u32le svq3 wmv3image
pcm_u8 tak wnv1
pcm_zork targa ws_snd1
pcx targa_y216 xan_dpcm
pgm text xan_wc3
pgmyuv theora xan_wc4
pgssub thp xbin
pictor tiertexseqvideo xbm
pjs tiff xface
ppm tmv xl
prores truehd xsub
prores_lgpl truemotion1 xwd
ptx truemotion2 y41p
qcelp truespeech yop
qdm2 tscc2 yuv4
qdraw tta zero12v
Enabled encoders:
a64multi libtheora pgm
a64multi5 libvorbis pgmyuv
aac libx264 ppm
ac3 libx264rgb prores
ac3_fixed libxvid prores_aw
adpcm_adx ljpeg prores_ks
adpcm_g722 mjpeg qtrle
adpcm_g726 movtext r10k
adpcm_ima_qt mp2 r210
adpcm_ima_wav mp2fixed ra_144
adpcm_ms mpeg1video rawvideo
adpcm_swf mpeg2video roq
adpcm_yamaha mpeg4 roq_dpcm
alac msmpeg4v2 rv10
alias_pix msmpeg4v3 rv20
amv msvideo1 s302m
ass nellymoser sgi
asv1 pam snow
asv2 pbm sonic
avrp pcm_alaw sonic_ls
avui pcm_f32be srt
ayuv pcm_f32le ssa
bmp pcm_f64be subrip
cinepak pcm_f64le sunrast
cljr pcm_mulaw svq1
comfortnoise pcm_s16be targa
dca pcm_s16be_planar tiff
dnxhd pcm_s16le tta
dpx pcm_s16le_planar utvideo
dvbsub pcm_s24be v210
dvdsub pcm_s24daud v308
dvvideo pcm_s24le v408
eac3 pcm_s24le_planar v410
ffv1 pcm_s32be vorbis
ffvhuff pcm_s32le wavpack
flac pcm_s32le_planar webvtt
flv pcm_s8 wmav1
g723_1 pcm_s8_planar wmav2
gif pcm_u16be wmv1
h261 pcm_u16le wmv2
h263 pcm_u24be xbm
h263p pcm_u24le xface
huffyuv pcm_u32be xsub
jpeg2000 pcm_u32le xwd
jpegls pcm_u8 y41p
libfaac pcx yuv4
libmp3lame
Enabled hwaccels:
Enabled parsers:
aac dvd_nav mpegvideo
aac_latm dvdsub opus
ac3 flac png
adx gsm pnm
bmp h261 rv30
cavsvideo h263 rv40
cook h264 tak
dca hevc vc1
dirac mjpeg vorbis
dnxhd mlp vp3
dpx mpeg4video vp8
dvbsub mpegaudio vp9
Enabled demuxers:
aac gsm mtv
ac3 gxf mv
act h261 mvi
adf h263 mxf
adp h264 mxg
adx hevc nc
aea hls nistsphere
afc hnm nsv
aiff ico nut
amr idcin nuv
anm idf ogg
apc iff oma
ape ilbc paf
apng image2 pcm_alaw
aqtitle image2_alias_pix pcm_f32be
asf image2_brender_pix pcm_f32le
ass image2pipe pcm_f64be
ast image_bmp_pipe pcm_f64le
au image_dpx_pipe pcm_mulaw
avi image_exr_pipe pcm_s16be
avr image_j2k_pipe pcm_s16le
avs image_jpeg_pipe pcm_s24be
bethsoftvid image_jpegls_pipe pcm_s24le
bfi image_pictor_pipe pcm_s32be
bink image_png_pipe pcm_s32le
bintext image_qdraw_pipe pcm_s8
bit image_sgi_pipe pcm_u16be
bmv image_sunrast_pipe pcm_u16le
boa image_tiff_pipe pcm_u24be
brstm image_webp_pipe pcm_u24le
c93 ingenient pcm_u32be
caf ipmovie pcm_u32le
cavsvideo ircam pcm_u8
cdg iss pjs
cdxl iv8 pmp
cine ivf pva
concat jacosub pvf
data jv qcp
daud latm r3d
dfa live_flv rawvideo
dirac lmlm4 realtext
dnxhd loas redspark
dsf lrc rl2
dsicin lvf rm
dss lxf roq
dts m4v rpl
dtshd matroska rsd
dv mgsts rso
dvbsub microdvd rtp
dxa mjpeg rtsp
ea mlp sami
ea_cdata mlv sap
eac3 mm sbg
epaf mmf sdp
ffm mov sdr2
ffmetadata mp3 segafilm
filmstrip mpc shorten
flac mpc8 siff
flic mpegps sln
flv mpegts smacker
fourxm mpegtsraw smjpeg
frm mpegvideo smush
g722 mpjpeg sol
g723_1 mpl2 sox
g729 mpsub spdif
gif msnwc_t测试:
cp srt
stl tty webm_dash_manifest
str txd webvtt
subviewer vc1 wsaud
subviewer1 vc1t wsvqa
sup vivo wtv
swf vmd wv
tak vobsub xa
tedcaptions voc xbin
thp vplayer xmv
tiertexseq vqf xwma
tmv w64 yop
truehd wav yuv4mpegpipe
tta wc3
Enabled muxers:
a64 ipod pcm_s32be
ac3 ircam pcm_s32le
adts ismv pcm_s8
adx ivf pcm_u16be
aiff jacosub pcm_u16le
amr latm pcm_u24be
apng lrc pcm_u24le
asf m4v pcm_u32be
asf_stream matroska pcm_u32le
ass matroska_audio pcm_u8
ast md5 psp
au microdvd rawvideo
avi mjpeg rm
avm2 mkvtimestamp_v2 roq
bit mlp rso
caf mmf rtp
cavsvideo mov rtp_mpegts
crc mp2 rtsp
dash mp3 sap
data mp4 segment
daud mpeg1system singlejpeg
dirac mpeg1vcd smjpeg
dnxhd mpeg1video smoothstreaming
dts mpeg2dvd sox
dv mpeg2svcd spdif
eac3 mpeg2video spx
f4v mpeg2vob srt
ffm mpegts stream_segment
ffmetadata mpjpeg swf
filmstrip mxf tee
flac mxf_d10 tg2
flv mxf_opatom tgp
framecrc null truehd
framemd5 nut uncodedframecrc
g722 oga vc1
g723_1 ogg vc1t
gif oma voc
gxf opus w64
h261 pcm_alaw wav
h263 pcm_f32be webm
h264 pcm_f32le webm_chunk
hds pcm_f64be webm_dash_manifest
hevc pcm_f64le webp
hls pcm_mulaw webvtt
ico pcm_s16be wtv
ilbc pcm_s16le wv
image2 pcm_s24be yuv4mpegpipe
image2pipe pcm_s24le
Enabled protocols:
cache http rtmpt
concat httpproxy rtp
crypto icecast srtp
data md5 subfile
ffrtmphttp mmsh tcp
file mmst udp
ftp pipe udplite
gopher rtmp unix
hls
Enabled filters:
adelay deshake pan
aecho detelecine perms
aeval drawbox perspective
aevalsrc drawgrid phase
afade earwax pixdesctest
aformat ebur128 pp
ainterleave edgedetect pp7
allpass elbg psnr
alphaextract eq pullup
alphamerge equalizer qp
amerge extractplanes removelogo
amix fade repeatfields
amovie fftfilt replaygain
anull field rgbtestsrc
anullsink fieldmatch rotate
anullsrc fieldorder sab
apad find_rect scale
aperms flanger select
aphaser format sendcmd
aresample fps separatefields
aselect framepack setdar
asendcmd framestep setfield
asetnsamples fspp setpts
asetpts geq setsar
asetrate gradfun settb
asettb haldclut showcqt
ashowinfo haldclutsrc showinfo
asplit hflip showpalette
astats highpass showspectrum
astreamsync histeq showwaves
atempo histogram showwavespic
atrim hqdn3d shuffleplanes
avectorscope hqx signalstats
bandpass hue silencedetect
bandreject idet silenceremove
bass il sine
bbox interlace smartblur
biquad interleave smptebars
blackdetect join smptehdbars
blackframe kerndeint split
blend lenscorrection spp
boxblur life stereo3d
cellauto lowpass super2xsai
channelmap lut swapuv
channelsplit lut3d tblend
chorus lutrgb telecine
codecview lutyuv testsrc
color mandelbrot thumbnail
colorbalance mcdeint tile
colorchannelmixer mergeplanes tinterlace
colorlevels movie transpose
colormatrix mpdecimate treble
compand mptestsrc trim
concat negate unsharp
copy noformat uspp
cover_rect noise vflip
crop null vignette
cropdetect nullsink volume
curves nullsrc volumedetect
dcshift overlay w3fdif
dctdnoiz owdenoise xbr
decimate pad yadif
dejudder palettegen zoompan
delogo paletteuse
Enabled bsfs:
aac_adtstoasc mjpeg2jpeg mpeg4_unpack_bframes
chomp mjpega_dump_header noise
dump_extradata mov2textsub remove_extradata
h264_mp4toannexb mp3_header_decompress text2movsub
imx_dump_header
Enabled indevs:
dv1394 lavfi v4l2
fbdev oss x11grab_xcb
Enabled outdevs:
fbdev oss v4l2
License: nonfree and unredistributable
Creating config.mak, config.h, and doc/config.texi...
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$
2.2.2 编译ffmpeg:
make时间较长,耗时超过十分钟。make成功的log如下:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ make
...
HOSTLD doc/print_options
GENTEXI doc/avoptions_format.texi
GENTEXI doc/avoptions_codec.texi
POD doc/ffmpeg.pod
POD doc/ffprobe.pod
POD doc/ffserver.pod
POD doc/ffmpeg-all.pod
POD doc/ffprobe-all.pod
POD doc/ffserver-all.pod
POD doc/ffmpeg-utils.pod
POD doc/ffmpeg-scaler.pod
POD doc/ffmpeg-resampler.pod
POD doc/ffmpeg-codecs.pod
POD doc/ffmpeg-bitstream-filters.pod
POD doc/ffmpeg-formats.pod
POD doc/ffmpeg-protocols.pod
POD doc/ffmpeg-devices.pod
POD doc/ffmpeg-filters.pod
POD doc/libavutil.pod
POD doc/libswscale.pod
POD doc/libswresample.pod
POD doc/libavcodec.pod
POD doc/libavformat.pod
POD doc/libavdevice.pod
POD doc/libavfilter.pod
MAN doc/ffmpeg.1
MAN doc/ffprobe.1
MAN doc/ffserver.1
MAN doc/ffmpeg-all.1
MAN doc/ffprobe-all.1
MAN doc/ffserver-all.1
MAN doc/ffmpeg-utils.1
MAN doc/ffmpeg-scaler.1
MAN doc/ffmpeg-resampler.1
MAN doc/ffmpeg-codecs.1
MAN doc/ffmpeg-bitstream-filters.1
MAN doc/ffmpeg-formats.1
MAN doc/ffmpeg-protocols.1
MAN doc/ffmpeg-devices.1
MAN doc/ffmpeg-filters.1
MAN doc/libavutil.3
MAN doc/libswscale.3
MAN doc/libswresample.3
MAN doc/libavcodec.3
MAN doc/libavformat.3
MAN doc/libavdevice.3
MAN doc/libavfilter.3
CC ffmpeg.o
ffmpeg.c: In function ‘write_frame’:
ffmpeg.c:641:9: warning: ‘destruct’ is deprecated (declared at ./libavcodec/avcodec.h:1183) [-Wdeprecated-declarations]
if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {
^
ffmpeg.c: In function ‘decode_video’:
ffmpeg.c:2027:13: warning: ‘av_log_ask_for_sample’ is deprecated (declared at ./libavcodec/avcodec.h:5219) [-Wdeprecated-declarations]
av_log_ask_for_sample(
^
CC cmdutils.o
cmdutils.c: In function ‘get_rotation’:
cmdutils.c:2109:9: warning: ‘av_log_ask_for_sample’ is deprecated (declared at ./libavcodec/avcodec.h:5219) [-Wdeprecated-declarations]
av_log_ask_for_sample(NULL, "Odd rotation angle\n");
^
CC ffmpeg_opt.o
CC ffmpeg_filter.o
LD ffmpeg_g
CP ffmpeg
STRIP ffmpeg
CC ffprobe.o
LD ffprobe_g
CP ffprobe
STRIP ffprobe
CC ffserver.o
CC ffserver_config.o
ffserver_config.c: In function ‘add_codec’:
ffserver_config.c:290:13: warning: ‘rc_eq’ is deprecated (declared at ./libavcodec/avcodec.h:2319) [-Wdeprecated-declarations]
av->rc_eq = av_strdup("tex^qComp");
^
ffserver_config.c:292:13: warning: ‘rc_eq’ is deprecated (declared at ./libavcodec/avcodec.h:2319) [-Wdeprecated-declarations]
WARNING("Setting default value for video rate control equation = "
^
LD ffserver_g
CP ffserver
STRIP ffserver
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$
2.2.3 安装ffmpeg:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ make install
mkdir: 无法创建目录"/usr/local/ffmpeg": 权限不够
make: *** [install-man] 错误 1
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ sudo make install
[sudo] password for ame:
INSTALL doc/ffmpeg.1
INSTALL doc/ffprobe.1
INSTALL doc/ffserver.1
INSTALL doc/ffmpeg-all.1
INSTALL doc/ffprobe-all.1
INSTALL doc/ffserver-all.1
INSTALL doc/ffmpeg-utils.1
INSTALL doc/ffmpeg-scaler.1
INSTALL doc/ffmpeg-resampler.1
INSTALL doc/ffmpeg-codecs.1
INSTALL doc/ffmpeg-bitstream-filters.1
INSTALL doc/ffmpeg-formats.1
INSTALL doc/ffmpeg-protocols.1
INSTALL doc/ffmpeg-devices.1
INSTALL doc/ffmpeg-filters.1
INSTALL doc/libavutil.3
INSTALL doc/libswscale.3
INSTALL doc/libswresample.3
INSTALL doc/libavcodec.3
INSTALL doc/libavformat.3
INSTALL doc/libavdevice.3
INSTALL doc/libavfilter.3
INSTALL doc/ffmpeg.1
INSTALL doc/ffprobe.1
INSTALL doc/ffserver.1
INSTALL doc/ffmpeg-all.1
INSTALL doc/ffprobe-all.1
INSTALL doc/ffserver-all.1
INSTALL doc/ffmpeg-utils.1
INSTALL doc/ffmpeg-scaler.1
INSTALL doc/ffmpeg-resampler.1
INSTALL doc/ffmpeg-codecs.1
INSTALL doc/ffmpeg-bitstream-filters.1
INSTALL doc/ffmpeg-formats.1
INSTALL doc/ffmpeg-protocols.1
INSTALL doc/ffmpeg-devices.1
INSTALL doc/ffmpeg-filters.1
INSTALL doc/libavutil.3
INSTALL doc/libswscale.3
INSTALL doc/libswresample.3
INSTALL doc/libavcodec.3
INSTALL doc/libavformat.3
INSTALL doc/libavdevice.3
INSTALL doc/libavfilter.3
INSTALL install-progs-yes
INSTALL ffmpeg
INSTALL ffprobe
INSTALL ffserver
INSTALL presets/libvpx-1080p50_60.ffpreset
INSTALL presets/libvpx-1080p.ffpreset
INSTALL presets/libvpx-360p.ffpreset
INSTALL presets/libvpx-720p50_60.ffpreset
INSTALL presets/libvpx-720p.ffpreset
INSTALL doc/ffprobe.xsd
INSTALL doc/examples/avio_list_dir.c
INSTALL doc/examples/avio_reading.c
INSTALL doc/examples/decoding_encoding.c
INSTALL doc/examples/demuxing_decoding.c
INSTALL doc/examples/extract_mvs.c
INSTALL doc/examples/filter_audio.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/qsvdec.c
INSTALL doc/examples/remuxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/transcode_aac.c
INSTALL doc/examples/transcoding.c
INSTALL doc/examples/Makefile
INSTALL doc/examples/README
INSTALL presets/libvpx-1080p50_60.ffpreset
INSTALL presets/libvpx-1080p.ffpreset
INSTALL presets/libvpx-360p.ffpreset
INSTALL presets/libvpx-720p50_60.ffpreset
INSTALL presets/libvpx-720p.ffpreset
INSTALL doc/ffprobe.xsd
INSTALL doc/examples/avio_list_dir.c
INSTALL doc/examples/avio_reading.c
INSTALL doc/examples/decoding_encoding.c
INSTALL doc/examples/demuxing_decoding.c
INSTALL doc/examples/extract_mvs.c
INSTALL doc/examples/filter_audio.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/qsvdec.c
INSTALL doc/examples/remuxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/transcode_aac.c
INSTALL doc/examples/transcoding.c
INSTALL doc/examples/Makefile
INSTALL doc/examples/README
INSTALL libavdevice/libavdevice.a
INSTALL libavfilter/libavfilter.a
INSTALL libavformat/libavformat.a
INSTALL libavcodec/libavcodec.a
INSTALL libpostproc/libpostproc.a
INSTALL libswresample/libswresample.a
INSTALL libswscale/libswscale.a
INSTALL libavutil/libavutil.a
INSTALL libavdevice/avdevice.h
INSTALL libavdevice/version.h
INSTALL libavdevice/libavdevice.pc
INSTALL libavfilter/asrc_abuffer.h
INSTALL libavfilter/avcodec.h
INSTALL libavfilter/avfilter.h
INSTALL libavfilter/avfiltergraph.h
INSTALL libavfilter/buffersink.h
INSTALL libavfilter/buffersrc.h
INSTALL libavfilter/version.h
INSTALL libavfilter/libavfilter.pc
INSTALL libavformat/avformat.h
INSTALL libavformat/avio.h
INSTALL libavformat/version.h
INSTALL libavformat/libavformat.pc
INSTALL libavcodec/avcodec.h
INSTALL libavcodec/avfft.h
INSTALL libavcodec/dv_profile.h
INSTALL libavcodec/d3d11va.h
INSTALL libavcodec/dxva2.h
INSTALL libavcodec/old_codec_ids.h
INSTALL libavcodec/qsv.h
INSTALL libavcodec/vaapi.h
INSTALL libavcodec/vda.h
INSTALL libavcodec/vdpau.h
INSTALL libavcodec/version.h
INSTALL libavcodec/vorbis_parser.h
INSTALL libavcodec/xvmc.h
INSTALL libavcodec/libavcodec.pc
INSTALL libpostproc/postprocess.h
INSTALL libpostproc/version.h
INSTALL libpostproc/libpostproc.pc
INSTALL libswresample/swresample.h
INSTALL libswresample/version.h
INSTALL libswresample/libswresample.pc
INSTALL libswscale/swscale.h
INSTALL libswscale/version.h
INSTALL libswscale/libswscale.pc
INSTALL libavutil/adler32.h
INSTALL libavutil/aes.h
INSTALL libavutil/attributes.h
INSTALL libavutil/audio_fifo.h
INSTALL libavutil/audioconvert.h
INSTALL libavutil/avassert.h
INSTALL libavutil/avstring.h
INSTALL libavutil/avutil.h
INSTALL libavutil/base64.h
INSTALL libavutil/blowfish.h
INSTALL libavutil/bprint.h
INSTALL libavutil/bswap.h
INSTALL libavutil/buffer.h
INSTALL libavutil/cast5.h
INSTALL libavutil/camellia.h
INSTALL libavutil/channel_layout.h
INSTALL libavutil/common.h
INSTALL libavutil/cpu.h
INSTALL libavutil/crc.h
INSTALL libavutil/display.h
INSTALL libavutil/downmix_info.h
INSTALL libavutil/error.h
INSTALL libavutil/eval.h
INSTALL libavutil/fifo.h
INSTALL libavutil/file.h
INSTALL libavutil/frame.h
INSTALL libavutil/hash.h
INSTALL libavutil/hmac.h
INSTALL libavutil/imgutils.h
INSTALL libavutil/intfloat.h
INSTALL libavutil/intreadwrite.h
INSTALL libavutil/lfg.h
INSTALL libavutil/log.h
INSTALL libavutil/macros.h
INSTALL libavutil/mathematics.h
INSTALL libavutil/md5.h
INSTALL libavutil/mem.h
INSTALL libavutil/motion_vector.h
INSTALL libavutil/murmur3.h
INSTALL libavutil/dict.h
INSTALL libavutil/old_pix_fmts.h
INSTALL libavutil/opt.h
INSTALL libavutil/parseutils.h
INSTALL libavutil/pixdesc.h
INSTALL libavutil/pixelutils.h
INSTALL libavutil/pixfmt.h
INSTALL libavutil/random_seed.h
INSTALL libavutil/replaygain.h
INSTALL libavutil/rational.h
INSTALL libavutil/ripemd.h
INSTALL libavutil/samplefmt.h
INSTALL libavutil/sha.h
INSTALL libavutil/sha512.h
INSTALL libavutil/stereo3d.h
INSTALL libavutil/threadmessage.h
INSTALL libavutil/time.h
INSTALL libavutil/timecode.h
INSTALL libavutil/timestamp.h
INSTALL libavutil/twofish.h
INSTALL libavutil/version.h
INSTALL libavutil/xtea.h
INSTALL libavutil/lzo.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/ffversion.h
INSTALL libavutil/libavutil.pc
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$
2.2.4 生成的ffmpeg可执行文件:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ll ffmpeg
-rwxrwxr-x 1 ame ame 14475728 2月 14 10:18 ffmpeg*
2.2.5 测试ffmpeg命令是否可用:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ffmpeg -version
ffmpeg:未找到命令
2.2.6 配置ffmpeg:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ sudo vim /etc/ld.so.conf
在文件中加入刚刚安装的源文件路径:/usr/local/ffmpeg/lib
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ll /usr/local/ffmpeg/lib
总用量 231440
drwxr-xr-x 3 root root 4096 2月 14 10:20 ./
drwxr-xr-x 6 root root 4096 2月 14 10:20 ../
-rw-r--r-- 1 root root 147692314 2月 14 10:20 libavcodec.a
-rw-r--r-- 1 root root 1866176 2月 14 10:20 libavdevice.a
-rw-r--r-- 1 root root 27158654 2月 14 10:20 libavfilter.a
-rw-r--r-- 1 root root 51261512 2月 14 10:20 libavformat.a
-rw-r--r-- 1 root root 2518732 2月 14 10:20 libavutil.a
-rw-r--r-- 1 root root 832700 2月 14 10:20 libpostproc.a
-rw-r--r-- 1 root root 656764 2月 14 10:20 libswresample.a
-rw-r--r-- 1 root root 4977422 2月 14 10:20 libswscale.a
drwxr-xr-x 2 root root 4096 2月 14 10:20 pkgconfig/
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ldconfig
/sbin/ldconfig.real: 无法创建临时缓冲文件 /etc/ld.so.cache~: 权限不够
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ sudo lgconfig
sudo:lgconfig: command not found
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ sudo ldconfig
2.2.7 配置系统环境变量:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ export PATH=/usr/local/ffmpeg/bin/:$PATH
完成安装和配置。
2.2.8 测试:
查看ffmpeg的版本:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ ffmpeg -version
ffmpeg version 2.7.7 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
2.2.9 查看PATH的值:
ame@ame-yume:~/ffmpeg/ffmpeg-2.7.7$ echo $PATH
/usr/local/ffmpeg/bin/:/home/ame/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ame/bin/android-ndk-r14b:/home/ame/bin/jdk-10/bin:/home/ame/Android/Sdk/platform-tools:/home/ame/Android/Sdk/build-tools:/home/ame/android-studio/bin
注意:
虽然通过上面export这样配置可以看到已经增加了ffmpeg的路径,但这个只是临时的,打开一个新的终端就不起作用了;所以需要持久化配置修改PATH路径才行,例如直接修改~/.bashrc文件中的配置如下:
export PATH=$PATH:$ANDROID_NDK:${JAVA_HOME}/bin:~/Android/Sdk/platform-tools:~/Android/Sdk/build-tools:~/android-studio/bin:/usr/local/ffmpeg/bin
再执行source ~/.bashrc生效,新打开终端或重启都会一直起作用
延伸阅读:ubuntu14.04系统Android NDK编译ffmpeg遇到的问题