ffmpeg 常用命令学习及安装教程

FFmpeg 常用命令

音频格式转换

m4a转wav

ffmpeg -i input.m4a -acodec pcm_s16le -ac 2 -ar 44100 output.wav

wav转m4a

128k 可修改为 64k 32k

ffmpeg -i output.wav -c:a libfdk_aac -b:a 128k result.m4a

设置码率,参考wiki:Encode/AAC

m4a转mp3

ffmpeg -i input.m4a -b:a 192K -vn testing.mp3

mp3转m4a

ffmpeg -i testing.mp3 -c:a libfdk_aac -vbr 5 test_from_mp3.m4a

wav转mp3

ffmpeg -i input.wav -f mp3 -acodec libmp3lame -y output.mp3

m4a与flac互转

ffmpeg -i 长录音-2.m4a -c:a flac 长录音-2.flac
ffmpeg -i 长录音-2.flac -acodec alac 长录音-2-ffmpeg.m4a

参考网址

视频处理工具 FFmpeg 常用实例详解

分析音频

ffmpeg/ffprobe查看音频视频文件信息并输出为json格式

帮助信息

ffprobe --help

查看封装格式

ffprobe -show_format error.m4a > error.format.txt
ffprobe -show_format success.m4a > success.format.txt

查看包中的具体数据

ffprobe -show_data -show_packets error.m4a > error.packets.txt
ffprobe -show_data -show_packets success.m4a > success.packets.txt

参考

Mac OS上使用ffmpeg的“血泪”总结 音视频封装格式、编码格式

完美安装方案 20200514

安装 Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 ffmpeg

brew install ffmpeg

选择第三方仓库,以便安装 options

可用的第三方仓库有: homebrew-ffmpeg和varenc-homebrew-ffmpeg 

如下:选择第三方仓库
github-homebrew-ffmpeg
github-varenc/ffmpeg

# tap 安装
# brew tap homebrew-ffmpeg/ffmpeg
# tap 移除
# brew untap homebrew-ffmpeg/ffmpeg
#brew tap varenc/ffmpeg
#brew untap varenc/ffmpeg

特别注意:

Note: If you already have ffmpeg installed from Homebrew core, you will receive an error. You need to first run brew uninstall ffmpeg before you can use this tap.

看此仓库支持哪些options

#brew options homebrew-ffmpeg/ffmpeg/ffmpeg
brew options varenc/ffmpeg/ffmpeg
ybf326@B-J2L6LVDL-1753 TODO-Send % brew options varenc/ffmpeg/ffmpeg
--with-chromaprint
    Enable the Chromaprint audio fingerprinting library
--with-decklink
    Enable DeckLink support
--with-fdk-aac
    Enable the Fraunhofer FDK AAC library
--with-game-music-emu
    Build with game-music-emu support
--with-libbluray
    Build with libbluray support
--with-libbs2b
    Build with libbs2b support
--with-libcaca
    Build with libcaca support
--with-libgsm
    Build with libgsm support
--with-libmodplug
    Build with libmodplug support
--with-librsvg
    Enable SVG files as inputs via librsvg
--with-libsoxr
    Enable the soxr resample library
--with-libssh
    Enable SFTP protocol via libssh
--with-libvidstab
    Enable vid.stab support for video stabilization
--with-libvmaf
    Enable libvmaf scoring library
--with-libxml2
    Enable libxml2 library
    Enable Opencore AMR NR/WB audio format
--with-openh264
    Enable OpenH264 library
--with-openjpeg
    Enable JPEG 2000 image format
--with-openssl
    Enable SSL support
--with-rtmpdump
    Build with rtmpdump support
--with-rubberband
    Enable rubberband library
--with-speex
    Build with speex support
--with-srt
    Enable SRT library
--with-tesseract
    Enable the tesseract OCR engine
--with-two-lame
    Build with two-lame support
--with-wavpack
    Build with wavpack support
--with-webp
    Enable using libwebp to encode WEBP images
--with-xvid
    Build with xvid support
--with-zeromq
    Enable using libzeromq to receive cmds sent through a libzeromq client
--with-zimg
    Enable z.lib zimg library
--HEAD
    Install HEAD version

安装 xquartz

安装命令

brew cask install xquartz

异常

==> Installing ffmpeg from homebrew-ffmpeg/ffmpeg
imlib2: XQuartz 2.7.11 (or newer) is required to install this formula. X11Requirement unsatisfied!
You can install with Homebrew Cask:
  brew cask install xquartz
You can download from:
  https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.

安装 ffmpeg options

#brew install varenc/ffmpeg/ffmpeg --with-chromaprint --with-decklink --with-fdk-aac --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvmaf --with-libxml2 --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rtmpdump --with-rubberband --with-speex --with-srt --with-tesseract --with-two-lame --with-wavpack --with-webp --with-xvid --with-zeromq --with-zimg

#brew install homebrew-ffmpeg/ffmpeg/ffmpeg --HEAD --with-chromaprint --with-decklink --with-fdk-aac --with-game-music-emu --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-librsvg --with-libsoxr --with-libssh --with-libvidstab --with-libvmaf --with-libxml2 --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-openssl@1.1 --with-rtmpdump --with-rubberband --with-speex --with-srt --with-tesseract --with-two-lame --with-wavpack --with-webp --with-xvid --with-zeromq --with-zimg

# brew uninstall homebrew-ffmpeg/ffmpeg/ffmpeg
#重新安装
# brew reinstall homebrew-ffmpeg/ffmpeg/ffmpeg --with-webp --with-fdk-aac --with-openjpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-webp --with-fdk-aac --with-openjpeg

新版会有问题的方案

brew install ffmpeg --with-chromaprint --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-schroedinger --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-zimg

链接:https://www.jianshu.com/p/85fffceddf04
brew install ffmpeg --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libgsm --with-libmodplug --with-libsoxr --with-libssh --with-libvidstab --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-rubberband --with-schroedinger --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-zimg


brew install ffmpeg --debug --with-chromaprint --with-fdk-aac --with-fontconfig --with-freetype --with-frei0r --with-game-music-emu --with-libass --with-libbluray --with-libbs2b --with-libcaca --with-libebur128 --with-libgsm --with-libmodplug --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-schroedinger --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-zimg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值