Malformed Videos

Malformed Videos

I’ve been having some problems with malformed video files from yt-dlp when getting videos from iView. Some videos from the same source come out fine, some are unplayable, and some seem fine but then stop playing part way through. Today I decided to dive reasonably deeply into the downloading options and have come to a prompt that works. Some of the command might be redundant, but this works, so I’m going to stick with it and I’m also going to post it here for future-me when I have forget.

yt-dlp -f "best[ext=mp4]" --merge-output-format mp4 --retries 10 --fragment-retries 10 --concurrent-fragments 5 --no-part --hls-use-mpegts <url>

I think this is best defined as a “note-to-self”.

Repairing Linux

Repairing Linux

sudo SKIP_PACKAGE_CHECK=1 ./DaVinci_Resolve_19.1.4_Linux.run -i

That was what it took to render my system, running Ubuntu 24.04 unbootable. I’d been trying to install the free version of DaVinci Resolve and was running into dependency issues with:

  • libapr1
  • libaprutil1
  • libasound2
  • libglib2.0-0

I found a page that promised that it skipping the package check would let me install the software, then I could disable the bits of Resolve that needed those packages. Hunky dory. Off we go.

Until I went to reboot my system that was acting a little oddly.

My hotkey for bringing up a file explorer (configured to satisfy years and years of Windows use) was launching the Disk Usage Analyser. I’ve always (or maybe longer) had Windows+1 in Windows bound to the Snipping Tool, so I’ve replicated that in Ubuntu for the screenshot tool. This didn’t work either.

Rebooting the system left it hanging on a text-only screen showing what was had loaded. No notable warnings. Some red herrings that looked like errors (that my disk’s UUID wasn’t being used, for instance) but were just notices. I tried the usual recovery steps from the recovery console. Fix broken packages. Check disks. No issues. Then I read that I should uninstall nvidia drivers and this is where things went wrong again. Different errors. More different errors.

So I tried to find the repair-install mode of my Ubuntu Live USB stick, but I don’t think that exists. But what I could do was this, and it took a fair bit of delving into my brainbank for memories that it was possible. I could mount the existing root partition as the current root partition in the running Live system and do further troubleshooting that way.

Here are the steps. They’re fun.

You have backups, right?

Firstly, find out the name of your root partition. This will need a bit of knowledge that I won’t (or can’t?) explain right here. In essence you’re looking for the correct partition type (Linux filesystem [1]) that is the right size (in my case, around 70GB[2]), on the right disk (I have a 500GB NVMe disk as the system disk[3]).

So the partition I have to mount is /dev/nvme0n1p5

sudo mount /dev/nvme0n1p5 /mnt

Then mount /dev /dev/pts /proc /sys and /run with this neat little for loop

for dir in /dev /dev/pts /proc /sys /run; do sudo mount --bind $dir /mnt$dir; done

Now the magic happens with chroot

sudo chroot /mnt

You are now kinda mostly ish sorta running your existing copy of Linux. I ran the following commands and it fixed it. I didn’t reboot between each command, so can’t tell you exactly what fixed it, or if it was maybe the whole thing.

sudo apt update && sudo apt upgrade -y
sudo apt install --reinstall ubuntu-desktop
sudo apt --fix-broken install

exit, and reboot. Hopefully that fixes it. It did for me.

Once I was in I needed to reinstall my nvidia drivers, and everything was back to normal.

