A Guide to Cropping

Discuss about generic usage of MediaCoder.

Moderator: HuggiL

Posts: 3116
Joined: Tue Jun 23, 2009 2:45 pm
Location: Sydney, Australia

A Guide to Cropping

Post by meRobs » Mon Dec 28, 2009 2:09 pm

[updated 26 Nov 2010]

To discuss cropping we need to make a distinction between the size of the video Frame, which holds all the video data as pixels, and how it appears when viewed (played). We also need to mention its “Aspect Ratio”. For example, consider Standard Definition video. Regardless of whether the clip is intended for Standard viewing (4:3) or Widescreen (16:9), a PAL video Frame is always 720 pixels in width and 576 pixels high, as expressed by its Resolution, 720x576. And in MediaCoder the frame size in pixels is expressed as 'Resize' (on the Picture tab).

Notice that the Frame width is 1.25 times its height – there are 25% more pixels in the width than the height. This fact is expressed by the Frame Aspect Ratio (FAR), which is Width:Height = 720:576 = 1.25:1. However, when the video is viewed, it will appear wider than this (wider for 16:9 than for 4:3). Its Displayed Aspect Ratio (DAR) will be 16:9 = 1.777 or 4:3 = 1.333. This issue is discussed in more detail in another Topic, see … viewtopic.php?f=17&t=8197&start=0).

In General
Cropping is available on the Picture tab via the Crop button, on the left, the Crop panel (with drop-down menu) and the Cropper button at right. The 'Crop' button opens a settings window that affects the Edge Coordinates mode (Section 5), the Crop panel menu offers a number of options, which are described in Sections 1 to 5, and 'Cropper' opens the Easy Cropper window that allows manual adjustment of the crop area. However, this window doesn't function in all MediaCoder builds, as may be seen in section 1 of: viewtopic.php?f=17&t=9577&start=0.
The Crop panel offers:
1. Disabled
2. Manual: this opens the Easy Cropper window (Fig. 1), as does the “Cropper” button
3. Expand to fit
4. Crop to fit
5. Edge Coordinates

The default position in MediaCoder is for cropping to be disabled (section 1, below). If you wish or have the need to crop, the simplest options are to use 'Expand to Fit' (section 3) or 'Crop to Fit' (section 4). For example, if the reason for cropping is that your video is wider than the frame set for conversion, under Resize, and you want it to sit centrally with the excess width cropped, it would be far easier to select Crop = 'Crop to Fit' and Keep PAR (usually). All done with one click!

1. Crop Disabled
By default, the Picture tab will show 'Crop' = Disabled and 'Aspect Ratio' = Keep DAR. In this case, all content of the original Frame, regardless of its size (resolution), will be scaled to just fit the new Frame, as defined by “Resize” on the Picture tab. That is, both the height and width of the Original Frame will be independently scaled to that of the new frame, as defined by 'Resize'. This may require a relative stretch of either the width or the height. This may not matter, depending on the setting for “Aspect Ratio”, also located on the Picture tab, a feature described in another Topic … viewtopic.php?f=17&t=8197&start=0

2. Manual Cropping
When dealing with Manual cropping we need concern ourselves only with the Frame – its original size (resolution) and that of the new frame, defined by “Resize”.

Manual cropping a video allows you to remove unwanted material from the edges or to select a particular area within the original frame that you want to fill the new frame. This is done on the Picture tab by clicking the Cropper button, which opens the Easy Cropper window (see Fig. 1). It is also accessible when choosing a device via UI Plugins from the Features menu (Toolbar). The behaviour of the Cropper, as described here refers to build 4582; and in other builds things may happen differently (see Note 3, below). The principles, however, are the same.

When the Easy Cropper first opens, a number of parameters will be evident across the top of its window (you may need to drag the window wider to see all):
* Mode = Keep Aspect Ratio (others: Free Cropping, Auto Detect and Fix Height or Width)
* Coordinate = x:y:W:H, where (x,y) is the position of the top left corner of the video relative to that of the Crop rectangle, and W x H pixels is the Resolution of the selected area.
* Display Scale = 1:1 (also: 2:1, 3:1, etc, for scaling the video down)
* Aspect Ratio (Properties) = W ÷ H for the Crop area (white rectangle in Fig. 1).


