Copy videos from Youtube & Co. to your iPod Video with Ubuntu

Contents

Since nearly everybody in the US and more and more Europeans have an iPod and the whole world loves Youtube, wouldn’t it be nice to copy these flash streaming videos (flv-files) to your iPod Video? – Yes, it is possible. And I will tell you how.

1. Copy the flash video files (capture the FLV-files)

Ubuntu (and I guess nearly every Linux distribution) makes it really easy to download the flash videos which can be streamed on platforms like Youtube and all the others. Bad luck for Windows users.

That’s it.

If you just want to watch the video, it’s possible to just open it with your favourite player such as VLC, Totem, MPlayer, etc. This also works while it is still buffering! But since you want to copy it to the iPod Video, you need to resize/re-encode it to a m4v - or mov -file.

2. Resize/Re-encode the flv-file for the iPod Video

Unfortunately, I didn’t find a perfect and fast solution to re-encode flv-videos for the iPod. I will demonstrate two ways, the fast one for movies and series you only want to watch once. And the perfect one for videos you want to keep on the iPod for a longer time.

2.1. Install “ffmpeg” from the Medibuntu repository

For both ways it is at least necessary to install the packages ffmpeg and libavcodec0 from the Medibuntu Repository instead of the regular Ubuntu reps.

You can find out how to do this on the Ubuntu help pages.

2.2. The fast way

The fast way a one big disadvantage: The iPod isn’t able to estimate the length of the video. That means it’s not possible to use the nice diamond control to jump within the video. Regular rewind and fast-forward is still possible anyway.

Luckily, you only need one tool: ffmpeg. Just install it via apt-get:

apt-get install ffmpeg

Basically, just use this command to convert a flv-file to a mov-file (readable/playable by the iPod Video):

ffmpeg -i "my-youtube-video.flv" -f mp4 -vcodec mpeg4 -maxrate 1000k 
   -b 700k -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192k 
   -s 320x240 -aspect 4:3 "my-youtube-video.mov"

To simplify the mass-conversion, I wrote a tiny script which can be copied to your own “.bin”-directory (cp. this article):

#!/bin/bash

for file in $@; do
   ffmpeg -i $file -f mp4 -vcodec mpeg4 -maxrate 1000k -b 700k -qmin 3 -qmax 5 
     -bufsize 4096 -g 300 -acodec aac -ab 192k -s 320x240 -aspect 4:3 $file.mov
done

2.3. The perfect (and slow) way

Well, this way might be the better one since the disadvantage from above doesn’t occur. Unfortunately, it does take a lot longer. A LOT! But just try it out by yourself.

I found an flv-to-iPod (m4v) encoding script on ubuntu.com written by John Dong. Find instructions and installation hints to the script on the [Ubuntu Wiki](https://help.ubuntu.com/community/iPodVideoEncoding#Script 1: pypodconv Script)

3. Transfer the video to the iPod

Use gtkpod or your favorite iPod managing software to transfer the video to your iPod. I hope this helped a little. Please let me know if you have difficulties or found a better (easier) way to do the conversion!