A quick Railscasts to PSP script
Posted by Vince Wadhwani on May 29, 2008
I've been searching around the Internet trying to find an appropriate command for ffmpeg that will let me convert video for my PSP in 480x272 resolution. There's a ton of outdated info out there.. no matter what I tried I couldn't get anything beyond 320x240 or 368x204 to work. Finally, I managed to get a recipe that does the trick. The resulting railscasts are viewable on the PSP (barely) so if you've been wanting to convert video in linux to use on the PSP this script is for you.
I should point out that while this does 480x272, the PSP has a built-in option to resize the video so you'll be able to view it at 4:3 if you want to. That might be important if you're converting a video that isn't a screencast. (Wide letters: ok, wide people.. not so much)
Pop open vi and create a file called psp.sh
vi psp.sh
Next, populate as follows
#!/bin/bash
if [ $# == 0 ]
then
echo "Usage: psp.sh video_name.m4v"
fi
target="/home/`echo $LOGNAME`/vidpsp/VIDEO/"
mkdir -p "$target"
for m in "$@"
do
echo "Sarting converting..."
output="10001"
while [ -f "$target/MAQ${output}.MP4" ]
do
let "output += 1"
done
ffmpeg -y -i "$m" -f mp4 -title "$m" -vcodec libx264 -level 21 -s 480x272 -b 768k -bufsize 400k -maxrate 4000k -g 250 -coder 1 -acodec libfaac -ac 2 -ab 128k "${target}/MAQ${output}.MP4"
ffmpeg -y -i "$m" -f image2 -ss 5 -vframes 1 -s 160x120 -an "${target}/MAQ${output}.THM"
done
Lastly, make it executable
chmod +x psp.sh
Run it using psp.sh videoname.m4v.. It worked for me when everything else failed. If you have trouble and you're running Debian, try the debian-multimedia repository. There you'll be able to install a non-crippled version of various apps like mencoder and ffmpeg.
After it's encoded, drop it into the Video folder of your PSP. Inspiration for the script comes from this post by dobestdobrain. I've only made minor modifications to the path and (of course) ffmpeg call.