我尝试使用ffmpeg和PHP转换一些视频。
当我在PHP exec()
中执行以下命令时/usr/local/bin/ffmpeg -i /home/test/public_html/test.m4v -vcodec libx264 -acodec libmp3lame -r 30 -s 640x480 -b 100k /home/test/public_html/output_640x480_test.m4v
输出:
/usr/local/bin/ffmpeg: line 4: /var/log/ffmpeg.log: Permission denied
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Apr 18 2012 05:19:10 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
configuration: --prefix=/usr/local/src/ffmpeg --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-libdirac --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab --enable-libxvid --enable-libvorbis --enable-libtheora
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 1 codec frame rate differs from container frame rate: 1200.00 (1200/1) -> 10.00 (10/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/test/public_html/test.m4v':
Metadata:
major_brand : M4VP
minor_version : 1
compatible_brands: M4VPM4V M4A mp42isom
creation_time : 2013-03-14 10:08:25
encoder : Mac OS X v10.7.4 (CMA 891, CM 705.78, x86_64)
date : 2013-03-10T14:05:41+1100
Duration: 00:00:02.30, start: 0.000000, bitrate: 245 kb/s
Stream #0.0(und): Audio: aac, 32000 Hz, 2 channels (FC), s16, 31 kb/s
Metadata:
creation_time : 2013-03-14 10:08:25
Stream #0.1(und): Video: h264, yuv420p, 400x226 [PAR 1:1 DAR 200:113], 216 kb/s, 10.35 fps, 10 tbr, 600 tbn, 1200 tbc
Metadata:
creation_time : 2013-03-14 10:08:25
[buffer @ 0xf6093c0] w:400 h:226 pixfmt:yuv420p
[scale @ 0xf609790] w:400 h:226 fmt:yuv420p -> w:640 h:480 fmt:yuv420p flags:0xa0000004
[libx264 @ 0xf605cd0] broken ffmpeg default settings detected
[libx264 @ 0xf605cd0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xf605cd0] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xf605cd0] speed presets are listed in x264 --help
[libx264 @ 0xf605cd0] profile is optional; x264 defaults to high
Output #0, ipod, to '/home/test/public_html/output_640x480_test.m4v':
Stream #0.0(und): Video: libx264, yuv420p, 640x480 [PAR 150:113 DAR 200:113], q=2-31, 800 kb/s, 90k tbn, 10 tbc
Metadata:
creation_time : 2013-03-14 10:08:25
Stream #0.1(und): Audio: libmp3lame, 32000 Hz, 2 channels, s16, 64 kb/s
Metadata:
creation_time : 2013-03-14 10:08:25
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
同样的转换在另一台服务器上正常工作。但不是我们当前的服务器。我该怎么做才能摆脱这个错误?