summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-12-18 18:33:00 -0800
committerxyz <gky44px1999@gmail.com>2021-12-18 18:33:00 -0800
commitc3b89b850fa7436a70232c29bce19423d5f2bcd2 (patch)
tree31a713b925188970b3d279208ea695a6500a9bf4 /home
parent786f2b691d208fed1ac06c6765a215cf97d72c0c (diff)
reco, consider long recording time that fill up /tmp/, but still need to be careful about not filling up the hard disk
Diffstat (limited to 'home')
-rwxr-xr-xhome/xyz/.local/bin/reco9
1 files changed, 5 insertions, 4 deletions
diff --git a/home/xyz/.local/bin/reco b/home/xyz/.local/bin/reco
index d56e61c2..7da8a4f6 100755
--- a/home/xyz/.local/bin/reco
+++ b/home/xyz/.local/bin/reco
@@ -7,7 +7,8 @@
infofile="/tmp/recoinfo"
recodir="$XDG_VIDEOS_DIR/recordings/"
-mkdir -p "$recodir"
+tmpdir="$recodir/tmp/"
+mkdir -p "$recodir" "$tmpdir"
if [ -e "$infofile" ]; then
read -r pid tmpfile < "$infofile"
@@ -17,10 +18,10 @@ if [ -e "$infofile" ]; then
notify-send 'finish converting'
rm "$tmpfile" "$infofile"
else
- tmpfile="$(mktemp --suffix '.mkv')"
- notify-send 'start recording'
+ tmpfile="$tmpdir/$(time.uuid).mkv"
+ notify-send 'prepare recording'
# arch wiki way, no audio, less cpu use during capturing (fast?), large file size, need convert afterward
- xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2"x"$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1" & echo $!' shell "$tmpfile" | xargs -I {} printf '%s\t%s' '{}' "$tmpfile" > "$infofile"
+ xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -loglevel quiet -f x11grab -framerate 25 -s "$2x$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1" & echo $!' shell "$tmpfile" | xargs -I {} printf '%s\t%s' '{}' "$tmpfile" > "$infofile"
# another way to get subshell ffmpeg child pid
#xrectsel '%w %h %x %y' | xargs sh -c 'ffmpeg -y -f x11grab -framerate 25 -s "$2"x"$3" -i "$DISPLAY+$4,$5" -c:v ffvhuff "$1"' shell "$tmpfile" &
#printf '%s\t%s' "$(ps -o pid= --ppid $!)" "$tmpfile" > "$infofile"