It is necessary to overtake the film from MKV with dimensions of
1280 x 536 to the size of a mobile phone with dimensions of
320 x 240 and keep the proportions. To
mp4 format with audio to
ac3I have this method of calculating proportions (the most standard is mathematical):
If from
1280 it should be
320 , then we need to calculate the coefficient for calculating the short side, for this we divide
1280 by
320 , we get
4 . So, to calculate the short side, we need to divide
536 by
4 . We get
134 .
So, if we set the resulting size, then we will succeed. As if not so!
The phone has a screen of
320 x 240 , and if our video is
320 x 134 we launch on the phone, then it will stretch the short side of
134 pixels to
240 , that is, the characters in our movie will have elongated faces, etc. So you need to bring the final file to a size of
320 x 240 , filling the missing pixels with black color at the top and bottom. To do this, made a special video filter
PAD .
Let's estimate how much you need to add to
134 to make
240 ? Very simple: subtract
134 from
240 , it turned out
106 . These
106 pixels need to be added to our video to get it right. But we do not want this strip with a height of 106 pixels to be just above or below, for this we divide this
106 px into two
53 px bands and place it above and below.
ffmpeg -i kino.mkv -vcodec mpeg4 -vb 500K -acodec libfaac -ar 44100 -ab 256K -ac 2 -vf «scale=320:135,pad=320:240:0:53:black,unsharp» -vol 700 -y kino.mp4
Decrypt
-vf "scale = 320: 135, pad = 320: 240: 0: 53: black, unsharp"')
scale = 320: 135 - specify the PROPORTIONAL size of the output file to the original film size.
pad = 320: 240: 0: 53: black -
320: 240 - the actual screen size of the phone,:
0: 53 - on the scale
X - shift
0 , on the scale
Y - shift
53 pixels.
: black, unsharp - Stripes will be black (black) color. You can add
unsharp definition. And you can not add. This filter also has settings. Need to read.