summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-06-06 17:29:27 +0200
committerRaymaekers Luca <luca@spacehb.net>2025-06-06 17:29:27 +0200
commit755bb6cf7f8c69898c0fb55086c0b86510a03431 (patch)
treeddcdca2ef03466d82b138189bdf477654d646936 /bin/extra
parentc3c2050d2a6dda58f2ecaaa95da5855e7ca4a264 (diff)
checkpoint
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/compress_discord4
-rwxr-xr-xbin/extra/last_replay9
-rwxr-xr-xbin/extra/phone_cam15
-rwxr-xr-xbin/extra/replay.sh13
4 files changed, 40 insertions, 1 deletions
diff --git a/bin/extra/compress_discord b/bin/extra/compress_discord
index 5e026b0..776888c 100755
--- a/bin/extra/compress_discord
+++ b/bin/extra/compress_discord
@@ -16,6 +16,8 @@ MEGABIT="10000"
# Main
input="$1"
+inputDir="$(dirname "$1")"
+inputName="$(basename "$1")"
if [ -z "$input" ]
then
>&2 printf 'Usage: discord_compress <input>\n'
@@ -32,6 +34,6 @@ common_args="-hide_banner -v quiet -stats -y -hwaccel auto -i $input -c:v $video
set -ex
ffmpeg $common_args -pass 1 -an -f null /dev/null
-ffmpeg $common_args -pass 2 -c:a "$audio_codec" -b:a "${audio_bitrate}K" compressed_"${input%.*}".mp4
+ffmpeg $common_args -pass 2 -c:a "$audio_codec" -b:a "${audio_bitrate}K" "$inputDir"/compressed_"${inputName%.*}".mp4
rm -f ffmpeg2pass*.log*
diff --git a/bin/extra/last_replay b/bin/extra/last_replay
new file mode 100755
index 0000000..5cc0dba
--- /dev/null
+++ b/bin/extra/last_replay
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+File="$(find ~/vids/replays -type f -printf '%Ts %p\n' |
+ grep -E '\.(mp4|mkv|webm)' |
+ sort -n -r |
+ head -n 1 |
+ cut -f 2- -d' ' | tr -d '\n')"
+
+printf '%s' "$File"
diff --git a/bin/extra/phone_cam b/bin/extra/phone_cam
new file mode 100755
index 0000000..df76305
--- /dev/null
+++ b/bin/extra/phone_cam
@@ -0,0 +1,15 @@
+#!/bin/sh
+which v4l2-ctl scrcpy > /dev/null || exit 1
+
+V4L2_Sink="$(v4l2-ctl --list-devices | grep 'Virtual Webcam' -A 1 | tail -n 1 | awk '{print $1}')"
+
+scrcpy --video-source=camera \
+ --no-audio \
+ --no-window \
+ --camera-facing=front \
+ --v4l2-sink="$V4L2_Sink" \
+ --camera-fps=60 \
+ --video-codec=h265 \
+ --camera-ar=4:3 \
+ -m1920 \
+ --capture-orientation=flip90
diff --git a/bin/extra/replay.sh b/bin/extra/replay.sh
new file mode 100755
index 0000000..2a18352
--- /dev/null
+++ b/bin/extra/replay.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+File="$1"
+OutputDir="$(dirname "$File")"
+OutputFile="$(basename "$File")"
+ActiveWindowName="$(xprop -id "$(xdotool getactivewindow)" WM_CLASS | awk -F '"' '{print $(NF-1)}')"
+
+if [ "$ActiveWindowName" ]
+then
+ OutputFileName="${ActiveWindowName}_${OutputFile#Replay_}"
+ mv "$File" "$OutputDir"/"$OutputFileName"
+ notify-send '*replay.sh' "saved: $OutputFileName"
+fi