Images and videos
These entries are about programatically doing stuff with media files.
8 articles
When square pixels aren’t square
When you want to get the dimensions of a video file, you probably want the display aspect ratio. Using the dimensions of a stored frame may result in a stretched or squashed video.
Detecting AV1-encoded videos with Python
I wrote a Python test to find videos that are encoded with AV1, so I can convert them to a codec my iPhone can play.
Why can’t my iPhone play that video?
The answer involves the AV1 video codec, Apple’s chips, and several new web APIs I learnt along the way.
Creating a personal wrapper around yt-dlp
I’ve written a new script which calls yt-dlp with my preferred options, so I don’t have to copy my configuration across different projects.
Resizing images in Rust, now with EXIF orientation support
A new version of Rust’s image crate has support for EXIF orientation, which allows me to resize images without mangling their rotation.
Programatically finding the original filename of a photo in the macOS Photos Library
If you’re looking at a UUID’d file in the PhotosLibrary package, how do you find its original filename?
Using qlmanage to create thumbnails on macOS
How you can invoke Quick Look on the command-line to generate high-quality thumbnails.
Adjusting the dominant colour of an image
Adjusting the hue to get different colour variants of the same image.
7 notes
Ignore AI upscaled YouTube videos with yt-dlp
Filter for formats that don’t include
-sr(“super resolution”) in their format ID.Get the duration of a video file with
mediainfoUse
mediainfo --Inform='Video;%Duration%' [VIDEO_FILE].Get an image from a video with ffmpeg
Convert an animated GIF to an MP4 with ffmpeg
Removing letterboxing from a video screenshot with ImageMagick
Using
-trimwill remove the black portions and leave you the unletterboxed image.My config for running youtube-dl
The flags and arguments I find useful when I’m using youtube-dl.
Replace black/white parts of an image with ImageMagick