Wednesday, January 28, 2009

Converting MKV files for PSP

Here is the command I used to convert MKV files for PSP:
mencoder 5centimeter.mkv -font c:winntfontsmingliu.ttc -subfont-text-scale 3 -vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.5 -sid 1 -slang chi -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 -o 5cm_psp.mp4



  • mencoder: the encoder that i used
  • 5centimeter.mkv: the source file. In this particular case, the MKV container has 1 video steam, 1 audio stream and 2 subtitles (Japanese and Chinese)
  • -font c:winntfontsmingliu.ttc: as I want to embed the Chinese subtitle into the output, I specified the MingLiu font here
  • -subfont-text-scale 3: scale down the font for PSP's relatively small screen
  • -vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.5: video filters. Pullup and softskip are not that useful here as the original source has frame rate of 23.976 already. Dsize and scale are to resize the video. Hardup ensure all frames are processed and finally apply an unsharpen mask.
  • -sid 1 -slang chi: embed the Chinese subtitle
  • -ofps 24000/1001: output fps is 23.976
  • -oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000: audio part. Uses the AAC codec, 128kbps, mpeg 4 compatible, 2 channels, and sampling rate is 48kHz.
  • -ovc x264 -x264encopts bitrate=500:global_header:partitions=all:trellis=1:level_idc=30:threads=2 -of lavf -lavfopts format=psp video part. Uses X.264 codec. Trelllis, and level_idc are for fine tuning the quality. Threads=2 is used because my PC has 2 cores.

No comments: