Pythonが新しく開いたコンソールでcmdコマンドを実行
3624 ワード
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")