Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Add support for JpegXL and Jpeg2000 decoding/encoding #99

Open
1 task done
iyesin opened this issue Jan 3, 2025 · 2 comments
Open
1 task done

[FEAT] Add support for JpegXL and Jpeg2000 decoding/encoding #99

iyesin opened this issue Jan 3, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@iyesin
Copy link

iyesin commented Jan 3, 2025

Is this a new feature request?

  • I have searched the existing issues

Wanted change

I wanted to use this docker image to validate my benchmarks on newer (then supplied in Debian 12) version of ffmpeg and librav1e. The source files for a benchmark are 12bpp lossless samples in JpegXL (.jxl) and Jpeg2000 (.jp2) formats.

Reason for change

Unfortunately, benchmark script failed with a following error:

[image2 @ 0x5654dfbd87c0] Could not find codec parameters for stream 0 (Video: jpegxl, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #1, image2, from 'DSC_0%03d.jxl':
  Duration: 00:00:02.40, start: 0.000000, bitrate: N/A
  Stream #1:0: Video: jpegxl, none, 25 fps, 25 tbr, 25 tbn
[vist#1:0/jpegxl @ 0x5654dfbd9640] Decoding requested, but no decoder found for: jpegxl
Error opening output file bench_02_hd_av1_rav1_speed5_10bpp.mp4.
Error opening output files: Invalid argument

I tried to include apt update && apt -y install libjxl0.7 as a command before executing ffmpeg itself, but the result was the same.

Proposed code change

Add pre-built most recent version of JpegXL (library and headers) to a build step.

# Add Luca Versari's (@veluca93) apt repo and the key for it.
# Slightly re-worked instruction from https://artifacts.lucaversari.it/info.txt
gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/libjxl.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA53E543B669CE5743F9E4E1BD565EDA9BB685E6
echo "deb [signed-by=/usr/share/keyrings/libjxl.gpg] https://artifacts.lucaversari.it/libjxl/libjxl/latest/deb/$(lsb_release -cs) /" > /etc/apt/sources.list.d/lijxl.list
apt update
apt install -y libjxl-dev

Add pre-built most recent version of JpegXL library to a runtime step.

gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/libjxl.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA53E543B669CE5743F9E4E1BD565EDA9BB685E6
echo "deb [signed-by=/usr/share/keyrings/libjxl.gpg] https://artifacts.lucaversari.it/libjxl/libjxl/latest/deb/$(lsb_release -cs) /" > /etc/apt/sources.list.d/lijxl.list
apt update
apt install -y libjxl

Add flags for ffmpeg

…
    --enable-cuvid \
+   --enable-decoder=jpeg2000 \
+   --enable-encoder=jpeg2000 \
    --enable-ffprobe \
…
    --enable-libharfbuzz \
+   --enable-libjxl \
    --enable-libkvazaar \
…
@iyesin iyesin added the enhancement New feature or request label Jan 3, 2025
Copy link

github-actions bot commented Jan 3, 2025

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@iyesin
Copy link
Author

iyesin commented Jan 3, 2025

Alternative way of installing libjxl from source described here https://github.com/libjxl/libjxl/blob/main/BUILDING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Issues
Development

No branches or pull requests

1 participant