Old Computer Challenge - Day 5: Youtube Videos on an iPod Classic

Jul 15, 2023

Reading time: 7 minutes

Note

This is only semi-related to the OldComputerChallenge, but I revisited the idea of downloading videos from Youtube and putting them on an old iPod. I had already figured out the commands a while ago, but I had to refresh my memory from my bash history and because I figure this might actually be of interest to some people, I wrote it as a tutorial.

Again, this is about downloading videos from Youtube and putting them on the iPod, not about accessing Youtube straight from the iPod. That’s not possible because iPods (apart from the iPod touch, which is basically an iPhone) don’t have wifi.

Introduction

A while ago I got into old iPods (of course like so many people thanks to a certain easily excitable australian youtuber) and got myself an old iPod Classic with a 160GB harddisk.

I remember thinking back then that they looked really amazing and that 160GB was just a phenomenal amount of storage, enough for my entire music collection at the time, but of course being a university student who was just barely getting by financially there was no way I could afford one.

Fast forward a decade and a half later, thankfully I have an income now and old iPods have come down in price as well (double win!), so the time had come to get one.

iPodClassic

Of course the first thing I did was to put Rockbox on it, and here it is running the fantastic Adawaitapod theme by D00k!

So then putting music and podcasts and audiobooks on it is pretty straightforward, just copy your MP3s, OGGs, FLACs etc. over and you’re good to go! No iTunes, no messing around trying to get libgtkpod working, it just works like any other MP3-Player, you mount it as a USB-storage device on your computer, copy the files over and that’s it. The way it’s supposed to be.

But wait, this thing can play videos too, right? Could it be possible to rip videos from youtube and put them on the iPod so I can strain my eyes watching them on a way too tiny screen like it’s 2005?1

Of course it is, I wouldn’t have wasted your time with this introduction if it wasn’t.

Necessary software

You need two pieces of software:

Where to get them and how to install them depends on your OS and distro of choice of course, so I’m not going to write up a tutorial about that, I’m going to assume you can figure it out and have it installed.

Ripping the video(s) from Youtube with yt-dlp

First, get the URL of the youtube-video you would like to rip. Just open the video in your browser and copy it from your browsers address bar.

Then, run yt-dlp with the URL as parameter, and I like to tell it to rip the 480p version of the video to save bandwidth. We need to make the video even smaller for the iPod, so there is no point in downloading the full 1080p or 4k file.

 $ yt-dlp -S "res:480" 'https://www.youtube.com/XXXXX'

Note the quotation marks (’), they are necessary in case the youtube link contains characters that the shell would interpret as special characters.

This works on playlists too btw! Just get the URL of the playlist instead and run yt-dlp like so:

 $ yt-dlp -S "res:480" --yes-playlist 'https://www.youtube.com/watch?v=XXXXX'

Now we will most likely end up with a video (or videos) in the webm file format. That’s nice, but way too modern and high-res for our tiny little iPod. So let’s make it smaller and crappier!

Converting for the iPod with ffmpeg

And here we come across an unfortunate issue. The iPod is modern enough to be able to decode h.264 videos in hardware, but Rockbox has no support for it and can only decode the older (and worse) mpeg2 standard. What this means in practice is that we need to convert the videos to mpeg2 which creates bigger files than h.264 at a comparable quality or worse looking video at the same filesize. Quality is of less concern in my opinion, because the iPods screen is tiny and a few compression artefacts here and there only add to the retro experience, but filesize might be important if you don’t have a lot of space available on the iPod.

Either way, we now need to fire up ffmpeg to convert the video to a format the iPod (and Rockbox) understands. The command is pretty straightforward, the for loop is only necessary if you have downloaded multiple videos, but it also works if you have only one video, so I only ever use this line:

 $ for i in *.webm; do ffmpeg -i "$i" -c:v mpeg2video -b:v 4000k -acodec libmp3lame -ab 192k -vf scale=320:-1 "${i%.*}.mpg"; done

In order to change the filesize (and quality), you can play around with the video bitrate (the number after -b:v) and the audio bitrate (the number after -ab) until you have the right values dialed in for your usecase. The bitrates above work well for me, so I’m happy with them.

Now if everything went well, you have a bunch of video files in your folder with the extension *mpg, and you can just copy them over to your iPod, open them in Rockbox like any other file and enjoy your favorite 80s music videos on the go! (I know that’s what you came here for ;) )

iPodClassic

(It looks better in person btw., my camera is not the greatest. But the iPods screen is actually pretty nice for its age!)

Bonus round: Converting to h.264 for the original iPod software

Like I mentioned, the iPod is capable of playing h.264 videos, so if you’re still rocking the original Apple software, you can also convert you videos to a higher quality (and smaller filesize) codec like this:

 for i in *.webm; do ffmpeg -i "$i" -f mp4 -vcodec mpeg4 -vf scale=-2:320 -maxrate 1536k -b:v 768k -qmin 3 -qmax 5 -bufsize 4096k -g 300 -c:a aac -b:a 192k -ar 44100 -ac 2 "${i%.*}.mp4"; done

  1. The iPod Classic which I have came out in 2007 but the first iPod to allow video playback, the iPod Video, was released in 2005. They are technically very similar and have the same screen. ↩︎