self_ref_yt_vid

A Video That Points to Itself: Self-Referencing Audio on YouTube with QR Codes

QR video demo

Youtube is made for videos. But what if you want to upload just audio? You need at least a still image to go along with your audio. I found myself wondering what to use — after all, my only goal was simply to get the audio up there.

One idea: make a still QR code pointing to something related to the audio. But what? The YouTube video itself! The catch is: that URL only exists after you upload. Here’s where David Wheeler’s wisdom comes in:

Any problem [in computer science] can be solved with another layer of indirection.

We delegate the problem of generating a QR code pointing to an unknown URL by pointing to a known short URL instead. Once the video is uploaded, that short URL can redirect to it.

But why stop there? YouTube lets you link directly to a specific timestamp in a video. So why not generate a whole video of QR codes, one per second, each pointing to the exact moment in the audio?

Voilà: That’s what this script does.


✨ How it works

  1. You start by preparing a TinyURL that will eventually redirect to your YouTube link. You need to use a TinyURL that’s (very likely) to be unused! Note down your tinyurl, which will look similar to this: https://tinyurl.com/arp20130725. tinyurl preparation
  2. Run this script passing the path to your audio as first command line parameter and the tinyurl as the 2nd parameter. Courtesy of ffmpeg, a vast array of audio formats are supported as input.)
  3. The script generates a video where the QR code updates every second (or at a custom interval).
  4. You upload the generated video to YouTube (and optionally the generated .srt subtitle file)
  5. Note the real URL of your video and have your prepared tinyurl redirect to it. tinyurl preparation
  6. Now scanning any QR in the video takes you to that exact timestamp.

🧩 Example use cases


📦 Tech under the hood


🚀 Quickstart

With uv:

chmod +x run_qr_codes.py
./run_qr_codes.py audio.mp3 https://tinyurl.com/arp20130725 -o qr_codes_video.mp4 -d 1

Result:


⚡ Lessons learned