在应用程序的命令行上杀死无限ffmpeg [英] Killing infinite ffmpeg on the command line from an application
问题描述
我正在使用
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屋!