ffmpeg
在macOS上安装ffmpeg
笔记本是macOS,以下以macOS为例。其他OS,参考ffmpeg官网https://ffmpeg.org/download.html
- 打开ternimal,输入命令 brew install ffmpeg开启安装。
MacBook-Air:~ $ brew install ffmpeg
==> Downloading https://homebrew.bintray.com/bottles/aom-2.0.0.catalina.bottle.t
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/acbd463a00751edc0ce70
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/dav1d-0.7.0.catalina.bottle
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/8379e085d9affd2875a55
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.37.catalina.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/c8e74da602c21f978cd7e
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.10.1.catalina.bo
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/ddd686141a969caec11ea
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.13.1.catalina.
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/64ff208b28613dfe2a65b
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/frei0r-1.7.0.catalina.bottl
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/5076041b5f3d76b94866a
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.2.0.catalina.bottle.t
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/2e6acd6e62d1b8ef08000
######################################################################## 100.0%
- 不停的下载啊!一看依赖库不少啊啊~~ 4G网好,下载吧,认啦。
==> Installing dependencies for ffmpeg: aom, dav1d, libpng, freetype, fontconfig, frei0r, gmp, gettext, libunistring, libidn2, libtasn1, nettle, libffi, p11-kit, unbound, gnutls, lame, fribidi, gdbm, readline, sqlite, xz, python@3.8, glib, lzo, pixman, cairo, graphite2, harfbuzz, libass, libbluray, libsoxr, libvidstab, libogg, libvorbis, libvpx, opencore-amr, jpeg, libtiff, little-cms2, openjpeg, opus, rtmpdump, flac, libsndfile, libsamplerate, rubberband, sdl2, snappy, speex, srt, giflib, webp, leptonica, tesseract, theora, x264, x265 and xvid
- 出现🍺,要装好了。
==> Installing ffmpeg dependency: xvid
==> Pouring xvid-1.3.7.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/xvid/1.3.7: 10 files, 1.2MB
==> Installing ffmpeg
==> Pouring ffmpeg-4.2.3_1.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/ffmpeg/4.2.3_1: 287 files, 56.7MB
检查是否安装成功
- 检查是否装好了!看到以下信息,表明装好了,妥了。
MacBook-Air:$ ffmpeg
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.59)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --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. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
MacBook-Air:~$
ffmpeg使用
- 切个视频试试。
MacBook-Air:$ ffmpeg -i input.mp4 -ss 01:19:27 -to 02:18:51 -c:v copy -c:a copy output.mp4
...
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 304 fps=0.0 q=-1.0 Lsize= 743kB time=00:00:10.99 bitrate= 553.9kbits/s speed= 709x
video:559kB audio:172kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.607268%
- 换个姿势试试
-t :指定视频时长
MacBook-Air:~$ ffmpeg -i input.mp4 -ss 00:01:10 -t 00:01:05 -c:v copy -c:a copy output.mp4
那可不是一般的快,在线版不停的转圈圈,command line愉悦极了。