-
Notifications
You must be signed in to change notification settings - Fork 47
Move & Crop Dialog
BDSup2Sub 2.7 introduced a feature to move all captions outside/inside certain bounds. The idea is to either move the captions outside the visible cinemascope picture (to not cover parts of the picture) or to move them completely inside the picture to e.g. use a 21:9 screen without losing the captions. The implemented algorithm is pretty simple: captions that are completely inside the upper half of the screen are defined as "upper" captions, while those completely inside the lower half of the screen are defined as "lower" captions. Captions that begin in the upper half and end in the lower half are not moved at all.
When moving captions "outside", the upper captions are simply moved to the top of the screen plus a given offset in pixels. The lower captions are moved to bottom of the screen, where again the pixel offset between the bottom of the caption and the bottom of the screen is kept.
When moving captions "inside", it's important to define the correct target picture aspect ratio. E.g. if you want to move the captions inside a 21:9 picture, you need to select a aspect ratio 2.33 (or push the button labeled "21:9"). Now the upper captions are positioned offset pixels below the upper border of the 21:9 screen and the lower captions are positioned "Y offset" pixels above the lower border of the 21:9 screen.
Indeed, "inside" and "outside" work pretty much exactly the same apart from the fact that when moving "inside", the screen height is virtually decreased by the given factor.
Since BDSup2Sub 3.9.6 it's also possible to move (all) captions horizontally. You can either move to the left, to the right or center the captions to the middle of the screen,. When moving to the left or to the right, BDSup2Sub will try to keep a minimum distance of "X offset" to the left or right screen border. However, when the caption is too wide, the actual distance to the border might be smaller or even 0.
Implemented due to user request. If a crop offset is defined, the exported Y coordinates will be reduced by the cropping offset. Usually, this should be used in combination with moving captions inside bounds - that's why it's located there in the GUI. Anyway, the crop offset is also the minimum Y coordinate for exported captions. E.g. if the crop offset is 100, all captions with a higher Y coordinate will be moved up by 100 pixels and captions with Y <= crop offset will have an Y coordinate of 0 after the export. The crop offset will be displayed as red line in all preview windows. It can be reset to 0 (without moving captions) by using the according menu command (reset crop offset).
Since 3.0.1, the crop offset is assumed to be symmetrical. Hence two red lines are displayed and also the maximum Y coordinate is reduced to fit into the cropped screen. Now also the screen size in exported IDX or SUP files is reduced by 2Crop Offset Y. E.g. if the target resolution is 1080p without cropping and you select a crop offset of 100, the resulting screen size is 1920880.
In some subtitle streams the images that contain the captions are much larger than it would be necessary. Indeed, in some cases, the image is as large as the whole screen area (e.g. 720x576 for PAL). While this doesn't really matter when just displaying the stream, it makes certain features of BDSup2Sub unusable (e.g. moving captions). Since I saw this only happen in VobSubs, SUP/IFO and BDN XMLs, BDSup2Sub applies automatic cropping for these input formats. This means that BDSup2Sub crops the first/last lines/columns of each image that don't contain any opaque pixels resulting in an image that contains only the subtitle but no empty border.
Unfortunately, probably due to wrong RGB/YCBCr conversion in certain tools, the transparent color is not fully transparent (i.e. alpha = 0) in some streams, but the alpha value is just very small (e.g. alpha = 7). To work around this, BDSup2Sub defines an "alpha cropping threshold": if a pixel's alpha value is smaller than this threshold, it will be considered invisible. The default value for this threshold is 14, but it can be set (only) via the CLI option "/acrop". Note that setting "/acrop" to 0 disables automatic cropping.
It's worth mentioning that the alpha cropping threshold is also used to decide whether to patch the colors of transparent pixels. Again, when displaying a subtitle stream, it doesn't matter if a fully transparent pixel is yellow or black. For scaling this matters though, as all 4 components (alpha, r ,g ,b) are used to determine a new color/alpha value. Now if all transparent pixels are yellow instead of black, the pixels at the outer border of each character will get a yellow tint. To avoid this effect, BDSup2Sub patches all colors with an alpha value smaller than the alpha cropping threshold to be (transparent) black. Note that if you disable automatic cropping by setting the alpha cropping threshold to 0, this also disables palette patching and might lead to a color tint when scaling.
BDSup2Sub © 2009 Volker Oth, 2011-2013 Miklos Juhasz