python - Using ffmpeg to capture video, the process cannot be ended using terminate
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-14 10:51:23
0
1
961

I want to use ffmpeg to capture videos and the timing will end automatically. I am a novice and the command is not complicated. I just use subprocess.Popen to start the ffmpeng command to capture the video and save it as mp4. I have tested it under cmd. The command There is no problem, and the test can also be recorded using python. The problem is that it cannot be ended. . I used subprocess.kill to end the process, but it only ended cmd. ffmpeg started by cmd still continued to work. I don't know how to end the process it generated. . .

cmd = '''ffmpeg1.exe -i "rtmp://123.123.123.132/live/tv22 live=1" -acodec libmp3lame -vcodec libx264 -y  3.mkv'''

cc=subprocess.Popen(cmd2,shell=True)


print(cc.pid)
time.sleep(15)
cc.terminate()

You can’t end it with terminat or kill. You can only end the cmd process. The generated ffmpeg1.exe process cannot be stopped.
If there is a termination method that imitates ctrl c, please help.
I later tested ping 127.0.0.1 and found that cmd could be terminated but ping.exe could not be terminated

曾经蜡笔没有小新
曾经蜡笔没有小新

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!