Add software vp8 live cast.

This commit is contained in:
Tom Alexander 2024-07-13 13:15:04 -04:00
parent 6be368a1e8
commit 076b8d296f
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -16,6 +16,8 @@ function main {
h264 "${@}" h264 "${@}"
elif [ "$cmd" = "software_h264" ]; then elif [ "$cmd" = "software_h264" ]; then
software_h264 "${@}" software_h264 "${@}"
elif [ "$cmd" = "software_vp8" ]; then
software_vp8 "${@}"
elif [ "$cmd" = "preprocess_h264" ]; then elif [ "$cmd" = "preprocess_h264" ]; then
preprocess_h264 "${@}" preprocess_h264 "${@}"
elif [ "$cmd" = "preprocess_vp8" ]; then elif [ "$cmd" = "preprocess_vp8" ]; then
@ -138,6 +140,35 @@ function preprocess_vp8 {
"$file_to_save" "$file_to_save"
} }
function software_vp8 {
local USERNAME PASSWORD
USERNAME="$1"
PASSWORD="$2"
local file_to_cast
file_to_cast="$3"
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
# -strict -2 :: Enable support for experimental codecs like opus.
# -b:v 1M :: Target 1 megabit/s
# -crf 10 :: Target a quality level and adjust bitrate accordingly. This should be preferred, but ideally both should be used.
exec ffmpeg \
-re \
-stream_loop -1 \
-i "$file_to_cast" \
-c:v vp8 \
-b:v 1M \
-crf 10 \
-bf 0 \
-c:a opus \
-b:a 320k \
-ar 48000 \
-strict -2 \
-f rtsp \
-rtsp_transport udp \
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
}
function webcam { function webcam {
# Uses on-webcam h264 encoding. # Uses on-webcam h264 encoding.