Playing YouTube Videos on the Sony PSP
This is my latest obsession. Since I travel for around 2.5 hrs during my office commute, I need to keep myself entertained. Till now the Sony PSP was being used to play the odd game or to listen to some music. I finally managed to get all the pieces together to start encoding videos for the PSP on Debian GNU/Linux. This got boring after a while as I didn't have new content to keep me entertained on a daily basis.
The next step was to get the videos from YouTube to play on the PSP. This actually turned out easier than I expected. Here's how I managed to do it,
- Get Mozilla Firefox.
- Install the "VideoDownloader" extension.
- Install ffmpeg on Debian. apt-get install ffmpeg. My ffmpeg version is the one pulled from the ffmpeg subversion repo. This is on Debian unstable mind you with the debian-multimedia repo's.
- Go to YouTube/Google Videos and view a video, click on the VideoDownlaoder icon on the Status bar of Firefox, this will inturn popup a window with the link to the video being currently played. Right click and "Save the link" on your PC.
- Videos will be saved in the FLV (Flash Video) format. You can play them using VLC.
- You need to re-encode these videos to the PSP's aspect ratio. Here's the ffmpeg one-liner which will do it for you.
$input_file :: is the name of the Video you just downloaded (.flv)
$output_file :: is the name of the output file for the PSP which should be of the type M4V000XX.MP4 , where XX is a random number.
If everything goes well, stick that into a bash script like so:
echo $input_file echo $output_file
ffmpeg -i $input_file -f psp -r 29.970 -s 320x240 -b 768 -ar 24000 -ab 32 $output_file
And you can invoke the script as ./psp_enc.sh ~/Videos/youtube.flv M4V00010.MP4
The whole setup should also be possible on Fedora and Ubuntu too. The next best thing I discovered is ffmpeg2theora, very useful command-line tool if you have a set of divx files and worried that you might loose the ability to play them due to patent problems. ffmpeg2theora will allow you to re-encode your videos to the Ogg Theora format which is an open format and widely supported by almost all the players on Linux.
Technorati Tags :psp, sonypsp, linux, youtube, ffmpeg, debian, video, video encoding, ubuntu, bash, shellscripting, firefox, firefoxextension, videodownloader, googlevideos, ogg, ffmpeg2theora, oggtheora, theora