目前,我正在 MacOS Catalina 上运行最新的 FFMPEG (4.2.1)。
我正在尝试使用 PHP exec() 执行的 FFMPEG 加入多个图像以成为 mp4 视频
这是我的ffmpeg代码
"/usr/local/bin/ffmpeg -filter_complex \"[0]reverse[r];[0][r]concat, loop=1:50, setpts=N/12/TB\" -r 25 -f image2 -i /Users/Dan/Desktop/RAW/0234_%02d.jpg -preset fast -crf 23 -profile:v baseline -movflags +faststart -pix_fmt yuv420p /Applications/XAMPP/htdocs/render/result/result.mp4 2>&1"
这是FFMPEG的输出
Array (
[0] => ffmpeg version 4.2.1-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
[1] => built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
[2] => configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
[3] => libavutil 56. 31.100 / 56. 31.100
[4] => libavcodec 58. 54.100 / 58. 54.100
[5] => libavformat 58. 29.100 / 58. 29.100
[6] => libavdevice 58. 8.100 / 58. 8.100
[7] => libavfilter 7. 57.100 / 7. 57.100
[8] => libswscale 5. 5.100 / 5. 5.100
[9] => libswresample 3. 5.100 / 3. 5.100
[10] => libpostproc 55. 5.100 / 55. 5.100
[11] => [image2 @ 0x7fe4b1000400] Could not open file : /Users/Dan/Desktop/RAW/0234_01.jpg
[12] => [image2 @ 0x7fe4b1000400] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)):
unspecified size
[13] => Consider increasing the value for the 'analyzeduration' and 'probesize' options
[14] => Input #0, image2, from '/Users/Dan/Desktop/RAW/0234_%02d.jpg':
[15] => Duration: 00:00:00.20, start: 0.000000, bitrate: N/A
[16] => Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 25 tbr, 25 tbn, 25 tbc
[17] => Stream mapping:
[18] => Stream #0:0 (mjpeg) -> reverse
[19] => Stream #0:0 (mjpeg) -> concat:in0:v0
[20] => setpts -> Stream #0:0 (libx264)
[21] => Press [q] to stop, [?] for help
[22] => [image2 @ 0x7fe4b1000400] Could not open file : /Users/Dan/Desktop/RAW/0234_01.jpg
[23] => /Users/Dan/Desktop/RAW/0234_%02d.jpg: Input/output error
[24] => Cannot determine format of input stream 0:0 after EOF
[25] => Error marking filters as finished
[26] => Conversion failed!
)
在第 11 行,ffmpeg 无法打开文件,虽然文件权限已经为所有人读写。
我错过了 ffmpeg 代码吗?
注意:上面的ffmpeg代码可以在终端成功运行
最佳答案
我遇到了与 Could not open file : [filename]
相同的问题.用户拥有是目录的所有者,一切都应该工作。我的解决方案是创建一个空文件,然后确保使用 -y
标记以对任何提示说是(即 ffmpeg -y [rest of command]
)。
它似乎仍然与权限相关。可能与 PHP 的 exec()
的方式有关。作品。但这绝对是我的解决方案。希望有人在 1 年零 7 个月没有其他回复的情况下发现这很有帮助:-)
关于php - PHP上的FFMPEG无法打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59392095/