Convert Movies (with subtitles) for Your PSP on Ubuntu

AVI/MKV/DVD to MP4/H.264/AAC

By on October 7th, 2007 12:52 GMT
For this task, you will need Avidemux 2.4 Preview 2. Why? Simply because it has improved support for H.264 videos, that means most of today's HR (High Resolution) movies and HDTV content. Let's say for example that you've recorded a TV show from your favorite HDTV channel and you don't have time to watch it (that's the reason why you have recorded it in the first place) and you are in a rush. What can you do? Answer: Convert it to a format that can be watched on your PSP (PlayStation Portable)! How? Read the detailed guide below on how to achieve this simple task with nothing but free software on a free platform, Ubuntu Linux.

I've used Ubuntu Gutsy Beta, the AMD64/EMT64 one, for this guide, to demonstrate to everyone that always ask me: how is Linux on a 64-bit platform? Do you have all the software you need? Well, Linux (Ubuntu, because this is what I have been using for some time now... more than a year) and the whole open source community made a lot of progress regarding the 64-bit platform and I can honestly say that... it works folks!

Installing Avidemux 2.4 from SVN

Unfortunately, you will have to open up a terminal for this task and copy/paste the following code, in order to install the dependencies for Avidemux:

code
sudo apt-get -y install automake1.10 g++ gcc liba52-0.7.4 liba52-0.7.4-dev libfaac-dev libfaad2-dev libstdc++6 libgtk2.0-dev libglib2.0-dev libsdl-console-dev libxv-dev pkg-config liblame-dev libmad0-dev libvorbis-dev libxml2-dev libxvidcore4-dev subversion gettext libmozjs-dev cmake libqt4-dev libsamplerate0-dev libjack-dev libarts1-dev libx264-dev

Also, go to Applications -> Add/Remove Programs and search for ubuntu restricted extras and install it.
Review image
Now fetch the Avidemux 2.4 files from SVN with the following command:

code
svn co svn://svn.berlios.de/avidemux/branches/avidemux_2.4_branch/

When the download is over, enter the Avidemux source directory with:

code
cd avidemux_2.4_branch/

And type:

code
cmake .

Take a look at the summary when cmake finished. It should look like this:

code
*******************
** Summary **
*******************
Gtk TRUE
Qt4 YES
*** Video Codec ***
X264 Yes
Xvid4 Yes
*** Audio Codec ***
LAME Yes
FAAD Yes
FAAC Yes
Vorbis Yes
Aften No
libDCA No
libAMRNB No
*** Audio Device ***
ESD Yes
OSS Yes
ARTS Yes
JACK Yes
*** Misc ***
SDL Yes
FreeType Yes
FontConfig Yes
Gettext Yes
Xvideo Yes
samplerate Yes
*******************
*******************

As you can see, except for the Aften, libDCA (DTS support) and libAMRNB (AMR support) audio codecs that can't be found in Ubuntu, the rest of the dependencies are present. Now you can continue with the compilation, type:

code
make

This is why I love cmake, it shows you the percent of the compilation status, so you don't have to worry all the time: how long is it gonna take? Can I take a shower until this thing is done? Well, on my computer the compilation reached 100% (it shows 99% actually) in about 5-6 minutes. When it's done, type:

code
sudo make install

And Avidemux will be installed on your system.

Let's create a desktop shortcut for Avidemux. Right click on your desktop, go to Create Launcher and in the new window that appears enter in the Name: field, Avidemux2 and in the Command: field, avidemux_gtk, choose an icon by clicking on the icon button and when you're done, click OK and the shortcut will be created on your desktop. Double click it and Avidemux will open.
Review image
Convert a movie to PSP specific format

For this example I have used an MKV file, encoded with H.264 video codec and an AC3 5.1 audio codec. Click "Open", search for the video file that you want to convert and double click it. Now, let the application read the file, or index it if it's necessary, and if the codec is supported it will open. If you have an H.264 file, like me, Avidemux will ask you if you want to use an implemented mode for this kind of file, but you will click "Cancel" and then you'll need to rebuild the frames of the file, so click "Yes" when asked. Take a look at the example below:
Review image
Review image
Go to "Auto" menu and select "PSP (H.264)":
Review image
In the new window that will appear, select at 'Target type', PSP 480*272:
Review image
Click the 'Configure' button so we can configure the x264 video codec:
Review image
Type 1000 on the 'Target bitrate' field:
Review image
Then move to second tab (Motion & Misc) and at 'Partition decision' select last option, 7B - Ultra High (RDO on Bframes):
Review image
And on the 'Method' section, select "Exhaustive search":
Review image
Now that the x264 codec is configured, click the 'Filters' button to add a SRT or SUB subtitle (optional) on your movie. On the Filters window, select the 'Subtitles' left tab and double click the first filter called "Subtitler":
Review image
Now, choose the subtitle, choose a preferred font, choose the encoding type (I've used Ascii). Select a color for the subtitle and remember to click on the "Set Size and Position" button so you can adjust the size of the subtitle and where it will appear on the movie. Optionally, you can check the 'Auto split' option or set a delay (in milliseconds).
Review image
Review image
Click OK when you're done with the subtitle configuration and you should see the 'Subtitler' filter added to the 'Active Filters' list.
Review image
Let's configure the audio codec (FAAC in our case). Click the 'Filters' button on the Audio section:
Review image
And select on the 'Mixer' section, Stereo; and on the 'Resampling (Hz)' section, choose 48000 (just check the option and it will be activated):
Review image
Click the 'Save' button and type a desired name and select the location were you want to save the file. Remember to add the .mp4 extension to the name of the file, because Avidemux doesn't auto-complete the file's extension.
Review image
Encoding will start and, depending on your computer specs and the length of the file, it can take between 2-3 hours or a couple of minutes. Our clip was 43 minutes long and it took about 26 minutes to finish, on an Intel Core Duo with 1 GB of RAM machine.
Review image
When the encoding is over, connect your PSP to the computer via USB and upload the .mp4 file in the 'Video' folder. Disconnect the PSP, navigate to Video menu and enjoy your movies (with subtitles).

17 Comments