Opened 2 years ago

Closed 11 months ago

#11170 closed enhancement (fixed)

Support merging HEIC tile grids in ffmpeg

Reported by: markshw2222 Owned by:
Priority: wish Component: ffmpeg
Version: git-master Keywords:
Cc: markshw2222, MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

Summary of the bug:
How to reproduce:
ffmpeg -i input.heic output.png

Attachments (1)

IMG_4765.HEIC​ (2.3 MB ) - added by markshw2222 2 years ago.

Change History (6)

by markshw2222, 2 years ago

Attachment: IMG_4765.HEIC​ added

comment:1 by James, 2 years ago

Resolution: → invalid
Status: new → closed
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_4765.HEIC':
  Metadata:
    major_brand     : heic
    minor_version   : 0
    compatible_brands: mif1MiHEMiPrmiafMiHBheic
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream group #0:0[0x31]: Tile Grid: hevc (Main Still Picture) (hvc1 / 0x31637668), yuvj420p(pc, smpte170m/smpte432/bt709), 4032x3024 (default)
  Stream #0:48[0x32]: Video: hevc (Main Still Picture) (hvc1 / 0x31637668), yuvj420p(pc, smpte170m/smpte432/bt709), 320x240, 1 fps, 1 tbr, 1 tbn
      Side data:
        ICC Profile
  Stream #0:49[0x33]: Video: hevc (Rext) (hvc1 / 0x31637668), gray(pc), 2016x1512, 1 fps, 1 tbr, 1 tbn
      Side data:
        ICC Profile
Stream mapping:
  Stream #0:49 -> #0:0 (hevc (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'heic.png':
  Metadata:
    major_brand     : heic
    minor_version   : 0
    compatible_brands: mif1MiHEMiPrmiafMiHBheic
    encoder         : Lavf61.8.100
  Stream #0:0: Video: png, gray(pc, progressive), 2016x1512, q=2-31, 200 kb/s, 1 fps, 1 tbn
      Metadata:
        encoder         : Lavc61.20.100 png
      Side data:
        ICC Profile

See the "Stream #0:49". By default, ffmpeg chooses the gray 2016x1512 hevc stream if you don't set manual maps.

comment:2 by James, 2 years ago

Component: undetermined → ffmpeg
Priority: normal → wish
Resolution: invalid
Status: closed → reopened
Summary: transcoding of HEIC images results in black/white image → Support merging HEIC tile grids in ffmpeg
Type: defect → enhancement
Version: unspecified → git-master

Upon further inspection, the gray stream should not be selected by default by the CLI as it's the HDR gainmap.

Changing this to a feature request to merge and output the main image, and tag the HDR gainmap as such.

comment:3 by dkode, 2 years ago

One way is

Get grid info

ffprobe -loglevel trace input.heic 2>&1 | grep  grid_row

Extract grid images

 ffmpeg -i input.heic -map 0 output_%d.png

Then
Merge

ffmpeg -i pngs/output_%d.png -vf "tile=8x6" final_output.png

comment:4 by MasterQuestionable, 20 months ago

Analyzed by developer: set
Cc: MasterQuestionable added
Last edited 20 months ago by MasterQuestionable (previous) (diff)

comment:5 by James, 11 months ago

Resolution: → fixed
Status: reopened → closed
Note: See TracTickets for help on using tickets.