编译支持MP3,H264编码的ffmpeg
ffmpeg原有的系统中支持mp3和h264的解码,但是编码并不支持,所以,需要是应用第三方插件进行支持;
从configure --help可以看出:
-
[StevenLiu@liudeMacBook-Pro ffmpeg]$ ./configure --help
-
--enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
-
--enable-libx264 enable H.264 encoding via x264 [no]
-
--enable-libmp3lame enable MP3 encoding via libmp3lame [no]
首先系统中需要包含libx264与libmp3lame,这两个lib能够从对应的git中下载得到
MP3编码对应web:
libx264对应Web: http://www.videolan.org/developers/x264.html
安装mp3编码库
-
./configure
-
make
-
make install
安装libx264编码库
孙悟空
-
./configure
-
make
-
make install
当安装的过程中遇到需要yasm的时候,可以--disabled-yasm,当然,并不建议disabled调,还是安装yasm更好一些
如果需要支持h264与mp3的话,可以使用如下参数进行支持
./configure --enable-libmp3lame --enable-libx264 --enable-gpl
由于libx264的code有GPL信息,所以,支持libx264时,需要--enable-gpl,ffmpeg在license方面还是比我们国内的人更重视
然后make&&make install即编译安装ffmpeg
接下来可以试一下
ok,生成完毕
-
[StevenLiu@liudeMacBook-Pro ffmpeg]$ ffmpeg -i test.mp4 -vcodec libx264 -b:v 1200k -r 25 -acodec mp3 -ab 128k -ar 44100 output.mp4
-
ffmpeg version N-56530-g29f244e Copyright (c) 2000-2013 the FFmpeg developers
-
built on Sep 21 2013 16:41:16 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
-
configuration: --enable-ffplay --enable-libmp3lame --enable-libx264 --enable-gpl
-
libavutil 52. 45.100 / 52. 45.100
-
libavcodec 55. 33.100 / 55. 33.100
-
libavformat 55. 18.102 / 55. 18.102
-
libavdevice 55. 3.100 / 55. 3.100
-
libavfilter 3. 86.102 / 3. 86.102
-
libswscale 2. 5.100 / 2. 5.100
-
libswresample 0. 17.103 / 0. 17.103
-
libpostproc 52. 3.100 / 52. 3.100
-
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
-
Metadata:
-
major_brand : isom
-
minor_version : 512
-
compatible_brands: isomiso2avc1mp41
-
encoder : Lavf55.18.102
-
Duration: 00:01:03.32, start: 0.021333, bitrate: 408 kb/s
-
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x352 [SAR 1:1 DAR 20:11], 278 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
-
Metadata:
-
handler_name : VideoHandler
-
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
-
Metadata:
-
handler_name : SoundHandler
-
File 'output.mp4' already exists. Overwrite ? [y/N] y
-
[libx264 @ 0x7fc462030a00] using SAR=1/1
-
[libx264 @ 0x7fc462030a00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
-
[libx264 @ 0x7fc462030a00] profile High, level 3.0
-
[libx264 @ 0x7fc462030a00] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - - 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=abr mbtree=1 bitrate=1200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
-
Output #0, mp4, to 'output.mp4':
-
Metadata:
-
major_brand : isom
-
minor_version : 512
-
compatible_brands: isomiso2avc1mp41
-
encoder : Lavf55.18.102
-
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x352 [SAR 1:1 DAR 20:11], q=-1--1, 1200 kb/s, 12800 tbn, 25 tbc (default)
-
Metadata:
-
handler_name : VideoHandler
-
Stream #0:1(und): Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 44100 Hz, stereo, fltp, 128 kb/s (default)
-
Metadata:
-
handler_name : SoundHandler
-
Stream mapping:
-
Stream #0:0 -> #0:0 (h264 -> libx264)
-
Stream #0:1 -> #0:1 (aac -> libmp3lame)
-
Press [q] to stop, [?] for help
-
frame= 1568 fps=132 q=-1.0 Lsize= 13081kB time=00:01:03.32 bitrate=1692.3kbits/s dup=1 drop=0
-
video:12033kB audio:990kB subtitle:0 global headers:0kB muxing overhead 0.443282%
-
[libx264 @ 0x7fc462030a00] frame I:10 Avg QP: 4.95 size: 31926
-
[libx264 @ 0x7fc462030a00] frame P:559 Avg QP: 4.58 size: 13941
-
[libx264 @ 0x7fc462030a00] frame B:999 Avg QP: 5.74 size: 4213
-
[libx264 @ 0x7fc462030a00] consecutive B-frames: 11.0% 9.1% 9.6% 70.4%
-
[libx264 @ 0x7fc462030a00] mb I I16..4: 48.3% 32.6% 19.1%
-
[libx264 @ 0x7fc462030a00] mb P I16..4: 2.2% 5.6% 2.9% P16..4: 20.3% 11.4% 8.9% 0.0% 0.0% skip:48.8%
-
[libx264 @ 0x7fc462030a00] mb B I16..4: 0.1% 0.3% 0.3% B16..8: 21.7% 5.6% 2.1% direct: 4.2% skip:65.8% L0:40.3% L1:43.8% BI:15.9%
-
[libx264 @ 0x7fc462030a00] final ratefactor: 6.67
-
[libx264 @ 0x7fc462030a00] 8x8 transform intra:48.6% inter:46.3%
-
[libx264 @ 0x7fc462030a00] coded y,uvDC,uvAC intra: 75.9% 71.3% 59.6% inter: 19.2% 15.8% 10.6%
-
[libx264 @ 0x7fc462030a00] i16 v,h,dc,p: 65% 19% 9% 8%
-
[libx264 @ 0x7fc462030a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 33% 13% 3% 4% 5% 6% 5% 6%
-
[libx264 @ 0x7fc462030a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 37% 10% 3% 5% 4% 5% 3% 4%
-
[libx264 @ 0x7fc462030a00] i8c dc,h,v,p: 46% 28% 19% 6%
-
[libx264 @ 0x7fc462030a00] Weighted P-Frames: Y:10.4% UV:4.8%
-
[libx264 @ 0x7fc462030a00] ref P L0: 69.1% 15.4% 12.1% 3.3% 0.1%
-
[libx264 @ 0x7fc462030a00] ref B L0: 87.2% 11.8% 1.1%
-
[libx264 @ 0x7fc462030a00] ref B L1: 95.3% 4.7%
-
[libx264 @ 0x7fc462030a00] kb/s:1571.58
-
[StevenLiu@liudeMacBook-Pro ffmpeg]$ ffmpeg -i output.mp4
-
ffmpeg version N-56530-g29f244e Copyright (c) 2000-2013 the FFmpeg developers
-
built on Sep 21 2013 16:41:16 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
-
configuration: --enable-ffplay --enable-libmp3lame --enable-libx264 --enable-gpl
-
libavutil 52. 45.100 / 52. 45.100
-
libavcodec 55. 33.100 / 55. 33.100
-
libavformat 55. 18.102 / 55. 18.102
-
libavdevice 55. 3.100 / 55. 3.100
-
libavfilter 3. 86.102 / 3. 86.102
-
libswscale 2. 5.100 / 2. 5.100
-
libswresample 0. 17.103 / 0. 17.103
-
libpostproc 52. 3.100 / 52. 3.100
-
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
-
Metadata:
-
major_brand : isom
-
minor_version : 512
-
compatible_brands: isomiso2avc1mp41
-
encoder : Lavf55.18.102
-
Duration: 00:01:03.34, start: 0.025057, bitrate: 1691 kb/s
-
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x352 [SAR 1:1 DAR 20:11], 1571 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
-
Metadata:
-
handler_name : VideoHandler
-
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, s16p, 128 kb/s (default)
-
Metadata:
-
handler_name : SoundHandler
-
At least one output file must be specified
-
[StevenLiu@liudeMacBook-Pro ffmpeg]$
阅读(584) | 评论(0) | 转发(0) |