Thursday, April 12, 2007

encoding TiVo files for your PSP

assuming you've converted your .TiVo file to a mpeg2 that starts as 720x576 with 16x9 black bars you want to get rid of (if source is not wide screen with bars just scale to 320:240 and omit the crop):

mencoder Planet_Earth-Great_Plains-20070409.mpg -oac lavc -ovc x264 -of lavf -x264encopts bitrate=384:bframes=0:global_header:level_idc=21 -ffourcc x264 -lavcopts aglobal=1:acodec=aac:abitrate=92 -af volnorm=1:.99 -vf crop=720:404,scale=368:208,harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -ofps 30000/1001 -o Planet_Earth-Great_Plains-20070409.mp4


this just does it in one pass - but you could do a two pass like i showed in my previous post.

Friday, April 06, 2007

ripping dvds for the psp using mencoder

I got a PSP as a sort of christmas present last year. I actually used various cobbled together gift certificates
, the biggest of which was an Amazon.com one. Short aside: don't ever use the FREE Super Saving Shipping unless you really, truly don't care when it arrives. Mine took about 3 weeks to arrive and it came from a warehouse that was only 45 minutes away!!! Not only that but it never even left the warehouse until the middle of the third week.

But I digress. One of my planned uses for my PSP was to watch movies on it when I'm on the train. The wife is really not a fan of sci-fi or horror movies so two of my most fun genres have been sorely neglected for years now.

No more! Netflix.com and PSP to the rescue.

I did a little research on how to get DVD content onto the PSP and it seemed that vlc or mencoder should be able to handle the task well enough.

Getting to the point where I actually got it working was quite a process. My wife didn't give me too much grief about the late nights fidding with x264 encoding options - but I think the proximity to christmas was probably on my side.

In the end, these are the commands I use on linux to do a two pass encode using x264 and aac at bitrates of 384 and 92 respectively (yielding ~ 350 MB files for ~ 90 minute DVDs):

mencoder dvd://1 -dvd-device /dev/sr0 -alang en -oac lavc -ovc x264 -of lavf -x264encopts bitrate=384:bframes=0:global_header:level_idc=21:pass=1:turbo -ffourcc x264 -lavcopts aglobal=1:acodec=aac:abitrate=92 -af volnorm=1:.99:volume=10 -vf scale=368:208,harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -ofps 24000/1001 -info name="my home movie" -o /dev/null


mencoder dvd://1 -dvd-device /dev/sr0 -alang en -oac lavc -ovc x264 -of lavf -x264encopts bitrate=384:bframes=0:global_header:level_idc=21:pass=2 -ffourcc x264 -lavcopts aglobal=1:acodec=aac:abitrate=92 -af volnorm=1:.99:volume=10 -vf scale=368:208,harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -ofps 24000/1001 -info name="my home movie" -o my_home_movie.mp4


I'm normalizing the volume (and then bumping it again) because the PSP tends to play these things very quietly - which can be a real problem on the train. You can try leaving out the :volume=10 and just using the volnorm if you're a big audiophile ;-)

UPDATE: for firmware 3.30+ folks you can use a larger widescreen size and don't need to bump the volume as much. i also found that 2 vs. 1 pass x264 (at least as i've done it above) doesn't seem to make a noticable size or quality difference at the same bitrate. so this is what i use now:

mencoder dvd://1 -dvd-device /dev/sr0 -alang en -oac lavc -ovc x264 -of lavf -x264encopts bitrate=384:bframes=0:global_header:level_idc=21 -ffourcc x264 -lavcopts aglobal=1:acodec=aac:abitrate=92 -af volnorm=1:.99 -vf scale=420:287,harddup -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames -ofps 24000/1001 -o gangs_of_new_york_disc_2.mp4


Anyway, hope this helps some poor sap from spending hours and hours looking for this stuff on their own. FWIW my PSP has really new firmware - so it handles the codecs well and the videos show up when i toss them in the Videos folder.