使用 Homebrew 安装 ffmpeg 时出现问题

使用 Homebrew 安装 ffmpeg 时出现问题

当我尝试将 mp4 转换为 webm 时出现错误:

Encoder (codec vp8) not found for output stream #0:0

谷歌搜索告诉我,我需要安装 libvpx,但我已经安装了。

我已经使用 homebrew 进行了安装(带有 libvpx):

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265

所以我很困惑为什么会出现这个错误。以下是其余部分:

Logans-MacBook-Pro:desktop loganmccoy$ ffmpeg -i video.mp4 -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 myvideo.webm
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V mp42isom
    creation_time   : 2015-09-21 06:30:12
  Duration: 00:00:10.58, start: 0.000000, bitrate: 1264 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 1253 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2015-09-21 06:30:12
      handler_name    : Mainconcept MP4 Video Media Handler
      encoder         : AVC Coding
File 'myvideo.webm' already exists. Overwrite ? [y/N] y
Output #0, webm, to 'myvideo.webm':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V mp42isom
    Stream #0:0(eng): Video: vp8, none, q=2-31, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-09-21 06:30:12
      handler_name    : Mainconcept MP4 Video Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> ? (?))
Encoder (codec vp8) not found for output stream #0:0

任何帮助,将不胜感激。

答案1

我使用了完全相同的命令并能够获得输出,但使用 vp9:

 user-Mac-Pro:~ user$ /ffmpeg -i /Volumes/media/1080p-PRHQ.mov -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 /Volumes/media/080p-PRHQ_v.webm
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libssh --enable-libfdk-aac --enable-openssl --enable-libopus --enable-libx265 --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/media/1080p-PRHQ.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-03-13 21:20:09
  Duration: 00:12:14.17, start: 0.000000, bitrate: 146674 kb/s
    Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2015-03-13 21:20:09
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x800, 144356 kb/s, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      creation_time   : 2015-03-13 21:20:09
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 HQ
[libvpx-vp9 @ 0x7fee4780e400] v1.4.0
Output #0, webm, to '/Volumes/media/1080p-PRHQ_v.webm':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf56.40.101
    Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuv422p, 1920x800, q=-1-25, 200 kb/s, 24 fps, 1k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2015-03-13 21:20:09
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc56.60.100 libvpx-vp9
    Stream #0:1(eng): Audio: vorbis (libvorbis), 48000 Hz, stereo, fltp (24 bit) (default)
    Metadata:
      creation_time   : 2015-03-13 21:20:09
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc56.60.100 libvorbis
Stream mapping:
  Stream #0:1 -> #0:0 (prores (native) -> vp9 (libvpx-vp9))
  Stream #0:0 -> #0:1 (pcm_s24be (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
frame=   34 fps=2.7 q=0.0 Lsize=      35kB time=00:00:01.48 bitrate= 193.7kbits/s    
video:6kB audio:23kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 18.441772%
Exiting normally, received signal 2.
user-Mac-Pro:~ user$ 

也许您应该删除的当前版本ffmpeg及其所有依赖项/usr/local/Cellar/

您可以手动删除它们,然后使用 homebrew 再次安装它们。

然后,运行以下每个命令来帮助您清理 Cellar:

  1. brew options ffmpeg(找到您要安装的内容)
  2. brew install ffmpeg --with-x --with-y --with-zETC。
  3. brew update && brew upgrade(更新公式和 Homebrew 本身 ​​&& 安装过时软件包的较新版本)
  4. brew prune(从 Homebrew 的前缀中删除无效的符号链接)
  5. brew doctor(检查你的 Homebrew 安装是否存在常见问题)

上面引用的自制选项来自: http://pythonic.zoomquiet.io/data/20111223160257/index.html

然后再次尝试命令行。

我拥有与您完全相同版本的 Homebrew,因此我可以毫无问题地运行提供的命令。

答案2

值得注意的是,这里的一种方法创建了 VP9,而 OP 最初提到的是 VP8。如果感兴趣的话,在我的测试中,我发现一些基本标志可以启用 VP8 或 VP9

ffmpeg -i in.mov -c:v libvpx 1.webm #creates VP8
ffmpeg -i in.mov -c:v libvpx-vp9 2.webm #creates VP9

这是从安装的 ffmpeg 3.0.2 开始的brew install ffmpeg --with-libvpx

ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libvpx --enable-vda
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100

编解码器输出已通过 mediainfo 验证 ( brew install mediainfo)

mediainfo --fullscan 1.webm #shows VP8
mediainfo --fullscan 2.webm #shows VP9

相关内容