various improvements
[distro-setup] / ffs
diff --git a/ffs b/ffs
index d63668b6e45b3736e479b37ba1851f32351b9df4..0570787709847c971e649a40b2612f88dca1b926 100755 (executable)
--- a/ffs
+++ b/ffs
@@ -186,11 +186,18 @@ else
   stream_res=$primary_res
 fi
 
-# for 1080p, default 256k is poor quality. 500 is ok. 1500 is a bit
-# better, so go with that.  Also, that is about 2x what is recommended
-# in https://livekit.io/webrtc/bitrate-guide (our framerate is lower).
+stream_x=${stream_res%x*}
+stream_y=${stream_res#*x}
 
-bitrate=$(( ( ${stream_res/x/*} ) / 1380 ))
+# leave out our i3 window borders
+stream_res=$(( stream_x - 4 ))x$(( stream_y - 4))
+
+
+# 1000 is a bit blury, 1500 is pretty clear
+# note https://livekit.io/webrtc/bitrate-guide (our framerate is lower)
+
+# Scale our bitrate to 1500 1080p
+bitrate=$(( ( stream_x * stream_y ) / ( (1920*1080) / 1000 ) ))
 
 # 8 seems fine. be conservative by going a bit higher.
 framerate=10
@@ -306,7 +313,7 @@ if pkill -f ^ffmpeg.\*icecast://source.\*/fsf; then
   sleep 1
 fi
 
-#echo executing: ffmpeg ${opts[@]}
+echo executing: ffmpeg ${opts[@]}
 
 #{ sleep 1; ffp &>/dev/null & }
 
@@ -455,4 +462,9 @@ fi
 # ./configure --enable-libzmq --enable-libpulse --enable-libvorbis --enable-gpl --enable-version3
 #
 
+# note: when playing back, text is going to look aliased unless you
+# watch it in a window that is exactly as bit or bigger than the
+# recording: tabbed i3 window shrinks things. or, use: mpv
+# --video-unscaled
+
 ### end background/development docs ###