[General Topics] nihil0:
Here is a little description how to make excellent videos for PDA with Linux - in my broken english (sorry for that!)

You will need mplayer: http://www.mplayerhq.hu/

1.) Identify the original video size

mplayer -identify -frames 0 -vc null -vo null -ao null INPUT.avi | grep -i "VO: "

You will get something like this:

VO: [null] 592x320 => 592x320 Planar YV12 [zoom]
​

But we want a video with 320x240 size.

Resizing - height related: ( new_height / orig_height ) * orig_width

(240 / 320) * 592 => 444 --> this is biger than 320

so the new video siz would by 444x240
​

Resizing - width related: ( new_width / orig_width ) * orig_height

(320 / 592) * 240 => 128 --> this is smaler than 240

so the new video size would be 320x128

​

2.) If you want to crop

If your video don't fit after the conversion the 320x240 area, you have 2 choises:

* The first one is, not to care abut, so after the conversion, the video will not fully fit the display. It will have a black upper and bottom bar.

* The second one is to make some cropping

example 1 - full 320x240 fit:

You have checked the size of the film and it is 592x320

The 592 pixel width is to big, so you must decrease:

( new_width / new_height ) * orig_height => 426,66 --> 427

So a 427x320 size video can be resized to 320x240 without any distorsions.

This means, you can crop from left and right some pixels to get the 427 pixel size:

(592 - 427) => 165

165 / 2 => 82,5

The croping: 82(left) - 427(width) - 83(right) pixels
​

example 2 - crop but only a litle bit:

You can decide, to make some cropping, but not for the full 320x240 fit. Doing so, you will still see a black upper and bottom bar in the converted avi.

You can make also a cropping like this:

The croping: 40(left) - 512(width) - 40(right) pixels

So the 512x320 original size will be after conversion 320x150.

​

3.) Make the converting

Use the following command and fill the crop values and the filenames correctly. It will take 4-5 hours for a normal 720Mb film, but the result is small and excellent.

nice -n 19 mencoder \

-vf crop=w:h:x:y,pp=ac,unsharp=l5x5:2.0:c5x5:2.0,scale=320:-2,expand=320:240:::1,dsize=320:240 \

-af resample=44100:0:2 -oac mp3lame -lameopts cbr:br=64 \

-ovc lavc \

-lavcopts vcodec=mpeg4:vbitrate=200:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2 \

INPUT.avi -o OUT.avi

From our example 2:

nice -n 19 mencoder \

-vf crop=512:320:40:0,pp=ac,unsharp=l5x5:2.0:c5x5:2.0,scale=320:-2,expand=320:240:::1,dsize=320:240 \

-af resample=44100:0:2 -oac mp3lame -lameopts cbr:br=64 \

-ovc lavc \

-lavcopts vcodec=mpeg4:vbitrate=200:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2 \

INPUT.avi -o OUT.avi

4.) If you want to add also the subtitle

Add the following at the end of your command:

-subcp latin2 -subfont-autoscale 3 -subfont-text-scale 4 -sub SUBTITLE

From our example 2:

nice -n 19 mencoder \

-vf crop=512:320:40:0,pp=ac,unsharp=l5x5:2.0:c5x5:2.0,scale=320:-2,expand=320:240:::1,dsize=320:240 \

-af resample=44100:0:2 -oac mp3lame -lameopts cbr:br=64 \

-ovc lavc \

-lavcopts vcodec=mpeg4:vbitrate=200:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2 \

INPUT.avi -o OUT.avi -subcp latin2 -subfont-autoscale 3 -subfont-text-scale 4 -sub SUBTITLE