![VP8 和 WebM 在 ffmpeg-php 中不起作用](https://linux22.com/image/1332389/VP8%20%E5%92%8C%20WebM%20%E5%9C%A8%20ffmpeg-php%20%E4%B8%AD%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我需要 ffmpeg-php 和 Ffmpeg 的帮助。
ffmpeg:
ffmpeg version 1.0.git
built on Oct 6 2012 01:54:50 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 51. 73.102 / 51. 73.102
libavcodec 54. 63.100 / 54. 63.100
libavformat 54. 29.105 / 54. 29.105
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Ffmpeg-PHP
FFmpeg 0.6.5
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
FFMPEG-PHP 命令:
ffmpeg -y -i /f1ccd3a27d36270492ce660da358b436.mp4 -t 99 -f webm /f1ccd3a27d36270492ce660da358b436.webm
FFMPEG(SSH)命令:
ffmpeg -y -i /f1ccd3a27d36270492ce660da358b436.mp4 -t 99 -f webm /f1ccd3a27d36270492ce660da358b436.webm
FFMPEG-PHP 输出:
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 '/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
Output #0, webm, to '/f1ccd3a27d36270492ce660da358b436.webm':
Stream #0.0(und): Video: 0x0000, yuv420p, 480x360 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(und): Audio: 0x0000, 44100 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Encoder (codec id 146) not found for output stream #0.0
FFMPEG(SSH)输出:
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 6 2012 01:54:50 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 51. 73.102 / 51. 73.102
libavcodec 54. 63.100 / 54. 63.100
libavformat 54. 29.105 / 54. 29.105
libavdevice 54. 3.100 / 54. 3.100
libavfilter 3. 19.102 / 3. 19.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 16.100 / 0. 16.100
libpostproc 52. 1.100 / 52. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/f1ccd3a27d36270492ce660da358b436.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isomavc1mp42
creation_time : 2009-12-23 02:00:55
Duration: 00:04:16.32, start: 0.000000, bitrate: 650 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 108 kb/s
Metadata:
creation_time : 2009-12-23 02:00:55
handler_name : (C) 2007 Google Inc. v08.13.2007.
Stream #0:1(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x360 [SAR 1:1 DAR 4:3], 539 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
creation_time : 2009-12-23 02:00:55
handler_name : (C) 2007 Google Inc. v08.13.2007.
[libvpx @ 0x2166e00] v1.1.0
Output #0, webm, to '/f1ccd3a27d36270492ce660da358b436.webm':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isomavc1mp42
encoder : Lavf54.29.105
Stream #0:0(und): Video: vp8, yuv420p, 480x360 [SAR 1:1 DAR 4:3], q=-1--1, 200 kb/s, 1k tbn, 29.97 tbc
Metadata:
creation_time : 2009-12-23 02:00:55
handler_name : (C) 2007 Google Inc. v08.13.2007.
Stream #0:1(und): Audio: vorbis, 44100 Hz, stereo, flt
Metadata:
creation_time : 2009-12-23 02:00:55
handler_name : (C) 2007 Google Inc. v08.13.2007.
Stream mapping:
Stream #0:1 -> #0:0 (h264 -> libvpx)
Stream #0:0 -> #0:1 (aac -> libvorbis)
Press [q] to stop, [?] for help
[libvorbis @ 0x2167340] Que input is backward in time
frame= 2968 fps= 61 q=0.0 Lsize= 4464kB time=00:01:39.03 bitrate= 369.3kbits/s
video:3068kB audio:1319kB subtitle:0 global headers:4kB muxing overhead 1.662821%
错误:
Encoder (codec id 146) not found for output stream #0.0
答案1
为了编码为 WebM,您需要编译libvpx
支持该功能的 FFmpeg。您的 FFmpeg 1.0 具有此功能,您可以在编译标志中看到--enable-libvpx
。
FFmpeg 从 0.6 开始,支持WebM:
此版本包含许多与 HTML5 视频相关的改进。[…] 此版本支持 Google 新发布的用于 VP8 编解码器和 WEBM 容器的 libvpx 库。
由于您运行的是 0.6.5,因此您可以使用 重新编译现有的旧版本libvpx
,或者更好的是,升级到不超过两年且在此期间可能已修复数百个错误的较新版本。请注意,命令行语法多年来也发生了相当大的变化。