Compare commits
2 Commits
9029508c58
...
1e47ff3f64
Author | SHA1 | Date | |
---|---|---|---|
|
1e47ff3f64 | ||
|
31bf399b51 |
@ -37,4 +37,5 @@ firefox_config:
|
|||||||
# Instead, enable fingerprinting protection, which allows configuring an override.
|
# Instead, enable fingerprinting protection, which allows configuring an override.
|
||||||
privacy.fingerprintingProtection: true
|
privacy.fingerprintingProtection: true
|
||||||
# Allow sending dark mode preference to websites.
|
# Allow sending dark mode preference to websites.
|
||||||
privacy.fingerprintingProtection.overrides: "+AllTargets,-CSSPrefersColorScheme"
|
# Allow sending timezone to websites.
|
||||||
|
privacy.fingerprintingProtection.overrides: "+AllTargets,-CSSPrefersColorScheme,-JSDateTimeUTC"
|
||||||
|
@ -14,8 +14,16 @@ function main {
|
|||||||
copy "${@}"
|
copy "${@}"
|
||||||
elif [ "$cmd" = "h264" ]; then
|
elif [ "$cmd" = "h264" ]; then
|
||||||
h264 "${@}"
|
h264 "${@}"
|
||||||
|
elif [ "$cmd" = "preprocess_hardware_h264" ]; then
|
||||||
|
preprocess_hardware_h264 "${@}"
|
||||||
elif [ "$cmd" = "software_h264" ]; then
|
elif [ "$cmd" = "software_h264" ]; then
|
||||||
software_h264 "${@}"
|
software_h264 "${@}"
|
||||||
|
elif [ "$cmd" = "vp9" ]; then
|
||||||
|
vp9 "${@}"
|
||||||
|
elif [ "$cmd" = "preprocess_hardware_vp9" ]; then
|
||||||
|
preprocess_hardware_vp9 "${@}"
|
||||||
|
elif [ "$cmd" = "vp8" ]; then
|
||||||
|
vp8 "${@}"
|
||||||
elif [ "$cmd" = "software_vp8" ]; then
|
elif [ "$cmd" = "software_vp8" ]; then
|
||||||
software_vp8 "${@}"
|
software_vp8 "${@}"
|
||||||
elif [ "$cmd" = "preprocess_h264" ]; then
|
elif [ "$cmd" = "preprocess_h264" ]; then
|
||||||
@ -40,13 +48,15 @@ function copy {
|
|||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
PASSWORD="$2"
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-re \
|
-re \
|
||||||
-stream_loop -1 \
|
-stream_loop -1 \
|
||||||
-i "$file_to_cast" \
|
-i "$file_to_cast" \
|
||||||
-c copy \
|
-c copy \
|
||||||
|
-strict experimental \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +68,8 @@ function h264 {
|
|||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
PASSWORD="$2"
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-re \
|
-re \
|
||||||
@ -71,14 +83,40 @@ function h264 {
|
|||||||
-vf 'format=nv12|vaapi,hwupload' \
|
-vf 'format=nv12|vaapi,hwupload' \
|
||||||
-c:v h264_vaapi \
|
-c:v h264_vaapi \
|
||||||
-bf 0 \
|
-bf 0 \
|
||||||
|
-strict -2 \
|
||||||
-c:a opus \
|
-c:a opus \
|
||||||
-b:a 320k \
|
-b:a 320k \
|
||||||
-ar 48000 \
|
-ar 48000 \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preprocess_hardware_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.
|
||||||
|
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 \
|
||||||
|
-bf 0 \
|
||||||
|
-strict -2 \
|
||||||
|
-c:a opus \
|
||||||
|
-b:a 320k \
|
||||||
|
-ar 48000 \
|
||||||
|
"$file_to_save"
|
||||||
|
}
|
||||||
|
|
||||||
function software_h264 {
|
function software_h264 {
|
||||||
local file_to_cast
|
local file_to_cast
|
||||||
file_to_cast="$3"
|
file_to_cast="$3"
|
||||||
@ -87,6 +125,8 @@ function software_h264 {
|
|||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
PASSWORD="$2"
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-re \
|
-re \
|
||||||
@ -98,7 +138,7 @@ function software_h264 {
|
|||||||
-b:a 320k \
|
-b:a 320k \
|
||||||
-ar 48000 \
|
-ar 48000 \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +147,8 @@ function preprocess_h264 {
|
|||||||
file_to_cast="$1"
|
file_to_cast="$1"
|
||||||
file_to_save="$2"
|
file_to_save="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-i "$file_to_cast" \
|
-i "$file_to_cast" \
|
||||||
@ -118,25 +160,60 @@ function preprocess_h264 {
|
|||||||
"$file_to_save"
|
"$file_to_save"
|
||||||
}
|
}
|
||||||
|
|
||||||
function preprocess_vp8 {
|
function vp9 {
|
||||||
|
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.
|
||||||
|
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 vp9_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"
|
||||||
|
}
|
||||||
|
|
||||||
|
function preprocess_hardware_vp9 {
|
||||||
local file_to_cast file_to_save
|
local file_to_cast file_to_save
|
||||||
file_to_cast="$1"
|
file_to_cast="$1"
|
||||||
file_to_save="$2"
|
file_to_save="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
# -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 \
|
exec ffmpeg \
|
||||||
|
-init_hw_device vaapi=foo:/dev/dri/renderD128 \
|
||||||
|
-hwaccel vaapi \
|
||||||
|
-hwaccel_output_format vaapi \
|
||||||
|
-hwaccel_device foo \
|
||||||
-i "$file_to_cast" \
|
-i "$file_to_cast" \
|
||||||
-c:v vp8 \
|
-filter_hw_device foo \
|
||||||
-b:v 1M \
|
-vf 'format=nv12|vaapi,hwupload' \
|
||||||
-crf 10 \
|
-c:v vp9_vaapi \
|
||||||
-bf 0 \
|
-bf 0 \
|
||||||
|
-strict -2 \
|
||||||
-c:a opus \
|
-c:a opus \
|
||||||
-b:a 320k \
|
-b:a 320k \
|
||||||
-ar 48000 \
|
-ar 48000 \
|
||||||
-strict -2 \
|
|
||||||
"$file_to_save"
|
"$file_to_save"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +225,8 @@ function software_vp8 {
|
|||||||
local file_to_cast
|
local file_to_cast
|
||||||
file_to_cast="$3"
|
file_to_cast="$3"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
||||||
# -strict -2 :: Enable support for experimental codecs like opus.
|
# -strict -2 :: Enable support for experimental codecs like opus.
|
||||||
# -b:v 1M :: Target 1 megabit/s
|
# -b:v 1M :: Target 1 megabit/s
|
||||||
@ -165,10 +244,34 @@ function software_vp8 {
|
|||||||
-ar 48000 \
|
-ar 48000 \
|
||||||
-strict -2 \
|
-strict -2 \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preprocess_vp8 {
|
||||||
|
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.
|
||||||
|
# -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 \
|
||||||
|
-i "$file_to_cast" \
|
||||||
|
-c:v vp8 \
|
||||||
|
-b:v 1M \
|
||||||
|
-crf 10 \
|
||||||
|
-bf 0 \
|
||||||
|
-c:a opus \
|
||||||
|
-b:a 320k \
|
||||||
|
-ar 48000 \
|
||||||
|
-strict -2 \
|
||||||
|
"$file_to_save"
|
||||||
|
}
|
||||||
|
|
||||||
function webcam {
|
function webcam {
|
||||||
# Uses on-webcam h264 encoding.
|
# Uses on-webcam h264 encoding.
|
||||||
|
|
||||||
@ -176,6 +279,8 @@ function webcam {
|
|||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
PASSWORD="$2"
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-re \
|
-re \
|
||||||
-input_format h264 \
|
-input_format h264 \
|
||||||
@ -184,7 +289,7 @@ function webcam {
|
|||||||
-c:v copy \
|
-c:v copy \
|
||||||
-an \
|
-an \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +300,8 @@ function encode_webcam {
|
|||||||
USERNAME="$1"
|
USERNAME="$1"
|
||||||
PASSWORD="$2"
|
PASSWORD="$2"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
exec ffmpeg \
|
exec ffmpeg \
|
||||||
-re \
|
-re \
|
||||||
-vaapi_device /dev/dri/renderD128 \
|
-vaapi_device /dev/dri/renderD128 \
|
||||||
@ -203,7 +310,7 @@ function encode_webcam {
|
|||||||
-c:v h264_vaapi \
|
-c:v h264_vaapi \
|
||||||
-an \
|
-an \
|
||||||
-f rtsp \
|
-f rtsp \
|
||||||
-rtsp_transport udp \
|
-rtsp_transport tcp \
|
||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user