mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 02:03:41 -05:00
kinda working
This commit is contained in:
parent
e468e0b9ab
commit
35c2a98835
6 changed files with 36 additions and 17 deletions
|
|
@ -2,9 +2,9 @@ import subprocess
|
|||
import time
|
||||
import requests
|
||||
|
||||
time.sleep(5)
|
||||
time.sleep(10)
|
||||
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text.replace('"', '')
|
||||
print(active_stream)
|
||||
|
||||
old_active_stream = active_stream
|
||||
|
|
@ -12,19 +12,18 @@ 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://live-stream:1936/active-input"])
|
||||
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
else:
|
||||
proc = subprocess.Popen(["/bin/ffmpeg", "-i", "anullsrc", "-c:a copy", "rtmp://live-stream:1936/active-input"])
|
||||
|
||||
proc = subprocess.Popen(["ffmpeg", "-f", "lavfi", "-i", "anullsrc", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
|
||||
while True:
|
||||
time.sleep(3)
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text.replace('""', '')
|
||||
if old_active_stream is not active_stream:
|
||||
if proc:
|
||||
proc.terminate()
|
||||
if active_stream != "":
|
||||
proc = subprocess.Popen(["/bin/ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a copy", "rtmp://live-stream:1936/active-input"])
|
||||
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
else:
|
||||
proc = subprocess.Popen(["/bin/ffmpeg", "-i", "anullsrc", "-c:a copy", "rtmp://live-stream:1936/active-input"])
|
||||
proc = subprocess.Popen(["ffmpeg", "-f", "lavfi", "-i", "anullsrc", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
old_active_stream = active_stream
|
||||
|
|
|
|||
|
|
@ -8,12 +8,16 @@ services:
|
|||
- "1935:1935"
|
||||
- "9997:9997"
|
||||
web-frontend:
|
||||
ports:
|
||||
- "4173:4173"
|
||||
build:
|
||||
context: ./tiling-frontend
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- tiling_frontend_build:/usr/src/app/dist
|
||||
live-stream:
|
||||
ports:
|
||||
- "1936:1936"
|
||||
depends_on:
|
||||
active_stream_proxy:
|
||||
condition: service_started
|
||||
|
|
@ -22,8 +26,7 @@ services:
|
|||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- tiling_frontend_build:/html
|
||||
environment:
|
||||
YT_STREAM_KEY: ${YT_STREAM_KEY}
|
||||
env_file: .stream.env
|
||||
backend:
|
||||
env_file: .backend.env
|
||||
ports:
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
FROM alpine:3.20
|
||||
FROM ubuntu:22.04
|
||||
|
||||
RUN apk add --no-cache gstreamer gstreamer-tools gst-plugins-bad
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apk add --no-cache ffmpeg
|
||||
RUN apt update
|
||||
|
||||
RUN apk add --no-cache bash libwpe libwpe-dev
|
||||
RUN apt install -y ffmpeg
|
||||
|
||||
RUN apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-wpe
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt clean
|
||||
|
||||
COPY run.sh /
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
gst-launch-1.0 -e wpesrc location="https://en.wikipedia.org/wiki/Main_Page" \
|
||||
sleep 1
|
||||
|
||||
LIBGL_ALWAYS_SOFTWARE=true gst-launch-1.0 -e wpesrc location="http://web-frontend:4173/" \
|
||||
! queue \
|
||||
! videoconvert ! videoscale ! videorate \
|
||||
! "video/x-raw, format=BGRA, width=854, height=480, framerate=30/1" \
|
||||
! "video/x-raw, format=BGRA, width=1920, height=1080, framerate=30/1" \
|
||||
! videoconvert \
|
||||
! x264enc speed-preset=1 \
|
||||
! filesink location=/dev/stdout | ffmpeg -re -y -i - -listen 1 -i rtmp://0.0.0.0:1936/active-input -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 -t 10 -f flv rtmp://x.rtmp.youtube.com/live2/no-way-am-i-doing-that-again
|
||||
! filesink location=/dev/stdout | ffmpeg -re -y -i - -listen 1 -i rtmp://0.0.0.0:1936/active-input -c:v copy -c:a libmp3lame -map 0:v:0 -map 1:a:0 -g 90 -framerate 30 -movflags faststart -bufsize 14000k -f flv rtmp://x.rtmp.youtube.com/live2/$YT_STREAM_KEY
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,3 +20,6 @@ authInternalUsers:
|
|||
ips: []
|
||||
permissions:
|
||||
- action: api
|
||||
- action: publish
|
||||
- action: playback
|
||||
- action: read
|
||||
|
|
|
|||
|
|
@ -14,3 +14,5 @@ FROM base AS release
|
|||
COPY --from=install /temp/dev/node_modules node_modules
|
||||
COPY . .
|
||||
RUN bun --bun run build
|
||||
ENTRYPOINT ["bun", "--bun", "run", "preview", "--host"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue