要处理视频,直接上 ffmpeg 吧

ffmpeg

在macOS上安装ffmpeg

笔记本是macOS,以下以macOS为例。其他OS,参考ffmpeg官网https://ffmpeg.org/download.html

  1. 打开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%
  1. 不停的下载啊!一看依赖库不少啊啊~~ 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
  1. 出现🍺,要装好了。
==> 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

检查是否安装成功

  1. 检查是否装好了!看到以下信息,表明装好了,妥了。
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使用

  1. 切个视频试试。
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%
  1. 换个姿势试试
    -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愉悦极了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JohannaCui

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值