True - fair dinkum mate - tardigrades… Considering I was ALWAYS late for school (when I wasn’t wagging / playing hookie / truant) I can relate to tardigrades
…
OK - I now have my script to convert a folder of FLAC files to a new folder of mp3 files… Slowly housekeeping all the duplicates (i.e. delete an mp3 album if I already have it in FLAC).
And - just decided to do some housekeeping on my digital movie “offsite backup for archival purpose only” collection - I have dozens of them over 4 GB in filesize, some were close to 8 GB…
So - I’ve been using “ffmpeg” (I can’t imagine life without it - especially as my favourite movie player [mpv] use ffmpeg) to resample overly large video files using the libx265 codec (which is an upgrade of H.264 I believe) and changing the compression ratio (lossiness) - and watching the re-sampled video on my QHD 32" 165 Hz monitor about 2 feet away - having BOTH of them side-by-side - I can’t tell the difference - in some cases I’ve made a 10 fold saving! An 8 GB mkv is now between 8-900 MB and it looks just as good… For special stuff - I’m setting a slighly less lossy (-crf 24) value… I think the default is 23 - I might actually try 23 next time around and see if I still get any space savings…
Anyway - I got sick of searching back through my shell history - and I ended up writing a shell script to do it for me :
╭─x@titan ~
╰─➤ bat ~/bin/reducto.bash
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: /home/x/bin/reducto.bash
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ #!/usr/bin/env bash
2 │ # Reduce a video file by #FACTOR
3 │ PROG=$(basename $0)
4 │ BNARY=ffmpeg
5 │ echo "Usage : "
6 │ echo -e "\t $PROG \$videofile \$factor"
7 │ echo -e "\t\t where \$vidofile exists and : "
8 │ echo -e "\t\t $factor is some value between 20 (lowest) and 51 (highest) compression..."
9 │ # defaults to using x265 format...
10 │ if [ $# -lt 2 ] ; then
11 │ echo "this $PROG expects two arguments..."
12 │ exit 1
13 │ fi
14 │ VID="$1"
15 │ FCT=$2
16 │ if [ ! -f $VID ] ; then
17 │ echo "$VID doesn't seem to exist...."
18 │ exit 1
19 │ fi
20 │ if [[ "$FCT" =~ ^[0-9]+$ || "$FCT" =~ ^[-][0-9]+$ ]] ; then
21 │ echo "looks like an integer then...."
22 │ else
23 │ echo "$FCT is NOT an integer..."
24 │ exit 1
25 │ fi
26 │ if [ $FCT -gt 51 ] ; then
27 │ echo "$FCT out of range - should be less than 52!"
28 │ exit 1
29 │ fi
30 │ # EXT=$(echo $VID | awk '{print $NF}')
31 │ # echo "${filename%.*}"
32 │ NEWVID="${VID%.*}"
33 │ echo Old : $VID
34 │ echo New : $NEWVID
35 │ echo "$BNARY -i $VID -vcodec libx265 -crf $FCT $NEWVID-x265-crf$FCT.mp4"
36 │ $BNARY -i "$VID" -vcodec libx265 -crf $FCT "$NEWVID-x265-crf$FCT".mp4
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
AND I managed to write a shell script without any SWEARING in it too! I might change it a bit later to accept a 3rd argument, filetype by extension - i.e. mkv, mpg, avi as well as mp4…
That NEWVID="${VID%.*}"
stuff is to lose the existing filename extension…
Anyway - about tardigrades - some of the output (several times - for each “stream”) from ffmpeg shows (that is quite possibly actually in the library - not the ffmpeg binary??? "mkvmerge or libx265) :
Stream #0:0: Video: hevc (hev1 / 0x31766568), yuv420p(tv, bt709, progressive), 1280x688 [SAR 172:173 DAR 320:173], q=2-31, 23.98 fps, 24k tbn (default)
Metadata:
BPS-eng : 3977147
DURATION-eng : 02:00:48.992000000
NUMBER_OF_FRAMES-eng: 173802
NUMBER_OF_BYTES-eng: 3603788774
_STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2019-02-12 08:35:12
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
encoder : Lavc58.134.100 libx265
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
I love seeing humorous little “asides” in things like this!
Anyway - if I keep up this sort of house keeping the existing disks in my NAS should last at least another few years - I was under 1 TB free late last year - I now have 1.3 TB free!