在terminal
中运行:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
我选择的清华大学的源。
brew install ffmpeg
报错:
fatal: not in a git directory
Error: Command failed with exit 128: git
原因请看brew -v
,不安全的repository。
% brew -v
Homebrew 3.5.10-129-g79c6ab2
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
调用提示中的git config --global --add safe.directory homebrew-core目录
和git config --global --add safe.directory homebrew-cask目录
即可。
再次运行brew install ffmpeg
,安装成功。
% ffmpeg
ffmpeg version 5.1.1 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
ffmpg把m3u8转码为mp4:
ffmpeg -i "https://xx.ts.m3u8?ver=4" out.mp4