View Single Post
Posts: 2 | Thanked: 0 times | Joined on Dec 2006
#272
@Serge and those who have pitched in on this project: Thank you! I can now watch full-length PAL movies ripped from DVD on my Nokia 770 at an excellent quality level. Thank you for all your hard work!

@Those just getting into it, here's what I (as a complete mplayer/mencoder noobie) did:

1. Downloaded mplayer and mencoder from here: http://www.mplayerhq.hu

2. Read through some of the mplayer/mencoder documentation. Most of it (as I know very little about the ins and outs of AV formats, codecs, and streaming) didn't necessarily soak in the first time, but it provides helpful background.

3. Ripped a PAL DVD to my hard drive so I could experiment without constantly re-reading it. (Details: mplayer and mencoder can read from a local directory as though they were reading from a DVD drive: Normally you'd supply "dvd://1" as the source path to play the first title on a DVD with mplayer. If you do that but also give it an additional "-dvd-device" parameter followed (after a space) by the path to the directory into which you ripped the DVD (the one with VIDEO_TS, etc.), mplayer and mencoder will read that directory just like reading a DVD. So for me, for instance, instead of just "mencoder dvd://1 etc" it was "mencoder dvd://1 -dvd-device d:\dvds\testrip\video_ts etc".)

4. Experimented a lot with encoding 1-chapter excerpts with various settings and seeing how they played on the 770. Since I want the video full-screen and the device's little processor and DSP just can't handle doing 800x480, as Serge recommends I encoded at 400x240 so when I play it back mplayer can use the hardware pixel doubler to scale it up. My initial efforts produced very choppy movies, even if I lowered the video bitrate to the point where I was seeing quite bad pixellation. I kept at it, though, sure that there was something I was missing based on Serge and others being so pleased with their results, and sure enough -- at one point I was looking at mplayer's output (if you're not running from the command-line, the GUI has an excellent "Report" button you can click after playing the video to see mplayer's output), and finally saw something I'd missed before:

Code:
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [nokia770] 400x240 => 426x240 Planar YV12 [fs]
mplayer was having to scale the movie on-the-fly! And here I was trying so hard to avoid that. It was doing this because I'd encoded it at 400:240 (1.67:1), but the source movie is at the much more typical 1.78:1 -- and mencoder carried that information over into my encoded AVI file, and mplayer was trying to show me the movie in the correct aspect ratio.

This was readily fixed -- as I doubt my eye will really notice the difference in aspect ratio between 1.67:1 and 1.78:1. You can tell mencoder to include the aspect ratio in the output either by specifying "-lavcopts aspect=W/H" or by using "-lavcopts autoaspect". I was using the latter, having happily copy-and-pasted it from an example I found somewhere and not having examined what it meant. Encoding with "-lavcopts aspect=400/240" solves the problem.

[You can also fix this on playback by telling mplayer to ignore the aspect information: If you're running mplayer from the command line (in xterm, for instance), just add "-noaspect" to the command line. For me, since I probably never want it to scale for aspect ratio on playback, I added "noaspect=true" to /etc/mplayer/mplayer.conf. (This is a bit harder than perhaps it should be, as it would appear that you can only change that file as root and many casual users won't know how to get root access. Maybe someday I'll have some free time and can add a configuration screen to the mplayer GUI to contribute back. Not going to happen in January, though. ) ]

The end result is that I can easily encode PAL DVDs to MPEG4 in two passes at 400x240, audio at 128kbps (since Serge got the hardware decoding working!), video at 500kbps, 25fps, and play them back very smoothly using mplayer's latest default options.

Here's how I'm encoding:
Code:
mencoder SourcePath -o Pass1.avi -oac lavc -lavcopts acodec=mp3:abitrate=128 -ovc lavc -lavcopts vcodec=mpeg4:aspect=400/240:vbitrate=500:vpass=1:turbo -vf scale=400:240 -ffourcc DIVX -idx -alang en
mencoder SourcePath -o TargetFile.avi -oac lavc -lavcopts acodec=mp3:abitrate=128 -ovc lavc -lavcopts vcodec=mpeg4:aspect=400/240:vbitrate=500:vpass=2 -vf scale=400:240 -ffourcc DIVX -idx -alang en
(Then I throw away Pass1.avi -- if you're using Linux, you can specify /dev/null instead of Pass1.avi.)

Of course, you can also use the automatic script(s) listed in other posts in this thread, but I wanted to know what was going on under the covers.

Thank you again, Serge & Co!!
--
T.J. Crowder
tj at crowder software dot com

Last edited by tjcrowder; 2007-01-01 at 16:36. Reason: Fixing issues caused by the forum posting, rather than previewing, the message (I hit preview, forum thought it was spam, blocked my account, and then later posted the message).