mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 03:23:40 -05:00
wip
This commit is contained in:
parent
c7746071fc
commit
1c91c56d30
4 changed files with 45 additions and 32 deletions
|
|
@ -12,18 +12,18 @@ old_active_stream = active_stream
|
|||
proc = None
|
||||
|
||||
if active_stream != "":
|
||||
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://host.containers.internal:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
else:
|
||||
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.replace('""', '')
|
||||
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(["ffmpeg", "-re", "-i", f"rtmp://mediamtx:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://host.containers.internal:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
|
||||
else:
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
services:
|
||||
mediamtx:
|
||||
network_mode: "host"
|
||||
build:
|
||||
context: ./mediamtx
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8889:8889"
|
||||
- "1935:1935"
|
||||
- "9997:9997"
|
||||
# ports:
|
||||
# - "8889:8889"
|
||||
# - "1935:1935"
|
||||
# - "9997:9997"
|
||||
web-frontend:
|
||||
ports:
|
||||
- "4173:4173"
|
||||
|
|
@ -16,8 +17,6 @@ services:
|
|||
volumes:
|
||||
- tiling_frontend_build:/usr/src/app/dist
|
||||
live-stream:
|
||||
ports:
|
||||
- "1936:1936"
|
||||
depends_on:
|
||||
active_stream_proxy:
|
||||
condition: service_started
|
||||
|
|
@ -36,17 +35,17 @@ services:
|
|||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- ./backend/db:/usr/src/app/db
|
||||
active-stream-proxy:
|
||||
build:
|
||||
context: ./active-stream-proxy
|
||||
dockerfile: Dockerfile
|
||||
depends_on:
|
||||
web-frontend:
|
||||
condition: service_completed_successfully
|
||||
mediamtx:
|
||||
condition: service_started
|
||||
backend:
|
||||
condition: service_started
|
||||
# active-stream-proxy:
|
||||
# build:
|
||||
# context: ./active-stream-proxy
|
||||
# dockerfile: Dockerfile
|
||||
# depends_on:
|
||||
# web-frontend:
|
||||
# condition: service_completed_successfully
|
||||
# mediamtx:
|
||||
# condition: service_started
|
||||
# backend:
|
||||
# condition: service_started
|
||||
volumes:
|
||||
mediamtx_recordings:
|
||||
tiling_frontend_build:
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN apt update
|
||||
|
||||
RUN apt install -y ffmpeg
|
||||
RUN apt install -y ffmpeg xvfb software-properties-common dbus-x11
|
||||
|
||||
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 add-apt-repository -y ppa:xtradeb/apps
|
||||
|
||||
RUN apt update
|
||||
|
||||
RUN apt install -y chromium
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt clean
|
||||
|
||||
COPY run.sh /
|
||||
COPY run.sh .
|
||||
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
ENTRYPOINT ["./run.sh"]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
sleep 1
|
||||
export CHROMIUM_FLAGS="--disable-software-rasterizer --disable-dev-shm-usage"
|
||||
dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address
|
||||
export LIBGL_ALWAYS_INDIRECT=1
|
||||
|
||||
LIBGL_ALWAYS_SOFTWARE=true gst-launch-1.0 -e wpesrc location="http://web-frontend:4173/" \
|
||||
! videoconvert ! videoscale ! videorate \
|
||||
! "video/x-raw, format=NV12, width=1920, height=1080, framerate=30/1" \
|
||||
! filesink location=/dev/stdout | ffmpeg -re -y -f rawvideo -pixel_format nv12 -video_size 1920x1080 -framerate 30 -i - -listen 1 -i rtmp://0.0.0.0:1936/active-input -filter_complex "[0:v][0:v]overlay=-50:0[bg]; [bg][0:v]overlay=-50-W,format=nv12[out]" -map "[out]" -c:v libx264 -x264-params keyint=60 -preset ultrafast -b:v 6800k -c:a copy -map 1:a:0 -movflags faststart -f flv -pix_fmt nv12 rtmp://x.rtmp.youtube.com/live2/$YT_STREAM_KEY
|
||||
bash -c "sleep 5 && DISPLAY=:99 ffmpeg -f x11grab -r 30 -s 1920x1080 -draw_mouse 0 -i :99.0 -f alsa -ac 2 -i hw:0 -vcodec libx264 -preset medium -b:v 7000k -framerate 30 -g 2 -pix_fmt yuv420p -acodec aac -f flv rtmp://x.rtmp.youtube.com/live2/$YT_STREAM_KEY" &
|
||||
|
||||
DISPLAY=:99 xvfb-run \
|
||||
--server-num 99 \
|
||||
-s "-nocursor -ac -screen 0 1920x1080x24" \
|
||||
dbus-launch chromium \
|
||||
--temp-profile \
|
||||
--window-size=1920,1080 \
|
||||
--disable-gpu \
|
||||
--window-position=0,0 \
|
||||
--no-sandbox \
|
||||
--hide-scrollbars \
|
||||
--disable-setuid-sandbox \
|
||||
--app=http://web-frontend:4173
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue