Encoding video for PSP

December 24, 2008

This is a mostly OS X centric post, but it’s just as relevant for linux and windows as it centres around the use of ffmpeg. (If you want specific ffmpeg info read my other post.)

I recently decided to start using my ancient PSP-1000 to watch my own videos, it usually takes me a long time to actually use gadgets I have to their full potential.

With the practical death of UMD videos and the ~recent introduction of hi-bitrate and hi-resolution mp4 codecs to the PSP and PS3 I thought it was time to give it a go.

BUT I didn’t want to have one set of videos just for the PSP and one set for every other media device. So how to preserve the native resolution and aspect ratio of an original DVD, yet still watch it on the PSP and then still watch it in it’s native DVD resolution as an mp4?

Not easy… It’s taken a lot of searching and 100’s of encodes to figure out some of the optimal settings, and that’s what I’d like to share here. Obviously a lot of credit goes out to all the other people who looked at this before me and found their solutions, cudos.

Firstly, let me clarify that the highest resolution that the PSP handles at the moment is 720 x 480, it does not support PAL native resolutions as far as I can tell.

With this in mind there’s a number of important settings that need to go into encoding AVC (h264/h.264) mp4 video files for the PSP. The most important is that you always need to encode using the MP4 Baseline.

For resolutions like 320×240 or 480×242(native) use the h264 baseline level 1.3 or 2.1 (for ffmpeg this means level=13/level=21).

To encode at 720×480 you can only use h264 baseline level 3.0, nothing else works that I have tried.

Next is something I don’t really get, but the results I suppose speak for themselves. When setting up other codec options, you can only use a maximum of 3 reference frames, and only a maximum of 2 if you are using B frames. However B frames seem to be able to go up to 7 or more so far in my tests, and a combination of 7 B-frames and 2 reference frames rather than 3 reference frames and 0 B-frames seems optimal. See the image below:

picture-2b

You can’t use 8×8 quantize or pyramid B-frames or you’ll break the encode.

Pretty much everything else you can play with.

Now for the more OS X centric part. I’ve found the program HandBrake (version 0.9.1 for OS 10.4.x or higher for 10.5.x) to be excellent.

With this program not only can you encode an mp4 to 720×480 you can also retain the native aspect ratio of the DVD for playback on other devices with a simple check of box.

This means that PAL DVD’s that are squashed into a 720xXXX frame size usually expand to 1024xXXX meaning that you can do that with the 720×480 container, so for instance when I play back the video on my PS3 it plays it back as 1024×480 which looks a lot nicer than squashing it down to 720xXXX. However the PSP will just stretch the video to fill the screen, so if that’s going to be a problem don’t use that option. You can add padding in the crop option to add black borders which will eliminate this, however the final video needs to be exactly 720×480 regardless of the pixel aspect ratio, so keep that in mind.

So in summary, for HandBrake, make sure on the advanced tab that you have:

level=30

as part of your options or your file won’t play on your PSP. (this should work for all ffmpeg encodes too).

Good luck! I may expand the details of this if anyone finds it useful.

(Audio should be AAC 48.000kHz 128kbps, but I think that’s flexible).

Advertisements

7 Responses to “Encoding video for PSP”

  1. guysoft said

    Does Handbrake have a command-line interface? then you could get it to work with PSP Enc ( comments at
    http://guysoft.wordpress.com/2007/11/27/psp-enc-encoding-pspipod-under-linux-gui/ )

  2. 0ffl1n3 said

    Yes there is a command line version which I haven’t used… Anyway, yes there are ports of it for Linux and possibly windows, but it’s written natively for OS X and the ports are more like GUI front ends for HandBrake, whereas the OS X version is supposed to be a more powerful all in one package.

    Basically anything that uses ffmpeg should be pretty good.

    PSP Enc also uses ffmpeg and yes the interface does look very simple which is good!

  3. […] for the PSP with high quality and not super fast encoding in mind. See my earlier post on Encoding video for the PSP for info on alternative […]

  4. Boomhaueruk said

    Hi Offl1n3,

    I’m trying a very similar thing, to get high quality encodes. Happy to use Handbrake, but would rather use FFMPEGX if I could.
    Quick question;

    The picture you show for Handbrake has a lot in the “Current X264 Advanced Option String Box”, but when I follow the settings in your screenshot (ticking the same boxes and so forth) and add ‘level=30″ that only leaves me with:

    level=30:ref=2:bframes=7:me=umh:mixed-refs=1:direct=auto:merange=17:subq=7:analyse=all:deblock=2,2:trellis=1:no-fast-pskip=1:weightb=1:b-pyramid=1

    which doesn’t seem to be everything you’re doing.
    A step by step guide?

    On a side note, I’ve started a thread to discuss FFMPEGX settings here:

    http://forum.videohelp.com/topic367347.html#1961780

    I’m trying to make it quite user friendly, doing everything through the GUI. At the moment it’s an information gathering excercise. Any help much appreciated.

    • 0ffl1n3 said

      Hi Boomhaueruk, I would highly recommend using Handbrake over FFmpegX if you are using OS X. The people behind Handbrake are a serious bunch of guys who are all about quality renders. Unfortunately I’m still using OS 10.4.x so I can’t use the latest Handbrake, but it’s only getting better.

      As for the additional settings in the options box, those will come if you turn on and then turn off again the extra settings that you don’t really need to touch. It’s unnecessary, and I have only done it to be thorough. So for instance a checkbox that is unticked, if you tick it on and then tick it off, it will add an extra string to the options. Same with a pull-down menu, if it says all, but there is no string, and you set it to 1 and then back to all, it will now have a string.

      And just in case you are wondering. level=30 is the only custom string I have added as per the post.

      I had a look at your forum post on videohelp, looks good – so good luck. I did try FFMpegX a long time ago, but found it a bit too messy, and as I said, the Handbrake guys are doing serious work!

  5. Harris said

    Hi, and thanks for this incredibly useful post!
    It works fine as you described it if I use 720×480 resolution and encode the black borders, so that PSP shows the movie with the correct aspect ratio.
    Is there an anamorphic way to do the encoding, without encoding the black borders, keeping the 720×480 resolution and having the correct aspect ratio displayed in PSP?
    I tried many things (changing PAR, DAR, etc) but nothing seems to work. Thanks for your help!

    • 0ffl1n3 said

      As far as I know there isn’t, I also tried all the possible combinations to get it to display anamorphically, but I don’t think the PSP understands, still black borders really don’t add much to the file size, so it’s a small price to pay… though you could get a slightly better quality image with anamorphic… oh well 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: