35 lines
1.2 KiB
Bash
Executable File
35 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# USER SETTINGS
|
|
RESOLUTION="480"
|
|
FRAMERATE="15"
|
|
BITRATE="1M"
|
|
PROFILE="ultrafast"
|
|
|
|
FST_IP="fier.me:61920"
|
|
FST_USER="user"
|
|
FST_PASSWORD="123"
|
|
FST_CHANNEL="default"
|
|
FST_CHANNELPASS="456"
|
|
|
|
PYTHON="python3"
|
|
|
|
# LINUX:
|
|
ARGS_INPUT="-f x11grab -framerate "$FRAMERATE" -i "$DISPLAY""
|
|
|
|
# WINDOWS:
|
|
# ARGS_INPUT="-f gdigrab -framerate "$FRAMERATE" -i desktop"
|
|
|
|
ARGS_ENCODING="-c:v libx264 -pix_fmt yuv420p -preset $PROFILE -tune zerolatency"
|
|
ARGS_OUTPUT="-f m4v"
|
|
|
|
# APPLY PROPERTIES
|
|
ARGS_INPUT="$ARGS_INPUT -vf scale=-2:$RESOLUTION"
|
|
ARGS_ENCODING="$ARGS_ENCODING -x264-params "nal-hrd=cbr" -b:v $BITRATE -minrate $BITRATE -maxrate $BITRATE -bufsize $BITRATE*2"
|
|
|
|
# HACKS - LOWER DELAY
|
|
ARGS_INPUT="-strict experimental -avioflags direct -thread_queue_size 1 -hwaccel auto -probesize 32 -fflags nobuffer -flags low_delay -flags2 fast $ARGS_INPUT"
|
|
ARGS_ENCODING="-max_probe_packets 0 -max_delay 0 -flags2 fast $ARGS_ENCODING -x264opts intra-refresh=1"
|
|
ARGS_OUTPUT="-flags2 fast $ARGS_OUTPUT -flags2 fast -muxdelay 0 -muxpreload 0 -max_delay 0 -flush_packets 1"
|
|
|
|
ffmpeg $FLAGS_INPUT $ARGS_INPUT $ARGS_ENCODING $ARGS_OUTPUT - | "$PYTHON" fstream.py "$FST_IP" "broadcast,user=$FST_USER,user-password=$FST_PASSWORD,channel=$FST_CHANNEL,channel-password=$FST_CHANNELPASS" |