繁体   English   中英

PHP 上的 FFMPEG 无法打开文件

[英]FFMPEG on PHP could not open file

目前,我正在 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 个月后发现这有帮助,没有其他回复:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM