标题真不是夸张,这几天在整理视频相关的处理流程,为了获得一些性能数据,打算在自己的MacBook Pro 上面装ffmepg,这一折腾4、5天就过去了。有些问题,在解决之后就豁然开朗了,没有解决之前,真的是百思不得其解,中间就好像隔着一层纱一样。现在将这几天的经历记录下来,一是方便自己后面查看,二是希望节省大家的时间。
我的Mac OS版本是macOS Catalina 10.15.1,Xcode版本是11.1,安装了Command Line Tools for Xcode 11 ,处理器是2 GHz 四核Intel Core i7,内存是8 GB 1600 MHz DDR3。
首先需要说明一下,网上有些资料可能是很久之前写的,对应的Mac OS版本也比较早,以前能用的步骤的,现在可能就不行了。下面列举几个在我的机器上面不适用的场景,若有其他人也遇到了,可以参照一下,有时候可以根据命令的执行错误信息去Google或者百度从而找到解决办法,有时候也可能会被带到沟里面去(我就是被带到沟里好几天了):
- 直接用如下brew命令安装ffmpeg,并用--with-带上若干关联的编码解码库,这样是不行的,若执行则会得到错误信息“invalid option: --with-chromaprint”。
brew install ffmpeg --with-chromaprint --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-game-music-emu --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-sdl2 --with-snappy --with-speex --with-tesseract --with-theora --with-tools --with-two-lame --with-wavpack --with-webp --with-x265 --with-xz --with-zeromq --with-zim
- 用如下命令尝试将input_file_name.mp4视频从mpeg4制式(视频是x264编码,音频是aac编码)转成webm制式(视频是vp9编码,音频是opus编码),是不行的,若执行则会得到错误信息“Unknown decoder 'libx264'”、“Unrecognized option 'y '.”,根据此错误信息去找解决方案同样会被带到沟里面去。
ffmpeg -y -c:a libfdk_aac -c:v libx264 -i input_file_name.mp4 -c:v libvpx-vp9 -c:a libvorbis output_file_name.webmffmpeg -y -acodec libfdk_aac -vcodec libx264 -i input_file_name.mp4 -c:v libvpx-vp9 -c:a libvorbis output_file_name.webm
官方文档一般会有人去维护,出错或者不兼容的可能性较低,出现问题后,一般首先需要想到去官方文档(MacOS ffmpeg 官方文档)查看解决办法。我是搜了一下网上的参考资料,后面被折腾了好几天,实在没有办法了,又去仔细看了一下官方文档。上面介绍了三种方法,一是通过HomeBrew安装,二是通过编译好的静态库,三是通过ffmpeg源码安装。本文重点将通过HomeBrew的方式进行安装,且经过实践确定是可行的,具体如下:
第一步,安装Homebrew
Mac里面常用的命令行包管理工具,通过如下命令执行安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
第二步,安装ffmpeg
执行
brew install ffmpeg
或者执行都可以,唯一区别是下面语句安装的是最新版本。
brew install ffmpeg --HEAD
两者都会检测ffmpeg的依赖包并自动安装上,请耐心等待,可以用ps -ef | grep ffmpeg 看一下最新进展。上面两步都没有问题,好多博客也都这么写的,但是需要看清官方的下面表述“Since v2.0, Homebrew does not offer options for its core formulae anymore. Users who want to build ffmpeg with additional libraries (including non-free ones) need to use so-called taps from third party repositories. These repositories are not maintained by Homebrew”,简单说一下就是“从brew的2.0版本开始,brew不再提供针对ffmepg的options的一键关联安装了,如果需要将options和ffmpeg关联起来的话,需要采用第三方的options仓库”。我的brew版本如下,所以仅仅通过上面两步来安装ffmepg,是关联不了诸如x264,vp9等视频编解码器的。如果有同学也是这种情况,需要注意一下。
Homebrew 2.1.15Homebrew/homebrew-core (git revision c10ec; last commit 2019-11-02)Homebrew/homebrew-cask (git revision bd0e9; last commit 2019-11-02)
第三步,选择一个第三方仓库,安装options、并和ffmepg关联起来。
有两个仓库,分别是homebrew-ffmpeg和varenc-homebrew-ffmpeg ,我用的是第一个,有兴趣的同学可以用第二个尝试一下。
1)执行
brew tap homebrew-ffmpeg/ffmpeg
2)执行
brew install homebrew-ffmpeg/ffmpeg/ffmpeg
3)执行如下命令,看此仓库支持哪些options。
brew options homebrew-ffmpeg/ffmpeg/ffmpeg
4)根据第3)步得到的options,替换下面命令中的option,然后执行
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with- --with- ...
执行如上几个步骤后,就成功的安装好ffmepg及其依赖包,同时将ffmepg和许多编解码库关联起来了。
第四步,实际操作几个视频验证一下
以4K网站上面的一个4K视频puppies-bath-in-4k为例
抽帧,每20秒抽一帧,操作耗时在34.87秒左右。
JAMESWHALE-MB2:Downloads james$ ffmpeg -i PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4 -f image2 -vf fps=fps=1/20 puppies_%d.pngffmpeg version git-2019-11-01-53c21c2 Copyright (c) 2000-2019 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.8) configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-53c21c2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 60.100 / 58. 60.100 libavformat 58. 33.100 / 58. 33.100 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2012-09-21T01:14:45.000000Z Duration: 00:02:29.63, start: 0.000000, bitrate: 21244 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 4096x2304, 21049 kb/s, 23.98 fps, 24 tbr, 48 tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: creation_time : 2012-09-21T01:14:45.000000Z handler_name : IsoMedia File Produced by Google, 5-11-2011Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> png (native))Press [q] to stop, [?] for helpOutput #0, image2, to 'puppies_%d.png': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf58.33.100 Stream #0:0(und): Video: png, rgb24, 4096x2304, q=2-31, 200 kb/s, 0.05 fps, 0.05 tbn, 0.05 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler encoder : Lavc58.60.100 pngframe= 7 fps=0.2 q=-0.0 Lsize=N/A time=00:02:20.00 bitrate=N/A speed=3.68xvideo:41191kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
调整码率和尺寸,操作耗时在77.43秒左右,文件大小从400MB左右减少到15MB左右,分辨率从4K调整为1280*720,减轻手机等无线设备的带宽和流量压力。
JAMESWHALE-MB2:Downloads james$ ffmpeg -i PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4 -crf 32 -b 0.5M -minrate 0.5M -maxrate 1M -bufsize 1M -vf scale=1280:720 PUPPIES_BATH_IN_1280_720p.mp4ffmpeg version git-2019-11-01-53c21c2 Copyright (c) 2000-2019 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.8) configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-53c21c2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 60.100 / 58. 60.100 libavformat 58. 33.100 / 58. 33.100 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2012-09-21T01:14:45.000000Z Duration: 00:02:29.63, start: 0.000000, bitrate: 21244 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 4096x2304, 21049 kb/s, 23.98 fps, 24 tbr, 48 tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: creation_time : 2012-09-21T01:14:45.000000Z handler_name : IsoMedia File Produced by Google, 5-11-2011Please use -b:a or -b:v, -b is ambiguousStream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native))Press [q] to stop, [?] for help[libx264 @ 0x7f9a43016c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2[libx264 @ 0x7f9a43016c00] profile High, level 3.1[libx264 @ 0x7f9a43016c00] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - 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=12 lookahead_threads=2 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=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=32.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1000 vbv_bufsize=1000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00Output #0, mp4, to 'PUPPIES_BATH_IN_1280_720p.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf58.33.100 Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, q=-1--1, 500 kb/s, 24 fps, 12288 tbn, 24 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler encoder : Lavc58.60.100 libx264 Side data: cpb: bitrate max/min/avg: 1000000/0/500000 buffer size: 1000000 vbv_delay: N/A Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2012-09-21T01:14:45.000000Z handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc58.60.100 aacframe= 3591 fps= 48 q=-1.0 Lsize= 14765kB time=00:02:29.60 bitrate= 808.5kbits/s dup=3 drop=0 speed=1.98xvideo:12301kB audio:2351kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.772543%[libx264 @ 0x7f9a43016c00] frame I:32 Avg QP:28.63 size: 17804[libx264 @ 0x7f9a43016c00] frame P:978 Avg QP:32.61 size: 6742[libx264 @ 0x7f9a43016c00] frame B:2581 Avg QP:35.31 size: 2105[libx264 @ 0x7f9a43016c00] consecutive B-frames: 3.5% 1.2% 2.0% 93.2%[libx264 @ 0x7f9a43016c00] mb I I16..4: 31.9% 62.0% 6.1%[libx264 @ 0x7f9a43016c00] mb P I16..4: 7.1% 9.9% 0.5% P16..4: 34.3% 4.3% 1.4% 0.0% 0.0% skip:42.6%[libx264 @ 0x7f9a43016c00] mb B I16..4: 0.2% 0.5% 0.0% B16..8: 25.5% 1.6% 0.1% direct: 0.4% skip:71.4% L0:39.9% L1:58.9% BI: 1.2%[libx264 @ 0x7f9a43016c00] 8x8 transform intra:58.1% inter:91.0%[libx264 @ 0x7f9a43016c00] coded y,uvDC,uvAC intra: 23.9% 36.4% 10.0% inter: 3.9% 5.3% 0.2%[libx264 @ 0x7f9a43016c00] i16 v,h,dc,p: 23% 40% 8% 29%[libx264 @ 0x7f9a43016c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 14% 35% 5% 6% 7% 6% 6% 5%[libx264 @ 0x7f9a43016c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 20% 23% 6% 7% 7% 6% 5% 3%[libx264 @ 0x7f9a43016c00] i8c dc,h,v,p: 70% 15% 11% 3%[libx264 @ 0x7f9a43016c00] Weighted P-Frames: Y:4.2% UV:3.7%[libx264 @ 0x7f9a43016c00] ref P L0: 60.8% 15.5% 18.1% 5.5% 0.1%[libx264 @ 0x7f9a43016c00] ref B L0: 91.6% 6.5% 1.9%[libx264 @ 0x7f9a43016c00] ref B L1: 97.6% 2.4%[libx264 @ 0x7f9a43016c00] kb/s:673.46[aac @ 0x7f9a43018400] Qavg: 237.150
将mpeg4制式转成webm格式,源音视频编码是不用写的,ffmepg可以自己读取(例如,这里的视频编码是h.264,音频编码是aac),写了之后反而会报Unknown decoder 'libx264'错误。可以指定目标编码,若不指定,ffmepg会根据输出文件名后缀采用合适的音视频编码,例如,这里的输出文件名后缀是.webm, 则制式采用webm格式,视频编码用vp9,音频编码用opus。vp9还真挺厉害,在h.264基础上,又压缩掉了70%(400MB->107MB)。
JAMESWHALE-MB2:Downloads james$ ffmpeg -i PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4 PUPPIES_BATH_IN_4K_Original_H.264_AAC.webmffmpeg version git-2019-11-01-53c21c2 Copyright (c) 2000-2019 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.8) configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-53c21c2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 60.100 / 58. 60.100 libavformat 58. 33.100 / 58. 33.100 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PUPPIES_BATH_IN_4K_Original_H.264_AAC.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2012-09-21T01:14:45.000000Z Duration: 00:02:29.63, start: 0.000000, bitrate: 21244 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 4096x2304, 21049 kb/s, 23.98 fps, 24 tbr, 48 tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: creation_time : 2012-09-21T01:14:45.000000Z handler_name : IsoMedia File Produced by Google, 5-11-2011Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9)) Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))Press [q] to stop, [?] for help[libvpx-vp9 @ 0x7fc0ce010600] v1.8.1[libvpx-vp9 @ 0x7fc0ce010600] Neither bitrate nor constrained quality specified, using default CRF of 32[libopus @ 0x7fc0ce013c00] No bit rate set. Defaulting to 96000 bps.ate= -0.0kbits/s speed=N/AOutput #0, webm, to 'PUPPIES_BATH_IN_4K_Original_H.264_AAC.webm': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf58.33.100 Stream #0:0(und): Video: vp9 (libvpx-vp9), yuv420p(progressive), 4096x2304, q=-1--1, 24 fps, 1k tbn, 24 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler encoder : Lavc58.60.100 libvpx-vp9 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1(und): Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s (default) Metadata: creation_time : 2012-09-21T01:14:45.000000Z handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc58.60.100 libopusframe= 3588 fps=0.3 q=0.0 Lsize= 104601kB time=00:02:29.61 (这个不是耗时)bitrate=5727.3kbits/s speed=0.0116xvideo:102527kB audio:1994kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.076851%
将mpeg4制式转成webm制式,原音视频编码仍然从输入文件获取,这次明确指定目标视频编码为vp8,目标音频编码没有明确指定,ffmpeg根据输出文件后缀.webm默认采用opus音频编码。vp8在h.264基础上,又压缩掉了20%左右(15.1MB->12.1MB),操作耗时在599.15秒左右。
JAMESWHALE-MB2:Downloads james$ ffmpeg -i PUPPIES_BATH_IN_1280_720p.mp4 -vcodec vp8 -crf 32 -b 0.5M -minrate 0.5M -maxrate 1M -bufsize 1M PUPPIES_BATH_IN_1280_720p.webmffmpeg version git-2019-11-01-53c21c2 Copyright (c) 2000-2019 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.8) configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-53c21c2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include/darwin -fno-stack-check' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 35.101 / 56. 35.101 libavcodec 58. 60.100 / 58. 60.100 libavformat 58. 33.100 / 58. 33.100 libavdevice 58. 9.100 / 58. 9.100 libavfilter 7. 66.100 / 7. 66.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PUPPIES_BATH_IN_1280_720p.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.33.100 Duration: 00:02:29.63, start: 0.000000, bitrate: 808 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 673 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : IsoMedia File Produced by Google, 5-11-2011Please use -b:a or -b:v, -b is ambiguousStream mapping: Stream #0:0 -> #0:0 (h264 (native) -> vp8 (libvpx)) Stream #0:1 -> #0:1 (aac (native) -> opus (libopus))Press [q] to stop, [?] for help[libopus @ 0x7fa68c002800] No bit rate set. Defaulting to 96000 bps.[libvpx @ 0x7fa68c001600] v1.8.1Output #0, webm, to 'PUPPIES_BATH_IN_1280_720p.webm': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.33.100 Stream #0:0(und): Video: vp8 (libvpx), yuv420p, 1280x720, q=-1--1, 500 kb/s, 24 fps, 1k tbn, 24 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.60.100 libvpx Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 1000000 vbv_delay: N/A Stream #0:1(und): Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s (default) Metadata: handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc58.60.100 libopusframe= 3591 fps=6.0 q=0.0 Lsize= 11812kB time=00:02:29.61 bitrate= 646.7kbits/s speed=0.249xvideo:9750kB audio:1984kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.665825%
总结
遇到问题不能怕,即使经过了很多天的折磨,仍然需要保持耐心和清醒的头脑,问题解决之后的成就感是对过程中付出的最大回报。
原文 Mac OS上使用ffmpeg的“血泪”总结 - 知乎
★文末名片可以免费领取音视频开发学习资料,内容包括(FFmpeg ,webRTC ,rtmp ,hls ,rtsp ,ffplay ,srs)以及音视频学习路线图等等。
见下方!↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
来源地址:https://blog.csdn.net/yinshipin007/article/details/131290418