Am 01.03.2012 04:52, schrieb Murray Strome:
> I am wondering if anyone on this list knows of an easy-to-understand 
> documentation of the ffmpeg -vf option.

It is reported, that, after a lecture, some student approached
Erwin Schroedinger, the famous physicist, to ask about clarification of
some detail of the quantum mechanics, which was the subject of the lesson.

Schroedinger asked in return: "do you want a clear explanation,
or do you want a precise explanation?"

Nuff said.
The precise explanation is in the man page.

> crop  Crop the input video to out_w:out_h:x:y.

> The parameters are expressions containing the following constants:
...
...
> The out_w and out_h parameters specify the expressions for the width and 
> height of the output (cropped) video.

> The default value of out_w is "in_w", and the default value of out_h is 
> "in_h".

> The x and y parameters specify the expressions for the position of the 
> top-left corner of the output (non-cropped) area. They are evaluated for each
> frame.

> The default value of x is "(in_w-out_w)/2", and the default value for y is 
> "(in_h-out_h)/2", which set the cropped area at the center of the input 
> image.


So basically the new version of the ffmpeg crop filter allows you to do
similar things as you can do with Cinelerra's "camera" and "projector",
including some kind of "automation", i.e. letting the crop window move
as the video proceeds.


So, let's try just to describe what this operation does.

We have an input image with size (in_w, in_h).
>From this input image, we cut an crop window. The resulting image
will have a size of (out_w, out_h), and its upper left corner will
be located *in the original image* at position (x,y)


Please understand that this "crop" filter will *not scale* the image
in any way. This is a good thing, because it gives you full control.

Regrading this scaling, we need to be very precise, because there are
a lot of options, and each of them affects quality. You can scale
*before* cropping or *after* cropping. And, in addition to scaling
you can specify an aspect ratio, which means that the *player* of
you video will have to do an additional stretch scaling to match
the desired aspect ratio.

When you do scaling in high quality, this means using some kind of
interpolation. Inevitably this means "low pass filtering", which
will reduce sharpness. This effect is more evident when up scaling
(enlarging), because on downscaling, you'll remove information
anyway, and this loss of information typically obscures the fact
that you're also loosing sharpness.

Thus, if you want optimally brilliant high quality, frequently
you need some kind of *sharpening* to compensate for this loss.
There is no one-size fits-all solution, because sharpening always
introduces artefacts. A good practical trick is to apply a well
dosed sharpening *before* the scaling operation. Adding a small
homoeopathic amount of noise after the sharpening and before
the scaling often works wonders.


> I often have .mpg video (ntsc North America) that has video 720X480 (the DVD
> standard) which has an aspect ration of 4:3. However, the part of interest 
> is 16:9 centred vertically. I want to convert so that it is still 720X480, 
> but with an aspect ration of 16:9. This means that the top and bottom must be
> cropped and then the resulting video expanded (or enlarged) to fill the 
> entire 16:9 720X480 frame.  I would like to do this with high quality so I 
> would want a bitrate of at least 6,000 (but 8,500 would probably be better).

Indeed, I did similar stuff quite often.
First off, let's keep out the bitrate out of the equation.
Bit rate has to do with encoding. Encoding always destroys quality.
Yet the cropping scaling is done in the ffmpeg pipeline always on
raw uncompressed video, and re-encoding is done as last step.

If you want uttermost quality, use raw video (don't re-encode at all
and get yourself an appropriate huge storage array) :-P

As a compromise, use a codec for the target format which imposes just
a tiny bit of compression. Like e.g. MJPEG. Next best option IMHO is
to encode the resulting video in H264, with high quality settings.
This is some kind of a black art or science on its own.

Having said that -- first off, we need to do the cropping and scaling.

 * crop out an window with 16:9 aspect, appropriate positioned in the
   original image window. For optimum quality this would mean only
   chopping off something vertically.
 * then, after the crop filter, add a scale filter which stretches
   the resulting (cropped, smaller) image again out to full image
   height.
 * specify an aspect ratio of 16:9 (this doesn't alter the image,
   just adds a note for the decoder, which will then stretch the
   image out horizontally on playback.



hope that helps
Cheers,
Hermann V.



_______________________________________________
Cinelerra mailing list
Cinelerra@skolelinux.no
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra

Reply via email to