ITADN

heif-dec corrupts colors of original Sony camera .HIF file when converting to any output format

#1770Open800jkm 创建于 2026-04-23
8
800jkmcommented
Using latest version of libheif and heif-dec 1.21.2 libheif: 1.21.2 plugin path: /opt/homebrew/lib/libheif Input file: https://securedownload.us/day/JAM07897.HIF (too big to upload) heif-dec JAM07897.HIF File contains 1 image decoding image... 100% Written to JAM07897.jpg Output file: <img width="6336" height="9504" alt="Image" src="https://github.com/user-attachments/assets/8c9352af-355d-4843-8424-3dec31e71fc8" /> As you can see, the colors are completely different. Blacks/darks are lost in the output JPEG file and reds look garish and unnatural. Other tools like ffmpeg convert the file perfectly to JPEG. This same issue happens regardless of the output format I use for heif-dec. I have also used C bindings for libheif and the same issue occurs. I think this is a bug. For comparison, here's the expected result, produced by ffmpeg ffmpeg -i JAM07897.HIF JAM07897-ffmpeg.jpg ffmpeg version 8.1 Copyright (c) 2000-2026 the FFmpeg developers built with Apple clang version 21.0.0 (clang-2100.0.123.102) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg-full/8.1_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-libplacebo --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --enable-whisper --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon libavutil 60. 26.100 / 60. 26.100 libavcodec 62. 28.100 / 62. 28.100 libavformat 62. 12.100 / 62. 12.100 libavdevice 62. 3.100 / 62. 3.100 libavfilter 11. 14.100 / 11. 14.100 libswscale 9. 5.100 / 9. 5.100 libswresample 6. 3.100 / 6. 3.100 [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #0: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #1: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #2: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #3: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #4: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #5: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #6: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #7: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #8: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #9: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #10: not enough frames to estimate rate; consider increasing probesize [in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0xa1d01c000] Stream #11: not enough frames to estimate rate; consider increasing probesize Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'JAM07897.HIF': Metadata: major_brand : heix minor_version : 0 compatible_brands: mif1heixmiafMiHAjpegSHIF Duration: N/A, start: 0.000000, bitrate: N/A Stream group #0:0[0xa]: Tile Grid: hevc (Rext) (hvc1 / 0x31637668), yuv422p10le(tv, bt470bg/bt709/iec61966-2-1), 9504x6336 (default) Side data: EXIF metadata: (94198 bytes) Display Matrix: rotation of 90.00 degrees Stream #0:9[0xb]: Video: hevc (Rext) (hvc1 / 0x31637668), yuv422p10le(tv, bt470bg/bt709/iec61966-2-1), 1664x1088, 1 fps, 1 tbr, 1 tbn Side data: Display Matrix: rotation of 90.00 degrees Stream #0:10[0xc]: Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(tv, bt470bg/bt709/iec61966-2-1), 320x256, 1 fps, 1 tbr, 1 tbn Side data: Display Matrix: rotation of 90.00 degrees Stream #0:11[0xd]: Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj422p(pc, bt470bg/unknown/unknown), 160x120, 1 fps, 1 tbr, 1 tbn Stream mapping: Stream #0:0 (hevc) -> xstack Stream #0:1 (hevc) -> xstack Stream #0:2 (hevc) -> xstack Stream #0:3 (hevc) -> xstack Stream #0:4 (hevc) -> xstack Stream #0:5 (hevc) -> xstack Stream #0:6 (hevc) -> xstack Stream #0:7 (hevc) -> xstack Stream #0:8 (hevc) -> xstack xstack:default -> Stream #0:0 (mjpeg) Press [q] to stop, [?] for help Output #0, image2, to 'JAM07897-ffmpeg.jpg': Metadata: major_brand : heix minor_version : 0 compatible_brands: mif1heixmiafMiHAjpegSHIF encoder : Lavf62.12.100 Stream #0:0: Video: mjpeg, yuv444p(pc, bt470bg/unknown/unknown, progressive), 6336x9504, q=2-31, 200 kb/s, 1 fps, 1 tbn Metadata: encoder : Lavc62.28.100 mjpeg Side data: EXIF metadata: (94198 bytes) CPB properties: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A [image2 @ 0xa1d01c500] The specified filename 'JAM07897-ffmpeg.jpg' does not contain an image sequence pattern or a pattern is invalid. [image2 @ 0xa1d01c500] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image. [out#0/image2 @ 0xa1cc921c0] video:1268KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown frame= 1 fps=0.0 q=8.0 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=2.72x elapsed=0:00:00.36 <img width="6336" height="9504" alt="Image" src="https://github.com/user-attachments/assets/04faeecf-4674-4fb1-86e3-a426d8734a2c" /> As you can see, the ffmpeg output JPEG has identical colors to the original HIF file.
21 条评论