Sunday, February 27, 2011

Tutorial: video encoding for your PSP in h264 using meGUI

Special thanks to

This guide will help you encode any video file into a .mp4 file, in nice resolution and quality, to play on your PSP. This works also with softsubbed movies (like .mkv), since subs get automatically hardcoded into the video.

What you need for starting:
- CCCP codec pack.
- AviSynth
- meGUI
- a 3.30 firmware PSP (or higher)

Starting steps:
- use meGUI autoupdate feature to download the available updates.
- open up CCCP settings, click NEXT, then tick "Autoload VSFilter". This will enable loading of softsubs while encoding, magically converting them to hardsubs in the output video.

For encoding a video file, you'll need an AviSynth script, which is a simple text file (with .avs extension) to tell encoding parameters to the program that actually encodes the video. meGUI needs this script to work.
An example script is
The first line locates the video on your hard drive; the second line sets the resizing method to bicubic, to 480x272 resolution (PSP resolution); the third line cuts the output framerate to 18fps, whic is acceptable for a PSP video in my opinion (also helps reducing the final video size).
For a more complete list of avs commands, look here.

Once you have the avs script for a video file, open up meGUI. Load your script into the video and audio source fields.

Select "x264 scratchpad" in the encoder settings dropdown menu, and press settings.
In the configuration window, enter this settings.

Note the "Threads: 1". Apparently PSP cannot handle h264 videos converted using more than 1 thread.
Also, you can raise the bitrate to get better quality (at the cost of a bigger output file), and set the deblocking to 1 if your movie quality is bad to begin with.
Save your preset in the lower part of the window, so you can reuse it later; i named my preset "PSP".

Select "Nero AAC scratchpad" in the encoder settings dropdown menu, and press settings.
In the configuration window, enter this settings.

Again, save your preset in the lower part of the window.

Once you're done with the settings, press "AutoEncode" in meGUI. In the following window, select "no target size", then press QUEUE.

Now hop to the "Queue" tab of meGUI: you'll notice 4 tasks. First is audio encoding; second is video 1st pass; third is video 2nd pass; and fourth is auto muxing of video and audio together.

Press start, and wait the 4 tasks to finish. END!
Now you can drag&drop the resulting .mp4 file in the "VIDEO" folder in the root of your PSP.

To get a better looking video, you can twiddle with the bitrate or add some filters to the avs script, like Sharpen or Levels.