gpt4 book ai didi

php - 运行ffmpeg时隐藏系统消息

转载 作者:行者123 更新时间:2023-12-04 22:48:43 25 4
gpt4 key购买 nike

我正在使用下面的代码从视频文件中抓取图像,效果很好。
但是当我运行包含以下代码的 php 文件时,所有系统进程都会出现,我的意思是有关转换、导出等的一些信息。

我怎样才能让它静音运行?

$stderr = system("ffmpeg -i $videoPath -vframes 1 -an -s 306x173 -ss 03 $finalfilename 2>&1 >/dev/null", $exit_status);

if ($exit_status === 0) {
print 'Done! :)';
} else {
print 'Error... :/';
// $stderr will help you figure out what happened...
}

最佳答案

您应该更改重定向的顺序。像这样:

>/dev/null 2>&1 

或者将所有内容直接指向/dev/null:
>/dev/null 2>/dev/null

关于php - 运行ffmpeg时隐藏系统消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19962728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com