[MEncoder-users] OCD formatting of DVDs for iPhone

James Hastings-Trew jimht at shaw.ca
Mon Jan 26 04:06:48 CET 2009


Peter Sebastian Masny wrote:
> James Hastings-Trew wrote:
>   
>> Peter Sebastian Masny wrote:
>>   
>>     
>>> Hi all,
>>>
>>> [[[[in short, take 16:9 input and make the video 480x270, then add black 
>>> bars above and below to real resolution 480x320, with a 1:1 pixel ratio]]]]
>>>
>>> Longer:
>>> I got a command line that does a good job of converting a DVD folder 
>>> into an MPEG4 for my iPhone. The only problem is the aspect ratio. The 
>>> situation:
>>> 1. my movies are all 16:9 (1.77:1)
>>> 2. mencoder rarely accurately detects the original aspect ratio (I seem 
>>> to get 2.37:1 all the time)
>>> 3. iPhone display is 480x320 (1.5:1)
>>> 4. quicktime and iPhone need 1:1 pixel sizes, but iPhone will resize the 
>>> pixel ratio (that's the weird part)
>>>
>>> I can run dsize=480:270  and get a nice video, playable on my iPhone, 
>>> but when played it gets stretched to fill the screen (480x320)
>>>
>>> This bothers my OCD tendencies.
>>>
>>> I've tried to force the iPhone to add black bars to the top and bottom by
>>> dsize=480:270,expand=480:320, but this makes SAR 32/27 and does not add 
>>> real black bars.
>>> What's the correct incantation to in short, take 16:9 input and make the 
>>> video 480x270, then add black bars above and below to 480x320, with a 
>>> 1:1 pixel ratio?
>>>   
>>>     
>>>       
>> Expand, then dsize. when the dsize matches the pixel size of the frame, 
>> then the SAR is 1/1.
>>   
>>     
> Thank you. The incantation:
> -vf pp=ci,expand=720:568,dsize=480:320,scale=480:320,harddup
> has the desired effect. A 480x320 video where the content is 480x270 (16:9).
>
>   
Hmm, that bothers me, conceptually. If the source is a 16:9 movie, I 
would go with:
-sws 9 -vf pp=lb,scale=480:270:dsize=480:270,harddup

sws 9 gives you lanczos scaling, which is sharper than the default and 
preserves more texture and edge info when scaling down. pp=lb is a 
linear blend deinterlacer which is very fast - because of the scaling 
involved, the quality of the deinterlacer won't make a lick of 
difference to the final product. Scaling a 720 x 480 16:9 frame down to 
480:270 for the ipod will preserve the aspect ratio of the movie. No 
expand needed.

Additionally, if your DVD is a movie, chances are this will give you an 
even better quality file, and probably eliminate the need for 
de-interlacing completely:

-sws 9 -vf pullup,softskip,scale=480:270:dsize=480:270,harddup -ofps 
24000/1001

The reasoning here is that you are recovering the progressive frames 
from the interlaced ones on the DVD, so your frame rate will drop from 
29.97 to 23.976. Fewer frames per second means less bandwidth wasted on 
duplicate/blurred frames (from the deinterlacing) = more bandwidth 
available for quality.




More information about the MEncoder-users mailing list