Module Avutil.Display_matrix

The display matrix: the 3x3 transformation a container or a decoder attaches to a video for it to be shown upright, as libavutil/display.h defines it.

type t = private int32 array

Nine fixed-point numbers, row-major.

val of_array : int32 array -> t

of_array a is a copy of a as a matrix.

  • raises Error

    with `Failure when a does not have 9 elements.

val of_payload : string -> t option

of_payload s is the matrix a side-data payload holds: nine 32-bit integers in native byte order. None when s is shorter than that. Frame and packet side data share this layout.

val to_payload : t -> string

The payload of_payload reads back.

val make : ?hflip:bool -> ?vflip:bool -> float -> t

make a is the matrix of a pure rotation by a degrees counter-clockwise, then flipped horizontally and vertically as asked. rotation (make a) is Some a for a in (-180, 180].

  • raises Error

    with `Failure when a is not finite.

val rotation : t -> float option

The angle, in degrees, by which the matrix rotates the picture counter-clockwise, in [-180, 180]. None when the matrix is singular.

type transform = [
  1. | `Transpose of [ `Clock | `Cclock | `Clock_flip | `Cclock_flip ]
  2. | `Hflip
  3. | `Vflip
  4. | `Rotate of float
]

One step that brings a picture upright. It names no filter:

  • `Transpose `Clock is a quarter turn clockwise, `Cclock one counter-clockwise, and the _flip variants add a vertical flip;
  • `Hflip and `Vflip mirror the picture;
  • `Rotate a is a clockwise rotation by a degrees.
val transforms : t -> transform list

transforms m is what must be done to a picture, in order, for it to be shown as m asks, following the decision table of the ffmpeg command-line tool. The empty list means the picture is already upright; a singular matrix gives the empty list.