mirror of
https://github.com/flavioribeiro/donut.git
synced 2025-10-05 23:16:53 +08:00
uses srt live transmit
This commit is contained in:
19
Dockerfile-srt-live
Normal file
19
Dockerfile-srt-live
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM ubuntu:20.04 AS builder
|
||||
|
||||
ENV SRT_VERSION="v1.5.3"
|
||||
ENV SRC_FOLDER="/opt/srt_lib"
|
||||
|
||||
RUN apt-get clean && apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
tclsh pkg-config cmake libssl-dev build-essential git \
|
||||
&& apt-get clean
|
||||
|
||||
RUN \
|
||||
mkdir -p "${SRC_FOLDER}" && \
|
||||
git clone --depth 1 --branch "${SRT_VERSION}" https://github.com/Haivision/srt && \
|
||||
cd srt && \
|
||||
./configure --prefix=. $(configure) && \
|
||||
make && \
|
||||
make install
|
||||
ENV PATH="${PATH}:/srt"
|
||||
WORKDIR ${WD}
|
@@ -12,16 +12,18 @@ services:
|
||||
- "8081:8081"
|
||||
- "8081:8081/udp"
|
||||
|
||||
origin: # simulating an srt origin live transmission
|
||||
image: jrottenberg/ffmpeg:4.4-alpine
|
||||
srt:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-srt-live
|
||||
entrypoint: sh
|
||||
command: "/scripts/ffmpeg_srt_live_listener.sh"
|
||||
command: "./scripts/srt.sh"
|
||||
volumes:
|
||||
- "./scripts:/scripts"
|
||||
environment:
|
||||
- SRT_LISTENING_PORT=40052
|
||||
- SRT_LISTENING_HOST=0.0.0.0
|
||||
- SRT_LISTENING_LATENCY_US=400000
|
||||
- SRT_UDP_TS_INPUT_HOST=0.0.0.0
|
||||
- SRT_UDP_TS_INPUT_PORT=1234
|
||||
ports:
|
||||
- "40052:40052/udp"
|
||||
depends_on:
|
||||
@@ -29,3 +31,18 @@ services:
|
||||
links:
|
||||
- app
|
||||
|
||||
origin: # simulating an mpeg-ts upd origin live transmission
|
||||
image: jrottenberg/ffmpeg:4.4-alpine
|
||||
entrypoint: sh
|
||||
command: "/scripts/ffmpeg_mpegts_udp.sh"
|
||||
volumes:
|
||||
- "./scripts:/scripts"
|
||||
environment:
|
||||
- SRT_INPUT_HOST=srt
|
||||
- SRT_INPUT_PORT=1234
|
||||
- PKT_SIZE=1316
|
||||
depends_on:
|
||||
- srt
|
||||
links:
|
||||
- srt
|
||||
|
||||
|
6
scripts/ffmpeg_mpegts_udp.sh
Executable file
6
scripts/ffmpeg_mpegts_udp.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
ffmpeg -hide_banner -loglevel verbose \
|
||||
-re -f lavfi -i testsrc2=size=1280x720:rate=30,format=yuv420p \
|
||||
-f lavfi -i sine=frequency=1000:sample_rate=44100 \
|
||||
-c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline \
|
||||
-b:v 1000k -bufsize 2000k -x264opts keyint=30:min-keyint=30:scenecut=-1 \
|
||||
-f mpegts "udp://${SRT_INPUT_HOST}:${SRT_INPUT_PORT}?pkt_size=${PKT_SIZE}"
|
@@ -1,7 +0,0 @@
|
||||
ffmpeg -hide_banner -loglevel verbose \
|
||||
-re -f lavfi -i "testsrc2=size=1280x720:rate=30,format=yuv420p" \
|
||||
-f lavfi -i "sine=frequency=1000:sample_rate=44100" \
|
||||
-c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline \
|
||||
-b:v 1000k -bufsize 2000k -x264opts keyint=30:min-keyint=30:scenecut=-1 \
|
||||
-f mpegts "srt://${SRT_LISTENING_HOST}:${SRT_LISTENING_PORT}?mode=listener&latency=${SRT_LISTENING_LATENCY_US}&smoother=live&transtype=live"
|
||||
|
4
scripts/srt.sh
Executable file
4
scripts/srt.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
# ref https://github.com/Haivision/srt/blob/master/docs/apps/srt-live-transmit.md
|
||||
srt-live-transmit \
|
||||
udp://${SRT_UDP_TS_INPUT_HOST}:${SRT_UDP_TS_INPUT_PORT} \
|
||||
srt://:${SRT_LISTENING_PORT}?congestion=live -v
|
Reference in New Issue
Block a user