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).

Encoding video for VHS

December 24, 2008

the only way to encode for VHS!

First of all you need to find the MPEG-0 codec, which is really hard to find these days due to it being replaced with real codecs.

If you do manage to track down a copy of it, good luck trying to find any software that will recognise it.

Still reading? WTF? Okay load up the software on your Amiga 1000, you’ll need to swap 3.5″ flexi-disks mid way through which will totally corrupt the video file, but somehow you manage it anyway.

Plug your trusty JVC VCR into the custom monitor output on the back of your A1000, note you must have an S-VHS input on the JVC VCR for this to work, or you’ll get too many JPEG artefacts… not worth it IMHO.

Finally, if you have a serial port on your JVC VCR you can hook that up to the Amiga to get it to sync everything nicely and remotely control record and playback functions.

That’s it everything’s looking good so far… fingers crossed. Start the compression of the first frame of video, I think we’re talking about a native VHS resolution of about 300 odd scanlines… plenty, with the onboard memory of the A1000 you should be able to compress one frame per session and using the record/playback sync through the serial port it will pause the tape for you so you can reboot to encode the next frame.

As for the source video file, forget it, you’ll be lucky to get anything digitized in the first place, unless you can find a digi view gold from newtek, even then you’ll probably need 1 meg of chip ram, so go and get your A2000 out.. oh that’s right you left it in the bathroom at that place you rented in Strawberry Hill… oh well, it was fun while it lasted.

I found my thrill on Strawberry Hill

What colour is your berry?