Killing infinite ffmpeg on the command line from a

2019-06-09 08:14发布

I am using

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 ffmpeg
1条回答
走好不送
2楼-- · 2019-06-09 09:08

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

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.

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.

查看更多
登录 后发表回答