Encode PSP video with ffmpeg from command line

For various reasons, incompetence being high on the list, I cannot get fffmpegX to encode a decent video for PSP. It always comes out with a poor aspect ratio or the sound is out of sync or it doesn’t play on the PSP. I must have tried to use ffmpegx at least a dozen times without any decent results.

So, I figured the next best way is to encode PSP video using ffmpeg from the command line on my mac. I was getting a lot of error messages like Unknown codec 'libxvid' and Unknown codec 'libaac' and just about any other video codec I tried. If the codecs are unknown that means they may not be enabled in your install of ffmpeg. To add codecs to your ffmpeg, I suggest you re-install ffmpeg using port install.

Ports is the easiest way to manage ffmpeg on Mac OS X. A great explanation to install ffmpeg using ports can be found in this article — HOWTO install and use FFmpeg on Mac OS X Leopard » Hay Kranen

Taking his commands, I added +faac and +faad to my ffmpeg installation.

port install ffmpeg +gpl +lame +x264 +xvid +faac +faad

Originally I had installed ffmpeg without any extra codecs (port install ffmpeg). That is the wrong way to do it. To have a fully usable ffmpeg you need to add various codecs like libaac, libxvid, and libx264 as listed above.

Second, you encode the video. The only command that I found to work for me was at Robert Swain’s PSP video guide.

ffmpeg -i INPUT -acodec libfaac -ab 128k -ar 48000 \
-s WIDTHxHEIGHT -r FRAME_RATE -vcodec libx264 -b BIT_RATE \
-flags +loop -cmp +chroma \
-partitions +parti4×4+partp8×8+partb8×8 \
-me_method umh -subq 6 -trellis 1 \
-refs 2 -bf 1 -coder 1 -me_range 16 -g 300 -keyint_min 25 \
-sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 4M \
-bufsize 4M -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 21 \
-threads 0 OUTPUT.mp4

I don’t know what half of this stuff is but I do know you replace the ALLCAPS stuff with your own settings. I had success with these parameters for a 16:9 source video:

 -s WIDTHxHEIGHT = 368×208
 -r FRAME_RATE = 29.97
 -b BIT_RATE = 500kb (or 500000)
 -bt BIT_RATE = (I deleted this piece)
Syndicate content