summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rwxr-xr-xvideo/rectape2
-rwxr-xr-xvideo/rmduppic67
-rwxr-xr-xvideo/screenrec20
-rwxr-xr-xvideo/webcamdesktopffplay (renamed from video/webcamffplay)0
4 files changed, 84 insertions, 5 deletions
diff --git a/video/rectape b/video/rectape
index f6e7a01..1e54370 100755
--- a/video/rectape
+++ b/video/rectape
@@ -3,8 +3,6 @@ if [ -z "$1" ]; then
$1=untitled_$(ls | wc -l)
fi
-# All hevc_amf ffmpeg options: $ ffmpeg -h encoder=hevc_amf
-
ffmpeg \
-f decklink -format_code ntsc -i "Intensity Pro" \
-c:v libx264 \
diff --git a/video/rmduppic b/video/rmduppic
new file mode 100755
index 0000000..6fdc18d
--- /dev/null
+++ b/video/rmduppic
@@ -0,0 +1,67 @@
+#!/usr/bin/env python3
+import os
+import subprocess
+
+def sizeinbytes(size, unit):
+ mag = {'KiB' : 1, 'MiB': 2, 'GiB' : 3}
+ return float(size) * (1000 ** mag[unit])
+
+# Run czkawka_cli on the current directory
+cwd = os.getcwd()
+print("Running czkawa for directory ", cwd, "...", sep="")
+czkawka = ["czkawka_cli", "image", "-d", cwd]
+czkawkadata = subprocess.run(czkawka, stdout=subprocess.PIPE)
+czkawkadata = czkawkadata.stdout.decode('utf-8').splitlines() # Convert to a normal string and split into lines
+if not czkawkadata:
+ print("All images in", cwd, "are unique. Exiting...")
+ exit()
+
+# Get number of images total and remove first line since it would cause issues
+numimages = int(czkawkadata[0].split()[1])
+print ("Done!", numimages, "duplicate images found...")
+czkawkadata.pop(0)
+
+# Split czkawkadata by the delimeter used by czkawka_cli
+czkawkadata = [i.split(' - ') for i in czkawkadata]
+
+# Make keep store the images we want to keep
+largest = 0
+i = 0
+dups = 0
+keep = [None] * numimages
+for image in czkawkadata:
+ if not image[0]:
+ largest = 0
+ i += 1
+ continue
+ dups += 1
+ size = image[2].split()
+ size = sizeinbytes(size[0], size[1]) # Convert to bytes so we can easily compate kb vs mb vs gb
+ if size > largest:
+ largest = size
+ keep[i] = image
+
+# Remove all empty entries from czkawkadata
+czkawkadata[:] = [x for x in czkawkadata if x[0]]
+
+# Remove any images we're keeping from czkawkadata to be left with only the duplicates
+for image in keep:
+ czkawkadata.remove(image)
+
+# User actions
+confirmation = None
+message = "Are you sure you want to delete all " + str(dups - len(keep)) + " duplicate images? (Yes/No/Show) "
+while not confirmation:
+ confirmation = input(message)
+ if (confirmation == "yes"):
+ for image in czkawkadata:
+ os.remove(image[0])
+ print("Removed image", image[0])
+ elif (confirmation == "no"):
+ exit()
+ elif (confirmation == "show"):
+ for image in czkawkadata:
+ print(image)
+ confirmation = None # Prompt again
+ else:
+ confirmation = None
diff --git a/video/screenrec b/video/screenrec
index 91edcd0..fa6b628 100755
--- a/video/screenrec
+++ b/video/screenrec
@@ -1,6 +1,20 @@
#!/bin/sh
newname() { defname="video"; name=$defname`ls | grep "^$defname[0-9]*" | wc -l | tr -d '[:blank:]'`.mkv; }
-vs=`cat /sys/class/drm/*/modes | head -1`
-vs=1366x768
[ -z "$1" ] && newname || name="$1"
-ffmpeg -hide_banner -video_size $vs -framerate 60 -f x11grab -i :0.0+0,0 -c:v libx264 -preset ultrafast -qp 1 -pix_fmt yuv444p "$name"
+# Get screen info. I suspect this script wouldn't work too well with multiple screens. Somebody else can add that
+resinfo="$(xrandr | grep '*' | tr -s ' ')"
+vs="$(echo "$resinfo" | cut -d' ' -f2)"
+fr="$(echo "$resinfo" | sed 's/.*\s\([0-9]*\.[0-9]*\)\*.*/\1/')"
+# -i is screen coordinates for top-leftmost screen
+# Encoder settings are basically lossless and optimized for good speed, decent size, and great quality
+# yuv444p colorspace is needed for a 24 bit rgb monitor, change for hdr. yuv420p is the default and is good for video, but is inadequate for screencasts
+ffmpeg -hide_banner \
+ -video_size $vs \
+ -framerate $fr \
+ -f x11grab \
+ -i :0.0+0,0 \
+ -c:v libx264 \
+ -preset ultrafast \
+ -qp 1 \
+ -pix_fmt yuv444p \
+ "$name"
diff --git a/video/webcamffplay b/video/webcamdesktopffplay
index c56d879..c56d879 100755
--- a/video/webcamffplay
+++ b/video/webcamdesktopffplay