mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 04:03:42 -05:00
more WIP docker stuff
This commit is contained in:
parent
e75f8c944a
commit
8747a8ffe3
7 changed files with 44 additions and 15 deletions
|
|
@ -2,16 +2,25 @@ import subprocess
|
|||
import time
|
||||
import requests
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
print(active_stream)
|
||||
|
||||
old_active_stream = active_stream
|
||||
|
||||
proc = None
|
||||
|
||||
if active_stream != "":
|
||||
proc = subprocess.Popen(["/bin/ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a copy", "rtmp://host.containers.internal:1936/active-input"])
|
||||
|
||||
|
||||
while True:
|
||||
proc = subprocess.Popen([f"ffmpeg -re -i rtmp://mediamtx:1935/{active_stream} -c:a copy rtmp://host.containers.internal:1936/active-input"], shell=True)
|
||||
time.sleep(3)
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
if old_active_stream is not active_stream:
|
||||
proc.terminate()
|
||||
proc = subprocess.Popen([f"ffmpeg -re -i rtmp://mediamtx:1935/{active_stream} -c:a copy rtmp://host.containers.internal:1936/active-input"], shell=True)
|
||||
if proc:
|
||||
proc.terminate()
|
||||
print("e")
|
||||
proc = subprocess.Popen(["/bin/ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a copy", "rtmp://host.containers.internal:1936/active-input"])
|
||||
old_active_stream = active_stream
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue