import os
import time
import subprocess
def get_cmd():
commands = []
cmd = "ffmpeg -re -i ./%d_0.mp4 -r 25 -vcodec copy -f flv rtmp://localhost:1935/free-view/camera%d"
for i in range(1, 31):
tmp_cmd = cmd % (i, i)
commands.append(tmp_cmd)
return commands
if __name__ == '__main__':
commands = get_cmd()
for i in range(1, 30):
subprocess.Popen(commands[i], creationflags=subprocess.CREATE_NEW_CONSOLE)
time.sleep(0.05)
while(int(input("輸入9,關鍵子進程")) != 9):
print("重新輸入")
os.system("taskkill /IM ffmpeg.exe /F")
Python新開的一個控制檯執行cmd命令
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.