使用ffmpeg、PHP和beanstalk

使用ffmpeg、PHP和beanstalk,php,ffmpeg,beanstalkd,Php,Ffmpeg,Beanstalkd,我对ffmpeg和beanstalk非常陌生,我需要一些帮助。我想使用beanstalk将要转换的ffmpeg文件排队。我下载、安装并启动了beanstalkd(也安装了libevent,正如它所建议的那样),还下载了一个用于beanstalkd的PHP客户端 现在,在下载客户端并将其放在我的服务器上之后,我什么也没做,只是使用客户端的示例,我得到了这个错误 致命错误:第1138行的/Users/wasimkhamlichi/Sites/vibenation/beanstalk/src/bea

我对ffmpeg和beanstalk非常陌生,我需要一些帮助。我想使用beanstalk将要转换的ffmpeg文件排队。我下载、安装并启动了beanstalkd(也安装了libevent,正如它所建议的那样),还下载了一个用于beanstalkd的PHP客户端

现在,在下载客户端并将其放在我的服务器上之后,我什么也没做,只是使用客户端的示例,我得到了这个错误

致命错误:第1138行的/Users/wasimkhamlichi/Sites/vibenation/beanstalk/src/beanstalk.class.php中超过了30秒的最大执行时间

这是示例中的代码

$beanstalk = BeanStalk::open(array(
    'servers'       => array( '127.0.0.1:11300' ),
    'select'        => 'random peek'
));

// As in the protocol doc.
$beanstalk->use_tube('foo');

// As in the protocol doc.
$beanstalk->put(0, 0, 120, 'say hello world');      // Add a job to the queue with highest priority, 
                                                    // no delay, 120 seconds TTR, with the contents
                                                    // 'say hello world'.

                                                    // NOTE: the put() method here supports a final optional 
                                                    // argument, a tube name. If supplied, the server will
                                                    // first switch to that tube, write the job, then switch
                                                    // back to the old tube again.

// As in the protocol doc.
$job = $beanstalk->reserve();                       // Assuming there was nothing in the queue before 
                                                    // we started, this will give us our 'hello world'
                                                    // job back.

// This is a BeanQueueJob object.
echo $job->get();                                   // Output: 'say hello world'

Beanstalk::delete($job);                            // Delete the job.

非常简单的快速脚本,只是为了说你好,但它的时间。有人能帮忙吗?

豆茎只是传递信息。你在一个地方把东西放进队列,然后在其他地方取出

您可以将文件名放入名为“ffmpeg转换”的管道中。从命令行运行的PHP脚本保留队列中的下一项,并执行它所需的操作,将完成的文件放在适当的位置

如果您需要更多信息(例如,将完成的文件、质量设置或新的输出文件名放在何处),可以对信息进行编码-将信息数组转换为Json字符串(使用
Json\u encode($array)
)是一个不错的选择。将编码的字符串放入Beanstalk中,cli脚本对该字符串进行解码,然后执行工作


以基于命令行的脚本运行worker通常可以避免任何超时问题。与网页请求不同的是,没有默认超时,内存使用也有更大的自由。

您使用的是哪个客户端库?您好,这是由iceyliquid开发的php beanstalkd客户端-请在此处找到它-您能确保作业真的被放入队列吗?Use可以使用
设置时间限制(0)
来防止脚本超时。确保beanstalkd确实在该端口上运行。作业肯定在队列中,服务器肯定在该端口上。我更改了set_limit_limit(0),但是页面永远挂起。我telnet到localhost 11300并输入stats,结果是------OK 813------当前作业紧急:1当前作业准备就绪:1当前作业保留:0当前作业延迟:0当前作业掩埋:0------有什么想法吗?好的,现在我使用的是pheanstalk beanstalkd php库,它似乎可以正常加载。我真的不知道它是怎么工作的。我想从命令行处理ffmpeg,但当我传递beanstalkd命令时,实际上什么都没发生,ffmpeg什么都没处理。当我使用$pheanstalk->put(“message”);-我实际上可以传递什么作为消息?非常感谢阿利斯特。那么,在数据库中的队列上使用beanstalk有什么好处呢?一个好处是您必须不断轮询数据库,beanstalk客户端可以在数据库中连接,然后它将等待,直到收到消息为止。我在一次精彩绝伦的演讲中所做的演讲还有其他的优势(和杀手级的特色)。谢谢你的帮助!