簡體   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