[FFmpeg-devel] [RFC]lavc/mjpegenc_common: Fix aspect ratio

Moritz Barsnick barsnick at gmx.net
Mon Dec 10 18:26:38 EET 2018

On Mon, Dec 10, 2018 at 13:19:57 +0100, Carl Eugen Hoyos wrote:
> >   units (1 byte) Units for the X and Y densities.
> >     units = 0: no units, X and Y specify the pixel aspect ratio
> >     units = 1: X and Y are dots per inch
> >     units = 2: X and Y are dots per cm
> >   Xdensity (2 bytes) Horizontal pixel density
> >   Ydensity (2 bytes) Vertical pixel density
> The "density" (unless they intentionally reversed the meaning of the
> word) is always the inverse of the aspect ratio.

That's what I was wondering as well.

> Did they reverse the meaning in your opinion?
> Does it make sense to argue that if the unit is "0", the meaning of the
> density changes?

That was my interpretation. It's a density, if units != 0, otherwise
the aspect ratio. (Would a density not correspond to the SAR? I.e. not
make sense with square pixels?)

I was wondering what other implementations do? jpglib, *Magick.
Reference images? I didn't find anything quickly, but one may need to
check closer.


More information about the ffmpeg-devel mailing list