Python 如何发送ctrl-c停止ffmpeg
我编写了一个小函数,如下所示:Python 如何发送ctrl-c停止ffmpeg,python,ffmpeg,Python,Ffmpeg,我编写了一个小函数,如下所示: def test(): command = "ffmpeg -f mpegts -i udp://224.6.207.111:1234?multicast=1 -acodec copy -vcodec copy -sameq ff-output.ts" os.system(command) self.myTimer = Timer(10, "myTimer") self.myTimer.start() os.system(s
def test():
command = "ffmpeg -f mpegts -i udp://224.6.207.111:1234?multicast=1 -acodec copy -vcodec copy -sameq ff-output.ts"
os.system(command)
self.myTimer = Timer(10, "myTimer")
self.myTimer.start()
os.system(signal.SIGINT)
self.myTimer.stop()
当我在终端上用python运行test()
时,ffmpeg总是不关闭地继续。
有人知道如何阻止它吗
谢谢大家的评论;D
我发现我们可以对ffmpeg使用-t选项:)
os.system(command)
等待命令完成,而os.system(signal.SIGINT)
不是发送信号的方式。发送信号。这个线程应该为您保存答案。