PictureCrop

data class PictureCrop(val top: Int = 0, val bottom: Int = 0, val left: Int = 0, val right: Int = 0)

Rows and columns at the edges of a stored picture that are not part of the image (#497).

A container can say so: a Matroska track's PixelCrop elements, or an MP4 track's clean aperture. Encoders use it to show 1080 lines of a 1088-line coded picture, cameras to hide sensor margins, and remuxers to hide black bars without re-encoding. FFmpeg reads it and leaves applying it to the player, as mpv and the ffmpeg command line do. The crop inside the bitstream itself, such as an H.264 sequence parameter set's, is a different thing that the decoder has already applied, so a picture never carries that one.

Each count is in stored pixels, taken from the picture as it is stored, before it is mirrored, turned or stretched by its pixel aspect. The size, the display aspect, the fit, the zoom and the subtitles all use what is left.

Constructors

Link copied to clipboard
constructor(top: Int = 0, bottom: Int = 0, left: Int = 0, right: Int = 0)

Properties

Link copied to clipboard
val bottom: Int
Link copied to clipboard

True when the crop takes nothing away.

Link copied to clipboard
val left: Int
Link copied to clipboard
val right: Int
Link copied to clipboard
val top: Int

Functions

Link copied to clipboard
fun fits(width: Int, height: Int): Boolean

True when no count is negative and at least one pixel of a width by height picture is left each way. A crop that does not fit is ignored rather than trusted, with PlaybackWarning.CropIgnored, because it comes from a file and a file can say anything.