在exec ffmpeg之后PHP代码没有进入该行

时间:2014-04-04 00:06:37

标签: php curl ffmpeg exec

我有这个我通过curl调用的PHP片段,以便执行ffmpeg编码。之后我还有另一行使用数据库将此标记为已完成。我希望在exec完成后触发此操作,这意味着该文件已完成编码。但是,数据库永远不会被实际更改(如果我尝试注释掉exec,则可以正常工作),并且我无法很好地判断文件何时完成编码。只有在您运行另一个请求时,数据库才会更改。代码如下。

$ID=$_POST['ID'];

exec("/usr/local/bin/ffmpeg -i stockvideos/Intro2.m2v -f image2 -loop 1 -r 24 -i temppics/Intro2pic".$ID.".png -filter_complex \
'[1:v]fade=in:st=0:d=1:alpha=1,fade=out:st=3:d=1:alpha=1[2wm];
[0:v][wm]overlay=10:10[outv]' \
-map [outv] -q 0 tempvideos/Intro2-".$ID.".m2v  >> 1.log 2>&1");

$query_CreditVideoDone  =sprintf("Update Messages SET CreditTitlesDone=%s WHERE ID=%s", GetSQLValueString(1, "boolean"),GetSQLValueString($ID, "text"));

$result = mysql_query($query_CreditVideoDone, $MMixer) or die(mysql_error());

更新:当我检查日志(> 2)时,即使在完成该过程后,FFMPEG仍会继续运行。

frame = 4 fps = 0.0 q = 0.0 size = 103kB time = 00:00:00.06 bitrate = 12619.2kbits / s
frame = 12 fps = 12 q = 0.0 size = 562kB time = 00:00:00.33 bitrate = 13806.6kbits / s
frame = 21 fps = 14 q = 0.0 size = 1339kB time = 00:00:00.63 bitrate = 17307.1kbits / s
frame = 29 fps = 14 q = 0.0 size = 1682kB time = 00:00:00.90 bitrate = 15291.9kbits / s
frame = 38 fps = 15 q = 0.0 size = 2081kB time = 00:00:01.20 bitrate = 14192.5kbits / s
frame = 51 fps = 16 q = 0.0 size = 2677kB time = 00:00:01.63 bitrate = 13415.4kbits / s
frame = 58 fps = 16 q = 0.0 size = 2939kB time = 00:00:01.86 bitrate = 12884.0kbits / s
frame = 66 fps = 16 q = 0.0 size = 3338kB time = 00:00:02.13 bitrate = 12803.8kbits / s
frame = 74 fps = 16 q = 0.0 size = 3724kB time = 00:00:02.40 bitrate = 12700.2kbits / s
frame = 82 fps = 16 q = 0.0 size = 4012kB time = 00:00:02.66 bitrate = 12311.5kbits / s
frame = 92 fps = 16 q = 0.0 size = 4483kB time = 00:00:03.00 bitrate = 12229.7kbits / s
frame = 102 fps = 16 q = 0.0 size = 4951kB time = 00:00:03.33 bitrate = 12154.5kbits / s
frame = 111 fps = 16 q = 0.0 size = 5384kB time = 00:00:03.63 bitrate = 12126.7kbits / s
frame = 118 fps = 16 q = 0.0 size = 5622kB time = 00:00:03.87 bitrate = 11900.0kbits / s
frame = 127 fps = 16 q = 0.0 size = 6042kB time = 00:00:04.17 bitrate = 11867.2kbits / s
frame = 138 fps = 16 q = 0.0 size = 6550kB time = 00:00:04.53 bitrate = 11823.8kbits / s
frame = 149 fps = 17 q = 0.0 size = 7043kB time = 00:00:04.90 bitrate = 11763.8kbits / s
frame = 157 fps = 17 q = 0.0 size = 7338kB time = 00:00:05.17 bitrate = 11622.8kbits / s
frame = 167 fps = 17 q = 0.0 size = 7807kB time = 00:00:05.50 bitrate = 11616.5kbits / s
frame = 176 fps = 17 q = 0.0 size = 8215kB time = 00:00:05.80 bitrate = 11591.7kbits / s
frame = 186 fps = 17 q = 0.0 size = 8667kB time = 00:00:06.13 bitrate = 11564.4kbits / s
frame = 196 fps = 17 q = 0.0 size = 9254kB time = 00:00:06.47 bitrate = 11710.7kbits / s
frame = 203 fps = 17 q = 0.0 size = 9794kB time = 00:00:06.70 bitrate = 11962.6kbits / s
frame = 211 fps = 17 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 3
frame = 211 fps = 16 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 13
frame = 211 fps = 15 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 28
frame = 211 fps = 15 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 41
frame = 211 fps = 14 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 57
frame = 211 fps = 14 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 73
frame = 211 fps = 13 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 89
frame = 211 fps = 13 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 98
frame = 211 fps = 13 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 107
frame = 211 fps = 12 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 115
frame = 211 fps = 12 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 126
frame = 211 fps = 11 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 138
frame = 211 fps = 11 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 153
frame = 211 fps = 11 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 169
frame = 211 fps = 11 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 183
frame = 211 fps = 10 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 194
frame = 211 fps = 10 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 203
frame = 211 fps = 9.8 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 214
frame = 211 fps = 9.6 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 224
frame = 211 fps = 9.4 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 233
frame = 211 fps = 9.1 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 242
frame = 211 fps = 8.9 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 251
frame = 211 fps = 8.7 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 260
frame = 211 fps = 8.6 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 269
frame = 211 fps = 8.4 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 278
frame = 211 fps = 8.2 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 289
frame = 211 fps = 8.0 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 303
frame = 211 fps = 7.9 q = 0.0 size = 10135kB time = 00:00:06.97 bitrate = 11905.1kbits / s dup = 0 drop = 315 ....

依此类推,直到它在服务器上超时。知道为什么会这样吗?它似乎阻止了之后的任何事情的执行。重定向到dev / null也没有任何帮助 - 当然没有错误输出但是过程仍然以相同的方式挂起。

任何帮助将不胜感激。谢谢!

谢谢!

SEL

0 个答案:

没有答案