我循环运行以下PHP代码,以便从10秒内从视频列表(avi和mp4)中提取帧:
$command = "$ffmpegpath -y -i $input -vframes 1 -ss 00:00:$fromdurasec -y $output";
似乎它会为avi文件生成帧,但不会为mp4生成帧。
当我在命令行中手动运行命令时,它可以按预期方式工作(就像在获取框架并将其保存在文件夹中一样)。请在下面找到ffmpeg进程的完整日志:
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libvorbis --
enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libopencore-amrnb --enable-gray --enable-libopenjpeg --enable-gnutls --enable-libfaac --enable-nonfree --disable-indev=sndio --disable-outdev=sndio --cc=gcc
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
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'new test video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.93.0
Duration: 00:22:19.33, start: 0.000000, bitrate: 3560 kb/s
Stream #0:0(rus): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 3427 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(rus): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
[swscaler @ 0x20b0140] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'newtest.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Stream #0:0(rus): Video: mjpeg, yuvj420p(pc), 1280x720, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
encoder : Lavc57.24.102 mjpeg
Side data:
unknown side data type 10 (24 bytes)
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x
Enter command: <target>|all <time>|-1 <command>[ <argument>]