Note that the video file is displayed in the Cropper without applying its Pixel Aspect Ratio, i.e., all pixels of the Original Frame are present as 'square' pixels and only those within the white Crop rectangle are visible. The resolution, given by W:H in the Coordinates, the “Aspect Ratio” and the Crop Rectangle all relate to the Original Frame. For example, a 16:9 VOB file will appear horizontally squashed because the 'rectangular' PAR had not been applied. This doesn't matter in this context, what matters is how it relates to the white Crop rectangle that sits on top.

Depending on the Build , one or more of the values or settings first shown in the Cropper may be inappropriate (Note 3, below). In any case, a safe procedure would be to:
1. select Mode = Auto Detect, to display the correct values of Resolution and Aspect Ratio
2. select Mode = Free Cropping and drag the Crop area to any desired Resolution (given in the Coordinates) or Aspect Ratio – remember that the 'Crop area' represents what will be in the final (output) frame
3. If a specific Aspect Ratio is required, choose it in step 2, then select Mode = Keep Aspect Ratio and drag to the required size
4. Drag the video image 'under' the Crop area to achieve the desired degree of cropping.
5. If the video is to be centred under the Crop Area, adjust the 'x' and 'y' values in Coordinates. For example, if the video is too wide, x will be equal to 0 when its left edge is aligned with that of the Crop Area, so, drag the video to align its right edge with the right edge of the Crop Area, read the value of x and move the video to halve it.
6. Finally, hit Done, at top right. The final coordinates will be shown on the Picture tab to the right of the Crop button.

Once the conversion takes place, the chosen crop area for the video will be scaled up or down to just fill the frame defined by the Resize values set on the Picture tab. The x and y dimensions will be scaled independently, for example, the width may be stretched and the height reduced!

However, the final appearance will depend on the setting for “Aspect Ratio”, located on the Picture tab. The default here is 'Keep DAR', which may suit most applications. The choices for aspect ratio, their meanings and how they are interpreted is discussed in the Topic: … viewtopic.php?f=17&t=8197&start=0

Note 1: I have tried the above procedure on VOB, AVI and FLV files in both PAL and NTSC. It is likely to work for other types as well.

Note 2: it works for an IFO file from a DVD Title. Use of the IFO is a preferred method for DVD conversion (see viewtopic.php?f=17&t=8082&start=0)

Note 3: the Cropper in build 4399 worked well, opening with Free Cropping set and the correct values of W:H and Aspect Ratio. For build 4526, it was not possible to drag the left edge of the video further to the left than the crop area. Build 4582 usually opens with incorrect values for the resolution and aspect ratio. Other builds may have their idiosyncrasies and those builds that crop successfully are indicated in the Test Report: viewtopic.php?f=17&t=9611.

3. Expand to Fit
When this Crop option is chosen on the Picture tab, and Keep Pixel Aspect ratio is also selected, the original frame will be uniformly scaled until the video just fits into the new frame, and will result in black bands if the display aspect ratio of the original differs from that of the new. This feature is illustrated in Fig. 2. For further comment, see: … viewtopic.php?f=17&t=8197&start=0

4. Crop to Fit
If this option is set, and Keep Pixel Aspect ratio is also selected, the original frame will be uniformly scaled, beyond that required for Expand to Fit, until the new frame is just full. The video will be centred and any excess beyond the frame will be cropped (see Fig. 2). For further comment, see: … viewtopic.php?f=17&t=8197&start=0


5. Edge Coordinates
The Edge Coordinates mode is controlled by settings set in the window that is opened on clicking the Crop button. Here, there are choices for Left, Right, Width, Height and Pixels to right and left edge. Since I found these unintuitive to use, I leave them to you to fathom, or me at a later time!
Have you checked out the Tips & Guides for MediaCoder? Try: http://forum.mediacoderhq.com/viewtopic.php?f=17&t=8061
Also, get older builds at: http://www.videohelp.com/tools/MediaCoder/old-versions#download