在应用程序的命令行上杀死无限ffmpeg [英] Killing infinite ffmpeg on the command line from an application

查看:970
本文介绍了在应用程序的命令行上杀死无限ffmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用

ffmpeg.exe -f dshow -i audio=virtual-audio-capturer -q 4 -y -tune zerolatency outfile.mp3

从扬声器刻录声音。此命令无限运行。我必须使用

to grap sound from speakers. This command runs infinitely. I have to use

Process->kill();

命令在我的应用程序中停止执行此命令。

command to stop execution of this command in my application.

我想知道是否可以以杀死我的方式杀死它,还是有更好的方法?

I want to know if it is safe to kill it the way I am killing, or is there any better way?

推荐答案

作为 Qt文档状态,使用函数kill将立即终止进程。

As the Qt documentation states, using the function kill will terminate the process immediately.

所以,根据你认为是安全的方式,这可能是也可能不适合你。如果ffmpeg在处理数据的中间,或者保存到文件中,调用这个将会阻止它完成任务。

So, depending on what you count as 'safe' this may or may not be ok for you. If ffmpeg is in the middle of processing data, or saving to file, calling this will stop it from finishing its task.

你可以礼貌地要求进程停止, 发送信号,如kill(pid,SIGABRT),if你正在使用Linux或OSX。 Windows可能会有一个等效方法

You could ask the process politely to stop, by sending it a signal such as kill(pid, SIGABRT), if you're using Linux or OSX. Windows will likely have an equivalent method.

这篇关于在应用程序的命令行上杀死无限ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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