Sunday, December 31, 2006

Encoding PSP-compatible MP4 files on Linux

I bought a PSP at the beginning of the summer, so that Jamie could watch his favourite movies on the long plane ride to Qatar. It's a fairly straight-forward (and well-documented) task to convert DVDs on Windows, but I'd never tried on Linux.

There's a Perl copying suite called dvd::rip, which has many prerequisites. After installation, it isn't obvious how to encode a movie so that it will work on a PSP. I gave up on dvd::rip, and looked at ffmpeg, a command-line utility.

Artfahrt gives useful information about a couple of Windows conversion tools (PSP video 9 and 3GP converter), and how they both use ffmpeg to encode movies. Unfortunately, the example given doesn't work with recent versions of ffmpeg on Linux. It's clear that both tools use a specially modified version of ffmpeg, which will not compile on Linux. Another dead-end.

Finally, after much wailing and tearing of clothes, I came across this post, which provides all the information necessary to encode movies.


Craig said...

You can also try the Mplayer/Mencoder tools to create similar files. This command works great on my 16:9 TV shows:

mencoder -oac lavc -ovc lavc -of lavf -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:vbitrate=500:acodec=aac -af lavcresample=24000 -vf scale=368:208,harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -ofps 30000/1001 -o test.MP4 input.avi

Anonymous said...

Man this is amazing! Now i dont need to buy the psp media manager! Works like a charm!

James Hastings-Trew said...

Newer versions of mEncoder do not require the "i_certify_that_my_video_stream_does_not_use_b_frames" switch in the -lavfops format=psp section anymore. You'll still get the warning about the b-frames, but the hard to type, hard to remember switch is no longer necessary. :)