升级 php 版本后 DL() 函数不再起作用。
我已经尝试在 php.ini 中使用 extension=extension.so ,它工作正常,但下面的命令
ffmpeg -y -i input.m4v -vcodec libx264 -vpre ipod640 -bt 50k -acodec libfaac -ac 2 -ar 48000 -ab 64k -s 480x320 output.mp4
给出错误
未知编码器‘libx264’
以下是完整描述
root@server [~]# ffmpeg -y -i input.m4v -vcodec libx264 -vpre ipod640 -bt 50k -acodec libfaac -ac 2 -ar 48000 -ab 64k -s 480x320 output.mp4
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 30 2012 00:00:18 with gcc 3.4.6 20060404 (Red Hat 3.4.6-11)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --disable-indev=v4l2 --extra-cflags='-O2 -g -pipe -m64 -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libschroedinger --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --enable-x11grab
WARNING: library configuration mismatch
libavutil configuration: --enable-shared --enable-libmp3lame --disable-yasm
libavcodec configuration: --enable-shared --enable-libmp3lame --disable-yasm
libavformat configuration: --enable-shared --enable-libmp3lame --disable-yasm
libavdevice configuration: --enable-shared --enable-libmp3lame --disable-yasm
libavfilter configuration: --enable-shared --enable-libmp3lame --disable-yasm
libswscale configuration: --enable-shared --enable-libmp3lame --disable-yasm
libavutil 50.15. 1 / 50.36. 0
libavcodec 52.72. 2 / 52.108. 0
libavformat 52.64. 2 / 52.93. 0
libavdevice 52. 2. 0 / 52. 2. 3
libavfilter 1.19. 0 / 1.74. 0
libswscale 0.11. 0 / 0.12. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 1 codec frame rate differs from container frame rate: 60000.00 (60000/1) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/machine/public_html/sterlingadmin/files/video_1402351414.m4v':
Metadata:
major_brand : M4V
minor_version : 1
compatible_brands: M4V M4A mp42isom
creation_time : 2014-05-16 22:20:14
title : a3343_Spanish
Duration: 00:07:11.59, start: 0.000000, bitrate: 4488 kb/s
Stream #0.0(und): Audio: aac, 48000 Hz, stereo, s16, 114 kb/s
Metadata:
creation_time : 2014-05-16 22:20:14
Stream #0.1(und): Video: h264, yuv420p, 960x540 [PAR 1:1 DAR 16:9], 4369 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc
Metadata:
creation_time : 2014-05-16 22:20:14
Unknown encoder 'libx264'
答案1
有ffmpeg 的静态构建托管于此处甚至可以在旧系统(内核 2.6.32 及以上)上运行。您可以下载它,并将ffmpeg
二进制文件放在文件系统的某个位置,例如/usr/local/bin
。
然后,从 PHP 调用/usr/local/bin/ffmpeg
ffmpeg 而不是系统。好处是,您现在可以运行最新版本,错误更少,功能更多。
但是您需要更新命令行,因为该-vpre
选项不再存在。
/usr/local/bin/ffmpeg -y -i input.m4v -c:v libx264 -s:v 480x320 -profile:v baseline -c:a aac -strict experimental -ac 2 -ar 48000 -b:a 64k output.mp4
由于您似乎针对的是处理能力较低的设备,请使用baseline
配置文件。