Opened 11 months ago

#9762 new defect

jpegxl: compression of uncompressed 16-bit image data fails

Reported by: toni76 Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: libjxl grayscale
Cc: toni76 Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
I want to convert an uncompressed 16-bit grayscale AVI video file (b16g) with JPEG XL.

Conversion fails silently and results in a 0-byte file, it shows the message:

JXL_CHECK: metadata_->color_encoding.IsGray() == c_current.IsGray()

Tested with multiple input files. Reproduction also works with non-grayscale input files but -pix_fmt gray16le.

This is probably related to libjxl parameterization and this similar issue of ImageMagick:

Note (additional issue): Output to MKV container for 16-bit grayscale fails probably nonsensically with "codec jpegxl is not supported by this format", but using AVI is a proper workaround for me.

How to reproduce:

% ffmpeg -i .\gray.avi -c:v jpegxl -pix_fmt gray16le .\gray_jxl.avi
ffmpeg version Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev10, Built by MSYS2 project)

Input #0, avi, from '.\gray.avi':
    IVER            :
  Duration: 00:04:24.47, start: 0.000000, bitrate: 147451 kb/s
  Stream #0:0: Video: rawvideo (b16g / 0x67363162), gray16be, 640x480, 147456 kb/s, 30 fps, 30 tbr, 30 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> jpegxl (libjxl))
Press [q] to stop, [?] for help
Output #0, avi, to '.\gray_jxl.avi':
    IVER            :
    ISFT            : Lavf59.23.100
  Stream #0:0: Video: jpegxl, gray16le(pc, progressive), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn
      encoder         : Lavc59.27.100 libjxl
./lib/jxl/ JXL_CHECK: metadata_->color_encoding.IsGray() == c_current.IsGray()

Change History (0)

Note: See TracTickets for help on using tickets.