Update cast_file incantations.

This commit is contained in:
Tom Alexander 2024-10-09 21:09:11 -04:00
parent e38bee4c0f
commit 6d0bc958a9
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -12,12 +12,14 @@ function main {
shift
if [ "$cmd" = "copy" ]; then
copy "${@}"
elif [ "$cmd" = "h264" ]; then
h264 "${@}"
elif [ "$cmd" = "stream_software_h264" ]; then
stream_software_h264 "${@}"
elif [ "$cmd" = "stream_hardware_h264" ]; then
stream_hardware_h264 "${@}"
elif [ "$cmd" = "preprocess_software_h264" ]; then
preprocess_software_h264 "${@}"
elif [ "$cmd" = "preprocess_hardware_h264" ]; then
preprocess_hardware_h264 "${@}"
elif [ "$cmd" = "software_h264" ]; then
software_h264 "${@}"
elif [ "$cmd" = "vp9" ]; then
vp9 "${@}"
elif [ "$cmd" = "preprocess_hardware_vp9" ]; then
@ -60,7 +62,7 @@ function copy {
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
}
function h264 {
function stream_software_h264 {
local file_to_cast
file_to_cast="$3"
@ -72,24 +74,74 @@ function h264 {
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-re \
-stream_loop -1 \
-init_hw_device vaapi=foo:/dev/dri/renderD128 \
-hwaccel vaapi \
-hwaccel_output_format vaapi \
-hwaccel_device foo \
-i "$file_to_cast" \
-filter_hw_device foo \
-vf 'format=nv12|vaapi,hwupload' \
-c:v h264_vaapi \
-bf 0 \
-strict -2 \
-c:a opus \
-b:a 320k \
-ar 48000 \
-f rtsp \
-rtsp_transport tcp \
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
-re \
-stream_loop -1 \
-i "$file_to_cast" \
-c:v h264 \
-b:v 2M \
-profile:v high \
-bf 0 \
-strict -2 \
-c:a opus \
-ac 2 \
-b:a 320k \
-ar 48000 \
-f rtsp \
-rtsp_transport tcp \
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
}
function stream_hardware_h264 {
local file_to_cast
file_to_cast="$3"
local USERNAME PASSWORD
USERNAME="$1"
PASSWORD="$2"
set -x
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-re \
-stream_loop -1 \
-vaapi_device /dev/dri/renderD128 \
-i "$file_to_cast" \
-vf 'format=nv12|vaapi,hwupload' \
-c:v h264_vaapi \
-b:v 2M \
-profile:v high \
-bf 0 \
-strict -2 \
-c:a opus \
-ac 2 \
-b:a 320k \
-ar 48000 \
-f rtsp \
-rtsp_transport tcp \
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
}
function preprocess_software_h264 {
local file_to_cast file_to_save
file_to_cast="$1"
file_to_save="$2"
set -x
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-i "$file_to_cast" \
-c:v h264 \
-b:v 2M \
-profile:v high \
-bf 0 \
-strict -2 \
-c:a opus \
-ac 2 \
-b:a 320k \
-ar 48000 \
"$file_to_save"
}
function preprocess_hardware_h264 {
@ -101,66 +153,19 @@ function preprocess_hardware_h264 {
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-init_hw_device vaapi=foo:/dev/dri/renderD128 \
-hwaccel vaapi \
-hwaccel_output_format vaapi \
-hwaccel_device foo \
-i "$file_to_cast" \
-filter_hw_device foo \
-vf 'format=nv12|vaapi,hwupload' \
-c:v h264_vaapi \
-b:v 2M \
-profile:v high \
-bf 0 \
-strict -2 \
-c:a opus \
-ac 2 \
-b:a 320k \
-ar 48000 \
"$file_to_save"
}
function software_h264 {
local file_to_cast
file_to_cast="$3"
local USERNAME PASSWORD
USERNAME="$1"
PASSWORD="$2"
set -x
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-re \
-stream_loop -1 \
-i "$file_to_cast" \
-c:v h264 \
-bf 0 \
-c:a opus \
-b:a 320k \
-ar 48000 \
-f rtsp \
-rtsp_transport tcp \
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
}
function preprocess_h264 {
local file_to_cast file_to_save
file_to_cast="$1"
file_to_save="$2"
set -x
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
</dev/null exec ffmpeg \
-i "$file_to_cast" \
-c:v h264 \
-bf 0 \
-c:a opus \
-b:a 320k \
-ar 48000 \
"$file_to_save"
-vaapi_device /dev/dri/renderD128 \
-i "$file_to_cast" \
-vf 'format=nv12,hwupload' \
-c:v h264_vaapi \
-b:v 2M \
-profile:v high \
-bf 0 \
-strict -2 \
-c:a opus \
-ac 2 \
-b:a 320k \
-ar 48000 \
"$file_to_save"
}
function vp9 {