Bug 520669 - FFMpeg cannot render HDR animations.
Summary: FFMpeg cannot render HDR animations.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (other bugs)
Version First Reported In: 5.3.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-05-26 09:10 UTC by wolthera
Modified: 2026-06-15 08:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Sample hdr animation file. (1.55 MB, application/x-krita)
2026-05-26 09:10 UTC, wolthera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wolthera 2026-05-26 09:10:58 UTC
Created attachment 192614 [details]
Sample hdr animation file.

DESCRIPTION
I can't render h.625 with HDR anymore.

STEPS TO REPRODUCE
1. Have HDR animation.
2. Try to render as h.625 with profile main10
3. Get error saying it failed.

LOG:

/usr/bin/ffmpeg -hide_banner -y -y -r 4 -start_number 0 -start_number_range 1 -i /home/wolthera/krita/krita-auto-2/persistent/frame%04d.png -colorspace bt2020c -color_trc smpte2084 -color_primaries bt2020 -c:v libx265 -crf 23 -preset medium -profile:v main10 -pix_fmt yuv420p10le -x265-params master-display=R(35399,15999)G(13250,34499)B(7499,2999)WP(15634,16450)L(10000000,50):max-cll=1000,100:colorprim=bt2020:colormatrix=bt2020c:transfer=smpte2084:range=full /home/wolthera/krita/krita-auto-2/persistent/hdr_gem_2_anim_3frames.mkv
=====================================================
Input #0, image2, from '/home/wolthera/krita/krita-auto-2/persistent/frame%04d.png':
  Duration: 00:00:00.12, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba64be(pc, gbr/unknown/unknown), 512x512 [SAR 23622:23622 DAR 1:1], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> hevc (libx265))
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
Link 'Parsed_null_0.default' -> 'auto_scale_0.default':
  src: rgba64be
  dst: rgba64be
[vf#0:0 @ 0x5f1685a093c0] Error reinitializing filters!
[vf#0:0 @ 0x5f1685a093c0] Task finished with error code: -38 (Function not implemented)
[vf#0:0 @ 0x5f1685a093c0] Terminating thread with return code -38 (Function not implemented)
[vost#0:0/libx265 @ 0x5f1685a08200] [enc:libx265 @ 0x5f1685a08b80] Could not open encoder before EOF
[vost#0:0/libx265 @ 0x5f1685a08200] Task finished with error code: -22 (Invalid argument)
[vost#0:0/libx265 @ 0x5f1685a08200] Terminating thread with return code -22 (Invalid argument)
[out#0/matroska @ 0x5f1685a07e80] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A elapsed=0:00:00.03    
Conversion failed!
Comment 1 wolthera 2026-05-26 09:12:56 UTC
This happens in both 5.3.1 and nightlies.
Comment 2 wolthera 2026-05-26 09:26:39 UTC
Same error happens when loading HDR video files.
Comment 3 wolthera 2026-05-26 09:33:31 UTC
I get the impression it's somehow related to hardware decoders.

Maybe we should just implement AV1 instead? https://trac.ffmpeg.org/wiki/Encode/AV1 and https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md
Comment 5 wolthera 2026-05-28 15:41:07 UTC
ok, found a solution: bt2020c isn't supported anymore, only bt2020nc... Need to double check whether that's the only problem.
Comment 6 Bug Janitor Service 2026-05-29 07:21:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2806
Comment 7 Dmitry Kazakov 2026-06-15 08:52:01 UTC
Git commit a1e0136f2e48ad6d0e7a22e5d5a3af034ef287fe by Dmitry Kazakov, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 15/06/2026 at 08:51.
Pushed by dkazakov into branch 'master'.

Fix FFmpeg 7.0+ to render HDR animations

We shoudl use non-constant luminance coefficients so
newer ffmpeg will render hdr animations.

Also fix the order of the mastering display info.

Related FFmpeg issue:
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20546

M  +2    -2    libs/ui/animation/KisHDRMetadataOptions.cpp
M  +1    -1    libs/ui/animation/VideoExportOptionsDialog.cpp

https://invent.kde.org/graphics/krita/-/commit/a1e0136f2e48ad6d0e7a22e5d5a3af034ef287fe
Comment 8 Dmitry Kazakov 2026-06-15 08:52:30 UTC
Git commit b56509cb2ada05ef2dd1f5711c8181b9875b711c by Dmitry Kazakov, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 15/06/2026 at 08:52.
Pushed by dkazakov into branch 'krita/6.0'.

Fix FFmpeg 7.0+ to render HDR animations

We shoudl use non-constant luminance coefficients so
newer ffmpeg will render hdr animations.

Also fix the order of the mastering display info.

Related FFmpeg issue:
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20546

M  +2    -2    libs/ui/animation/KisHDRMetadataOptions.cpp
M  +1    -1    libs/ui/animation/VideoExportOptionsDialog.cpp

https://invent.kde.org/graphics/krita/-/commit/b56509cb2ada05ef2dd1f5711c8181b9875b711c