Opened 2 years 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

Description

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:
https://github.com/ImageMagick/ImageMagick/issues/4874

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 2022-05-02-git-40f2ea971f-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev10, Built by MSYS2 project)

Input #0, avi, from '.\gray.avi':
  Metadata:
    IVER            : 0.23.0.20170
  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':
  Metadata:
    IVER            : 0.23.0.20170
    ISFT            : Lavf59.23.100
  Stream #0:0: Video: jpegxl, gray16le(pc, progressive), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn
    Metadata:
      encoder         : Lavc59.27.100 libjxl
./lib/jxl/image_bundle.cc:34: JXL_CHECK: metadata_->color_encoding.IsGray() == c_current.IsGray()

Change History (0)

Note: See TracTickets for help on using tickets.