简体   繁体   English

从脚本(php / c#/ etc。)执行但从命令行执行时,ffmpeg编码冻结

[英]ffmpeg encoding freezes when executed from a script (php/c#/etc.) but not from the command line

I have tried encoding with ffmpeg via a PHP script, but the process freezes at a certain point. 我曾尝试通过PHP脚本使用ffmpeg进行编码,但是该过程在某些时候死机了。 When the same command is run via the command line in Windows it encodes just fine. 当在Windows中通过命令行运行相同的命令时,它的编码就很好。

I have tried different videos, which aren't corrupted and don't use any exotic codecs or anything. 我尝试了不同的视频,这些视频没有损坏,也没有使用任何异国情调的编解码器或其他任何东西。

What could be the reason the process freezes when run from a script (ie exec() in PHP) but not when run directly from the command line? 从脚本(即PHP中的exec())运行而不是直接从命令行运行时,进程冻结的原因可能是什么? Any tips? 有小费吗?

I have had a similar Problem. 我有一个类似的问题。 For me, my webserver has had a maximum execution time. 对我来说,我的网络服务器拥有最大的执行时间。

For IIS (web.config): 对于IIS(web.config):

<system.web>
    <httpRuntime executionTimeout="180" />
</system.web>

For other Server google about 对于其他服务器Google

maximum execution time <webservername>

I'm thinking this has something to do with pipes. 我认为这与管道有关。 Ie, the FFmpeg output is redirecting into a pipe that is never being drained by another process so the FFmpeg/PHP process blocks. 即,FFmpeg输出重定向到永远不会被另一个进程耗尽的管道,因此FFmpeg / PHP进程将阻塞。

Some questions: 一些问题:

  • You're testing command lines via the Windows console; 您正在通过Windows控制台测试命令行。 is PHP also running in a Windows environment? PHP也可以在Windows环境中运行吗?
  • Is the PHP transcoding process showing any CPU usage at all? PHP转码过程是否显示任何CPU使用情况? Is it maxing out a CPU or not showing up at all? 是CPU满了还是根本没有出现?
  • What does the exec() call look like, exactly? exec()调用到底是什么样子?

暂无
暂无

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

相关问题 不能从命令行执行php脚本 - php script not executed from command line 通过命令行执行时,PHP脚本无法正常工作,但从浏览器执行时,PHP脚本可以正常工作 - PHP script wont work when executed via command line but work fine when executed from browser FFmpeg(视频缩略图)在命令行中运行,但在PHP脚本中不起作用 - FFmpeg (Thumbnail from video) works in command line, but not in PHP script 通过浏览器执行时,用于发送邮件的php脚本无法正常工作,但从命令行执行时,可以正常工作 - php script for sending mail wont work when executed via browser but work fine when executed from command line virtctl 在通过命令行执行而不是从 php exec() 执行时有效 - virtctl works when executed via command line but not from php exec() 从PHP的命令行调用未执行 - Command Line call from PHP not executed PHP ImageMagick 脚本在通过命令行执行时不起作用 - PHP ImageMagick script not working when executed via command line 帮助编码 cURL 参数(从命令行可以正常工作,但不能从 PHP 脚本) - Help encoding a cURL argument (works fine from the command line, but not from a PHP script) 从php页面执行时,ffmpeg不会保存文件 - ffmpeg won't save the file when executed from a php page 当从命令行执行脚本时,即使使用ob_start(),输出也会打印到终端 - Output printed to terminal even with ob_start() on when script is executed from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM