File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ PIPELINE=${PIPELINE:-noop}
5
5
STREAM_KEY=" my-stream"
6
6
STREAM_ID=" my-stream-id"
7
7
RTMP_OUTPUT=${RTMP_OUTPUT:- " " }
8
+ FPS=${FPS:- 30}
9
+ INPUT_VIDEO=${INPUT_VIDEO:- " " }
8
10
9
11
case " $1 " in
10
12
start)
@@ -18,12 +20,16 @@ case "$1" in
18
20
QUERY=" ${QUERY} \¶ms=${ENCODED_PARAMS} "
19
21
fi
20
22
21
- ffmpeg -re -f lavfi \
22
- -i testsrc=size=1920x1080:rate=30,format=yuv420p \
23
- -vf scale=1280:720 \
23
+ INPUT_FLAGS=" -f lavfi -i testsrc=size=1280x720:rate=${FPS} ,format=yuv420p"
24
+ if [ -n " $INPUT_VIDEO " ]; then
25
+ INPUT_FLAGS=" -stream_loop -1 -i ${INPUT_VIDEO} "
26
+ fi
27
+
28
+ ffmpeg -re ${INPUT_FLAGS} \
29
+ -vf " scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720" \
24
30
-c:v libx264 \
25
31
-b:v 1000k \
26
- -x264-params keyint=60 \
32
+ -x264-params keyint=$(( FPS * 2 )) \
27
33
-f flv rtmp://127.0.0.1:1935/${STREAM_KEY} ? ${QUERY}
28
34
;;
29
35
playback)
You can’t perform that action at this time.
0 commit comments