我在 Centos6 服务器上使用 Ffmpeg 和 Libvpx 时遇到问题。
命令:
ffmpeg -y -i /var/www/f1ccd3a27d36270492ce660da358b436.mp4 -t 99 acodec copy -vcodec libvpx -f webm /var/www/f1ccd3a27d36270492ce660da358b436.webm 2<&1
输出:
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 1 codec frame rate differs from container frame rate: 59.94 (2997/50) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/vhosts/f1ccd3a27d36270492ce660da358b436.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isomavc1mp42
Duration: 00:04:16.32, start: 0.000000, bitrate: 650 kb/s
Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16, 108 kb/s
Stream #0.1(und): Video: h264, yuv420p, 480x360 [PAR 1:1 DAR 4:3], 539 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Unknown encoder 'libvpx'
FFmpeg 配置:
--prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
问题:
Unknown encoder 'libvpx'
最佳答案
ffmpeg
需要配置以下内容:
-
--enable-libvpx
适用于 VP8 和 VP9 视频编码 -
--enable-libopus
对于 Opus 音频编码,或 -
--enable-libvorbis
用于 Vorbis 音频编码
视频
- 要对 VP9 进行编码,请使用
-c:v libvpx-vp9
. - 要对 VP8 进行编码,请使用
-c:v libvpx
.
WebM 的默认值是 libvpx-vp9。
参见FFmpeg Wiki: VP9和 VP8了解更多信息。
音频
您只需要上述音频编码器之一:建议使用 Opus,而不是 Vorbis,但两者都可以。
- 要对 Opus 进行编码,请使用
-c:a libopus
. - 对于编码器 Vorbis,请使用
-c:a libvorbis
.
WebM 的默认值是 libopus。
获取ffmpeg
获取 ffmpeg
的最简单方法用这些编码器就是下载它。请参阅FFmpeg Download页面,已编译的 Linux、macOS 和 Windows 可执行文件的链接。或者,您可以关注compile guide .
关于ffmpeg - ffmpeg 和 libvpx 转换为 webm 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12754752/