Spaces:
Paused
Paused
Upload stream_videos.py
Browse files- stream_videos.py +26 -0
stream_videos.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
from multiprocessing import Process
|
| 4 |
+
import uvicorn
|
| 5 |
+
from fastapi import FastAPI
|
| 6 |
+
|
| 7 |
+
app = FastAPI()
|
| 8 |
+
|
| 9 |
+
# No Rtmp or Ffmpeg related variables
|
| 10 |
+
|
| 11 |
+
def stream_video():
|
| 12 |
+
# No ffmpeg command here
|
| 13 |
+
subprocess.run("./playit-linux-amd64", shell=True)
|
| 14 |
+
subprocess.run("./Impostor.Server", shell=True)
|
| 15 |
+
|
| 16 |
+
def start_video_streaming():
|
| 17 |
+
video_process = Process(target=stream_video)
|
| 18 |
+
video_process.start()
|
| 19 |
+
|
| 20 |
+
@app.get("/")
|
| 21 |
+
async def read_root():
|
| 22 |
+
return {"message": "Hello World"}
|
| 23 |
+
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
+
start_video_streaming()
|
| 26 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|