[libav-api] Encoding GRAY8 to MJPEG

Joan Charmant jcharmant at gmail.com
Sat Nov 15 23:55:26 CET 2014


Hello

I have an input stream in GRAY8 color space (also called Y800, Y8 or GREY
elsewhere) that I would like to encode to MJPEG (inside MP4).

In my understanding there is no technical limitation for an MJPEG encoder
to directly compress GRAY8 samples. The JPEG standard allows it and the
libjpeg-turbo that I considered earlier can take these samples directly.
Since I have samples coming in grayscale, I would have liked to avoid an
unnecessary color space conversion and probable suboptimal compression
speed and ratio.

However, when I try to open the MJPEG encoder having specified
AV_PIX_FMT_GRAY8 as pixel format, it fails with -1. It works fine when
specifying AV_PIX_FMT_YUV420P, so I did add the extra color conversion as a
workaround for now.

Am I correct in my understanding that currently the MJPEG encoder does not
support GRAY8 pixel format as input? Or is there something else I need to
do to make it work?

Thank you,
Joan.


More information about the libav-api mailing list