Tuesday, September 8, 2009

Converting MKV to MP4 PSP format

I just recently obtained a PSP, and I wanted to put some videos in it. So I figured I should just be able to stick them in the VIDEOS folder in the PSP Memory card and it should work ,right? No!
After spending some time on the net, I found out that the videos must be converted into a special type of MP4 so that it could be played by the PSP.
It seems that there are various ways of converting videos to PSP format, but one of the easiest and more efficient ways of doing this is by using Mencoder, at least for converting mkv's.

Let's cut to the chase, and let's get you started converting those fantastic mkv's into PSP format. First of all, you will need to install Mencoder:


sudo apt-get install mencoder

Once that is taken care of, you can run the following command to convert:


mencoder -mc 0 -af volume=15:0 -subfont-text-scale 3 -vf pullup,softskip,dsize=480:272,\
scale=0:0,harddup,unsharp=l3x3:0.5 \
-ofps 24000/1001 -oac faac -faacopts br=128:mpeg=4:object=2:raw \
-channels 2 -srate 48000 -ovc x264 -x264encopts \
bitrate=500:global_header:partitions=all:trellis=1:level_idc=30:threads=2 \
-of lavf -lavfopts format=psp input.video -o output.video

I have no idea of what a lot of that means, I just know it works.

Yata!! You can now convert mkv to PSP using this command and giving it the values you desire.

Once I figured out how to convert one video, I decided write a bash script that allowed me to queue up several videos for conversion, which to me, is more convenient because I have multiple videos I want to convert and I don't want to have to write this every time for each video.

You can download my bash script here.

You will need to make this script executable, do the following:


sudo chmod +x mkv2PSP.sh

I created this script so that it took a text file as an argument. In this text file, you will specify the absolute path of the .mkv file(s).
One way to create this text file, is with the following command:


ls -d $PWD/*.mkv > FILE

So with this FILE, all you would have to do is call my script with FILE as a parameter:


./mkv2PSP FILE

I would recommend adding this to .bash_aliases to be able to call this script from anywhere on your machine. This is it, if you have any questions/suggestions please post a comment or email me.




[UPDATE]
When converting to the PSP I found that the volume was too low to use on the bus ( even after setting it to MAX) so I looked for ways to hack the PSP into getting me better volume. All the options seemed dangerous and not worth it, but today in my CSE class, I thought that maybe I should increase the volume of the video itself when encoding! So I went online and found this. I will test it out and see if there is any big difference and report back and update my script :D.



[UPDATE]
So after trying out that implementation of volume increase did work! The script above has been modified to reflect this.

1 comments:

Risako said...

o_o This is going to be so helpful for me!! Now I can go convert Darken Than Black to psp format myself!! :D (instead of searching fruitlessly for all the eps x'D)