Tech

@tech

Hardware, software, DIY, modding...

Tech @tech 20 Sept 2026, at 01:56 Tech @tech

Tech @tech 18 Sept 2026, at 02:17

I’ve been backing up youtube videos from a select few channels for reasons for quite a while now, though I never got around making them actually easy to watch. It feels very silly to have the files available locally and still stream them from an unreliable service. So I’m gonna give Tube Archivist a try.

Read More

I of course don’t want to redownload everything, but in my infinite wisdom, I decided to remove the youtube video IDs from the file names, which is like the one thing you need for importing existing files. But at least I have the original URL saved in the file metadata so, if you’re in the same situation, you could do something similar to this using ffmpeg:

#!/bin/bash
mkdir -p out
# mp4 files are located in channel subdirectories
for file in ./*/*.mp4; do 
    if [[ -f "$file" ]]; then
        #Extract file name
        dirname="${file%/*}/"
        basename="${file:${#dirname}}"
        # Extract file metadata with ffmpeg
        ffmpeg -i "$file" -f ffmetadata meta.txt
        # grep video id, trim the newline and select the last 11 characters (IDs are always this length)
        vidid=$(grep -oP 'watch\?v\\=([A-Za-z0-9_-]{11})' meta.txt | tr -d '\n' | tail -c 11)
        rm meta.txt
        # Rename into out directory, as ta expects everything flat
        mv "$file" "out/${basename%.*}[$vidid].mp4"
    fi
done

Do note that this works, but it’s not well written. The video id extraction thing is especially … off. I just don’t get along with regex things outside, well, I don’t get along with anything pattern matching anywhere tbh.


Tech @tech 18 Sept 2026, at 20:07

Oh I could of course just have done

vidid=$(grep 'comment=' meta.txt | tr -d '\n' | tail -c 11)

instead… Which would also avoid getting a false video ID from a link in the description. Ask me how I know.


Tech @tech 20 Sept 2026, at 01:56
A bunch of truenas emails of storage quota alerts being set and cleared repeatedly.

It ingests through a directory in the application data… On the nvme disk.