Compare commits
4 Commits
5a08b3e0bd
...
9a27184885
Author | SHA1 | Date | |
---|---|---|---|
|
9a27184885 | ||
|
40b0d2c684 | ||
|
6d0bc958a9 | ||
|
e38bee4c0f |
1
ansible/roles/base/files/bbr_loader.conf
Normal file
1
ansible/roles/base/files/bbr_loader.conf
Normal file
@ -0,0 +1 @@
|
||||
tcp_bbr_load="YES"
|
@ -148,3 +148,25 @@
|
||||
block: |
|
||||
daily_scrub_zfs_enable="YES"
|
||||
daily_scrub_zfs_default_threshold="7"
|
||||
|
||||
# Switch to bbr tcp congestion control which should be better on lossy connections like bad wifi.
|
||||
- name: Install loader.conf
|
||||
copy:
|
||||
src: "files/{{ item }}_loader.conf"
|
||||
dest: "/boot/loader.conf.d/{{ item }}.conf"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: wheel
|
||||
loop:
|
||||
- bbr
|
||||
|
||||
- name: Configure sysctls
|
||||
sysctl:
|
||||
name: "{{ item.name }}"
|
||||
value: "{{ item.value }}"
|
||||
state: present
|
||||
reload: false
|
||||
sysctl_file: "/etc/sysctl.conf.local"
|
||||
loop:
|
||||
- name: net.inet.tcp.functions_default
|
||||
value: "bbr"
|
||||
|
@ -26,6 +26,8 @@ firefox_config:
|
||||
# Disable battery status, used to track users.
|
||||
dom.battery.enabled: false
|
||||
# Disable that websites can get notifications if you copy, paste, or cut something from a web page, and it lets them know which part of the page had been selected.
|
||||
#
|
||||
# This breaks copying from BigQuery https://github.com/microsoft/monaco-editor/issues/1540
|
||||
dom.event.clipboardevents.enabled: false
|
||||
# Isolates all browser identifier sources (e.g. cookies) to the first party domain, with the goal of preventing tracking across different domains.
|
||||
privacy.firstparty.isolate: true
|
||||
|
@ -74,3 +74,25 @@
|
||||
|
||||
# doas mkdir /tmp/emulated_tpm
|
||||
# doas swtpm socket --tpmstate dir=/tmp/emulated_tpm --ctrl type=unixio,path=/tmp/emulated_tpm/swtpm-sock --log level=20 --tpm2
|
||||
|
||||
- name: Build aur packages
|
||||
register: buildaur
|
||||
become_user: "{{ build_user.name }}"
|
||||
command: "aurutils-sync --no-view {{ item }}"
|
||||
args:
|
||||
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
|
||||
loop:
|
||||
- fw-ectool-git
|
||||
|
||||
- name: Update cache
|
||||
when: buildaur.changed
|
||||
pacman:
|
||||
name: []
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Install packages
|
||||
package:
|
||||
name:
|
||||
- fw-ectool-git
|
||||
state: present
|
||||
|
@ -12,12 +12,16 @@ function main {
|
||||
shift
|
||||
if [ "$cmd" = "copy" ]; then
|
||||
copy "${@}"
|
||||
elif [ "$cmd" = "h264" ]; then
|
||||
h264 "${@}"
|
||||
elif [ "$cmd" = "av1" ]; then
|
||||
av1 "${@}"
|
||||
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 +64,71 @@ function copy {
|
||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||
}
|
||||
|
||||
function h264 {
|
||||
|
||||
|
||||
function av1 {
|
||||
# local additional_flags=()
|
||||
# additional_flags+=(--profile "$PROFILE")
|
||||
# (cd "$DIR/../" && cargo build --no-default-features "${additional_flags[@]}")
|
||||
|
||||
local destination_type="$1" # "stream" or "preprocess"
|
||||
local acceleration_type="$2" # "software" or "hardware"
|
||||
# shift 2
|
||||
|
||||
local args=()
|
||||
|
||||
if [ "$destination_type" == "stream" ]; then
|
||||
args+=(-re -stream_loop -1)
|
||||
elif [ "$destination_type" == "preproces" ]; then
|
||||
true
|
||||
else
|
||||
(>&2 echo "Unknown destination type: $destination_type")
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$acceleration_type" == "software" ]; then
|
||||
true
|
||||
elif [ "$acceleration_type" == "hardware" ]; then
|
||||
args+=(-vaapi_device /dev/dri/renderD128)
|
||||
else
|
||||
(>&2 echo "Unknown acceleration type: $acceleration_type")
|
||||
exit 1
|
||||
fi
|
||||
|
||||
args+=(-i "$file_to_cast")
|
||||
|
||||
if [ "$acceleration_type" == "software" ]; then
|
||||
args+=(-c:v h264)
|
||||
elif [ "$acceleration_type" == "hardware" ]; then
|
||||
args+=(-vf 'format=nv12|vaapi,hwupload')
|
||||
args+=(-c:v h264_vaapi)
|
||||
else
|
||||
(>&2 echo "Unknown acceleration type: $acceleration_type")
|
||||
exit 1
|
||||
fi
|
||||
|
||||
args+=(-b:v 2M)
|
||||
args+=(-profile:v high)
|
||||
args+=(-bf 0)
|
||||
args+=(-strict -2)
|
||||
args+=(-c:a opus)
|
||||
args+=(-ac 2)
|
||||
args+=(-b:a 320k)
|
||||
args+=(-ar 48000)
|
||||
|
||||
if [ "$destination_type" == "stream" ]; then
|
||||
args+=(-f rtsp)
|
||||
args+=(-rtsp_transport tcp)
|
||||
args+=("rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch")
|
||||
elif [ "$destination_type" == "preproces" ]; then
|
||||
args+=("$file_to_save")
|
||||
else
|
||||
(>&2 echo "Unknown destination type: $destination_type")
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function stream_software_h264 {
|
||||
local file_to_cast
|
||||
file_to_cast="$3"
|
||||
|
||||
@ -72,24 +140,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 +219,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 {
|
||||
|
@ -3,4 +3,5 @@ ifconfig_igb0="up"
|
||||
ifconfig_igb1="up"
|
||||
ifconfig_lagg0="up laggproto failover laggport igb0 laggport igb1"
|
||||
ifconfig_lagg0_alias0="inet 74.80.180.138 netmask 255.255.255.248"
|
||||
ifconfig_lagg0_alias1="inet6 2620:11f:7001:7::2/64"
|
||||
ifconfig_lagg0_ipv6="inet6 2620:11f:7001:7::2/64"
|
||||
ifconfig_lagg0_alias1="inet6 2620:11f:7001:7::3 prefixlen 64"
|
||||
|
@ -19,7 +19,7 @@ function cleanup {
|
||||
done
|
||||
}
|
||||
vms=()
|
||||
for sig in EXIT INT QUIT HUP TERM; do
|
||||
for sig in EXIT; do
|
||||
trap "set +e; sleep 10; cleanup" "$sig"
|
||||
done
|
||||
|
||||
@ -67,17 +67,17 @@ function start_vm {
|
||||
local bridge_link_name
|
||||
bridge_link_name=$(detect_available_link "${bridge_name}")
|
||||
|
||||
# additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}")
|
||||
additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}" "-s" "3,ahci-cd,/home/talexander/disk.iso")
|
||||
additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}")
|
||||
# additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}" "-s" "3,ahci-cd,/home/talexander/disk.iso")
|
||||
# -H \
|
||||
vms+=("$name")
|
||||
while true; do
|
||||
set -x
|
||||
set +e
|
||||
bhyve \
|
||||
-D \
|
||||
-c 1 \
|
||||
-c 2 \
|
||||
-m 3G \
|
||||
-H \
|
||||
-o 'rtc.use_localtime=false' \
|
||||
-s 0,hostbridge \
|
||||
-s "4,nvme,/dev/zvol/zroot/vm/mediamtx/disk0" \
|
||||
|
@ -19,7 +19,7 @@ function cleanup {
|
||||
done
|
||||
}
|
||||
vms=()
|
||||
for sig in EXIT INT QUIT HUP TERM; do
|
||||
for sig in EXIT; do
|
||||
trap "set +e; sleep 10; cleanup" "$sig"
|
||||
done
|
||||
|
||||
|
@ -19,7 +19,7 @@ function cleanup {
|
||||
done
|
||||
}
|
||||
vms=()
|
||||
for sig in EXIT INT QUIT HUP TERM; do
|
||||
for sig in EXIT; do
|
||||
trap "set +e; sleep 10; cleanup" "$sig"
|
||||
done
|
||||
|
||||
@ -68,6 +68,7 @@ function start_vm {
|
||||
bridge_link_name=$(detect_available_link "${bridge_name}")
|
||||
|
||||
additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}")
|
||||
# additional_args+=("-s" "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}" "-s" "3,ahci-cd,/home/talexander/disk.iso")
|
||||
vms+=("$name")
|
||||
while true; do
|
||||
set -x
|
||||
|
Loading…
Reference in New Issue
Block a user