如何发送ctrlc停止ffmpeg

2024-10-06 09:49:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我写了一个小函数:

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选项:)


Tags: 函数testselfosdefsystemffmpegcommand