Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

Mencoder, DVD Rip, Volume Increase, Your PSP, and You!

Holy crap. The time between iterations of testing video encoding is prohibitive to quick progress as well as a (several) good night’s sleep.

After much pain and gnashing of teeth, I present you with the result of the last 3 hours of my life.

time nice mencoder dvd://1 -sws 9 \
-aid 128 -af volume=15:0 \
-vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3x3:0.7 \
-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 \
-of lavf -lavfopts format=psp -info name=”Tomb Raider” -o “$HOME/Movies/TombRaider.mp4”

Sincere thanks to forgeflow’s answer to this ubuntu forum post and to his excellent videogeek site.

Other observations:

  • There is far more complexity to audio/video encoding than I’d ever want to understand fully.
  • Anyone who actually understands mencoder fully deserves to be the next US president.
  • No, seriously, I’d vote for him/her.
  • The above incantation of mencoder accomplishes what I need it to, namely:
    • Rips a full DVD for me without having to pull it into an intermediary file.
    • Increases the volume of the ripped/encoded track by 20 decibels in this case. Handbrake doesn’t yet let you do that.
    • Takes advantage of the newer PSP System Software’s ability to handle H264 encoding (which I hear is what all the cool kids are using these days).
  • This same thing (without being able to turn the volume up) is possible in Handbrake with this:

    ~/local/HandBrakeCLI -i /dev/dvd –longest –size 800MB -e x264 -x ref=2:mixed-refs=1:bframes=3:b-rdo=1:bime=1:weightb=1:subme=6:trellis=1:analyse=all:level=3:no-fast-pskip:me=umh –crop 0:0:0:0 -R 48 -b 1024 -w 480 -l 272 –markers -o ~/Movies/TombRaider.mp4

  • Yes, I am not ashamed to admit it: I like Tomb Raider. Angelina and I were married in an alternate dimension, and I can beat Tomb Raider Legends in 2 hours with my eyes closed.
  • One or more of the statements made in the above bullet point may be more the result of sleep-deprivation than actual truth.

Good night, Gracie.

[ Update ] Okay, nuts… apparently this video quality isn’t quite good enough because now I’m seeing weird ghosting on the PSP while watching the resultant movie. Yay, another geekly late night tonight….

[ Update 2008-03-04 ] I’ve  updated the command that I’m using now with mencoder, thanks to some comments and tweaks during the past few months.

16 Replies to “Mencoder, DVD Rip, Volume Increase, Your PSP, and You!”

  • @morador: LOL! =:) You have to pronounce it with a Texan accent and then there might be a chance. =;)

    @Karol: Hey, cool!! Glad to be of service!! Tonight I’m going to try to figure out how to raise the video bitrate/quailty, as that’s about the only thing I don’t like 100% with the current solution. Let me know if you find any improvements of your own!! =:)

  • Hey Jason, great initiative. I’m ready to memcode some dvd’s to psp format and am very interested in you findings …
    I hope to use them now on my laptop and in a later stage on the linux booted ps3 I have @ home. See if we can get that baby encoding ultra-fast.

  • I forgot .. does this work with multiple passes like encoding xvid? I noticed a huge difference in image quality between single pass and 2-pass encodings for my psp in the past.

    Another thing, I also want to rip tv-series dvd’s. Will that also work with the current described method?

  • Hi Quido,

    It seems that something breaks when I add “threads=2” or “threads=auto” to the x264encopts flag, so I’ve been leaving that out and thus using only a single CPU, which stinks. I’d love to figure out how to improve both quality and speed, so any help you could give would be great. And yeah, you can do multi-pass with mencoder, but I’ve not played with it yet. I’ll try it now. =:)

    And yes, you can rip tv-series dvd’s, but I’d think you’d want to change it slightly to get all of the shows. My command, as shown, will only pull the first title off the DVD. You’ll want to change it and get each title that you care about.

    Please let me know what you end up using!! =:)

  • No luck, I think my psp (3.40 OE-A) does not really support h.264. I keeps complaining about an unsupported format. I will try again within a couple of days …

  • Jason, I tried your command. Added -endpos 3 because thats enough to find if it works. That did not work for me, so I tried the commands in the Ubuntu page you link to. Those two don;t work either. You’ve been sweating hours for your result, I did not yet succeed and spend even more time on it 🙂
    I’ll try some windows apps now and see if my PSP is acting weird or if I’m doing something wrong.

  • Hey. Thanks for the tips. I modified your command a bit, though.

    The mencoder command you mention will fail in certain cases. The scale=480:-10 means scale width to 480 pixels and maintain aspect ratio. Later in the filter chain, expand=480:272 expands the height to 272 pixels. However, if the scale command results in a video that is already taller than 272 pixels (e.g. a video with 4:3 aspect), the expand command will not crop the video down, resulting in a video that is for example 480×384 (which the PSP will not play). So instead of scaling to 480:-10, you should set a maximum for each dimension.

    You can do this by replacing scale=480:-10 with dsize=480:272:0,scale=0:0

    Your post shows up fairly high on google for “psp mencoder”, so if this works for you too, you might want to update it.

    Thanks again.

    -oc

  • Hi Ole!

    Thank you! I’ll update the command line that I have above. I tested it and it did seem to work just fine. Now the one thing that still bothers me is why my kids’ iPod nano videos can’t play these movies. I have to rip them for them at 320×240, which means I have to rip things twice–once for my PSP and once for their iPod nano videos. I thought the iPod nanos were able to handle 480×272??

  • I can *completely* sympathize with your frustration. I’ve spent hours downloading and compiling and searching trying to get a chain of tools that would convert a DVD to play on the PSP. Video conversion is so arcane that everyone seems to re-implement it over and over and yet none of them work.

    You solution with mencoder is *so* much simpler.

    I found that ‘threads=2’ seems to work for me. I also found that ‘dsize=480:272:2:16’ correctly converted both widescreen (16:9) and fullscreen (4:3). Without it, a full-screen DVD was “stretched” too fill the screen instead of leaving black bands on the sides of the screen.

  • You’re a freakin godsend.

    It’s fast, it’s simple, and it fixes the audio. Perfect.

    I upped the audio significantly more, but other than that I’m loving the straight up copypasta.

  • @Chris: Heh. Thanks! =:) Glad it helped ya! BTW, I asked the Handbrake guys about adding the ability to increase the volume while ripping and they were completely uninterested, saying that a ripper has no business playing with volume levels. Obviously, I strongly disagree and still find it quite necessary. Glad this helped you, though! Thanks for the comment! =:)

  • Thank you very much for this!
    I had been looking around the ‘net to find a way to convert high quality mkv videos into PSP format and I did find a way, but I had the volume problem ( I ride the bus and could not hear much ). Now with this -af command I can pump up the volume of my videos making easier to hear :D.

    Just as a side note, would you mind explaining the syntax of this:
    -af volume=15:0
    I tried looking it up online but I could not find a good source.

    Thank you.

  • If you’re using a newer version of x264 you’ll need to throw in no8x8dct to your x264encopts line.

    Newer versions of x264 will default to the High profile instead of Main if 8x8dct is enabled. You should see “x264 [info]: profile Main, level 3.0” in the mencoder output if everything is working correctly.

    Full example:
    -ovc x264 -x264encopts bitrate=640:global_header:threads=4:level_idc=30:partitions=all:trellis=1:no8x8dct

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.