ffmpeg后台进程完成后,如何通过管道传递新命令? [英] How to pipe a new command after ffmpeg background process completes?

查看:215
本文介绍了ffmpeg后台进程完成后,如何通过管道传递新命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的ffmpeg流程:

exec("/usr/local/bin/ffmpeg -y -i source.avi dest.mp4 >/dev/null 2>/dev/null &

现在,我希望在转换完成后执行一个PHP文件.从逻辑上讲,这就是我所拥有的:

Now, I wish to execute a PHP file after the conversion is complete. Logically, this is what I have:

exec("/usr/local/bin/ffmpeg -y -i source.avi dest.mp4 >/dev/null 2>/dev/null ; php proceed.php &

这是行不通的,因为那样PHP将阻止该过程,直到ffmpeg转换完成.我想要的基本上是在转换完成后调用proc.php,这两个操作都是在后台完成的.

This doesn't work though, since then PHP will hold up the process to wait till the ffmpeg conversion is complete. What I want is basically to call proceed.php after the conversion completes, both of which are done in the background.

如果任何人都可以提供Windows服务器解决方案,那也将很棒.

If anyone can provide the Windows server solution, that will be awesome too.

推荐答案

编写一个同时执行ffmpeg和php进程的外部(bash/php)脚本,然后在该脚本上附加&.

Write an external (bash/php) script that executes both the ffmpeg and php process, and tack & after that.

对于Windows,请在SO上打开一个新问题.

For windows, please open a new question on SO.

这篇关于ffmpeg后台进程完成后,如何通过管道传递新命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