If it was still broken, I would have made a backup of my /home folder and my /etc/fstab folder using the Live USB again, reinstalled Ubuntu.

    Ubuntu 24.04 Bug

    Ubuntu 24.04 Bug

    There’s a weird bug in Ubuntu 24.04 where some windows cannot be resized if you’ve got your system set to automatically log in when you boot up the computer.

    Odd.

    If you log out and log back in, everything works fine again. But I don’t want to have to do that. So I delved into shortcuts and turns out in Ubuntu’s GUI, Gnome, if you hold down the Super-key (Windows-key on a Windows-themed keyboard) and drag the edge of the window with a mousewheel click (or middle-click if you’re still rocking a 3-button mouse) you can resize the window in either direction.

    Handy.

    GoPro Filenames

    GoPro Filenames

    I have a GoPro Hero4 Session. This little camera was amazing when it came out. I still think it’s still pretty amazing today. (Aside from one annoyance: I can’t get Quik to connect to it from my Android phone because it insists that there’s a PIN set on it.) It does what I want it to do. Takes half decent action videos in 1080p at 50Hz and wide-angled quite average stills. In good light the photos are pretty usable as happy snaps. It’s waterproof without needing a case. And it comes with all manner of mounts. It’s currently being used on the front of my bike to capture any excitement that might happen as I ride around the place.

    But where it falls over completely is file naming convention. Videos start off with a perfectly fine “GOPR6014.mp4” format. The 6,014th photo or video shot on the camera. Perfect. But then, when that video gets to the filesize limit, it creates a second file with the name GP016014.mp4. And the next file it creates is GP026014.mp4.

    This means that when you sort the files by name, you get a list of all of the second files for the videos, then third files for the videos, then fourth, etc., until you get to a list of all the base files.

    It’s horrible and makes a mess of any storyboarding file editing software you can imagine. (Unless there are ones out there that will accept this horrid GoPro standard that I’ve not yet found).

    Some part of the Star of Greece taken with said GoPro

    Anyway – Python and regex to the rescue.

    import os
    import re
    
    # Get all files in the current directory and skip directories
    for filename in os.listdir('.'):
        if not os.path.isfile(filename):
            continue
    
        name, ext = os.path.splitext(filename)
    
        # Rename GOPR files: GOPR6014.mp4 → 6014-00.mp4
        if name.startswith("GOPR"):
            new_name = name[4:] + "-00" + ext
            os.rename(filename, new_name)
            print(f"Renamed {filename} → {new_name}")
    
        # Rename GP files: GP016015.mp4 → 6015-01.mp4
        elif name.startswith("GP"):
            match = re.match(r"GP(\d{2})(\d+)", name)
            if match:
                suffix = match.group(1)
                main_number = match.group(2)
                new_name = f"{main_number}-{suffix}{ext}"
                os.rename(filename, new_name)
                print(f"Renamed {filename} → {new_name}")

    This takes all the files in the directory that you launch the script from and renames them into a more sensible structure.

    GOPR6014.mp4 becomes 6014-00.mp4.
    GP016014.mp4 becomes 6014-01.mp4.
    GP026014.mp4 becomes 6014-02.mp4.
    and so on.

    This now sorts properly, and makes life much easier.

    Enjoy.

    Test this before you use it on something important.

    .

    .

    Ubuntu.

    Ubuntu.

    Was it a flawless transition? Kinda.

    It would have been better if I’d spent some money on new disks. But I kinda got the shits up when i opened the start menu and there was yet another notification bubble on the gamified thing where you collect Microsoft points for somethingarather by doing something. Then there was a thing about unicorns. And then Copilot was back, telling me that with AI I wouldn’t have endless search results in my start menu.

    I don’t want search results in my start menu, unless it’s an application I have installed on my computer.

    So anyway. A bit of a hiccough with my ownCloud and I’m syncing that down from the cloud again (sorry, old-old work hosting it still, but your upload is going to be about 700GB in the next couple of days (you have my number if you want me to stop)).

    Email is rolling in. Signal and Whatsapp are linked. Browser stuff is all working fine. 1Password was disturbingly easy with the QR code scan. I’ve mounted the NAS drives. Music is playing.

    Todo:

    • tidal-dl
    • yt-dlp
    • Torrent client until I set up a “proper” setup

    So far so good.

    This is the first time that I’ve used Ubuntu and apt on a properly powerful machine, and I’m kinda blown away by how fast it all goes. I’m used to being able to read what packages are, but no chance with a desktop CPU, 32GB of RAM and an M.2 disk.

    Subaddressing

    Subaddressing

    IT security has been in the news lately with the theft of money from superannuation funds. It’s bad, but when you consider that they only made off with $500,000 from the $4.2 trillion that Australians have in super funds it’s pretty inconsequential. It’s not going to ruin anyone’s day. Not even devops, because they’re saying it was a credential stuffing attack.

    To do a bit of maths: $500,000 from $4.2 trillion is 1.2×10-7%. Or 0.00000012%. When it’s easier to work in scientific notation you know it’s insignificant.

    But it could have been bad.

    Preventing credential stuffing is pretty easy – don’t reuse your passwords. This becomes nearly trivial when you use a password manager. You don’t need to remember the passwords that are generated and they can be long and random. The one password that you need to remember to log in to your password manager can be long and simple. (You can look at the maths behind it here: XKCD.com.)

    Then there’s that second factor authentication. When you try to log in, you get an SMS or email with a code sent to the number or address on file that you need to enter before you get let in. Or you need to dig out a number from an app that changes at regular intervals in sync with a service that you’re logging in to.

    There’s a third factor that is tricky to implement – some sort of biometric factor. Like eyes, fingerprint, DNA (Severance style).

    <pretend I found a jif of the fingerprick scenes from Severance>

    I don’t think my super fund has 2FA (or MFA) set up. So I can’t rely on that as a second factor. But I do have an email service that allows for subaddressing email addresses. That link goes to a very dull publication about what subaddressing is.

    In short, it’s that you can add details to the left side of an email address – the bit before the @. So if my main email address is ko@example.com, an email sent to ko+sometext@example.com will be delivered to ko@example.com, but with the +sometext as part of the to field. This is really handy for filtering emails.

    It’s also handy to find out whether your email has been part of a breach or has been sold. If you suddenly get emails to ko+company1@example.com from Company 2, you know that your email address has either been sold or stolen. Handy for the curious but not that useful.

    But where it might come in handy is to add another factor of authentication to limit credential stuffing. If you’ve happened to reuse a password somewhere, but if the username for the places are different, then you’re steps ahead in protecting yourself because there’s no match.

    I hope.

    .

    .

    .

    .