Repository navigation
media: decode HEIC photos with libheif so grid images aren't cropped - #272
Open
iFixRobots wants to merge 3 commits into
Open
iFixRobots wants to merge 3 commits into
iFixRobots wants to merge 3 commits into
Conversation
|
1 potential issue found:
↑ Select any checkbox above to have Indent auto-fix the issue
Select any unchecked box below to run or rerun that agent. Found issues (1)Full resultsIndent Review Agent
|
| // iPhone photos are HEIF grids of tiles. The ffmpeg CLI only decodes the | ||
| // first tile, while libheif assembles the full image. | ||
| var stderr bytes.Buffer | ||
| cmd := exec.CommandContext(ctx, "heif-dec", "--quiet", inputPath, outputPath) |
There was a problem hiding this comment.
🟡 Bug · Converted JPEG now leaks source EXIF/GPS metadata
The old ffmpeg mjpeg output had no EXIF. libheif's JPEG encoder copies the HEIC's EXIF block into the output, resetting Orientation but keeping GPS coordinates and device model, so photos sent to LINE now include location metadata. A malformed EXIF offset also makes heif-dec exit non-zero, which fails the conversion where ffmpeg used to succeed. Strip the EXIF segment from the result, or retry without metadata on failure.
Found by Indent Review Agent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Photos sent from an iPhone show up on LINE as a blurry, zoomed-in corner of the picture.
iPhone HEICs are grids of 512x512 tiles.
convertHEICToJPEGranffmpeg -i x.heic -frames:v 1 … mjpeg, and ffmpeg (7.1.5 and 8.0.1) exposes the grid only as a "Tile Grid" stream group and encodes the first tile stream.-map 0:g:0doesn't change that. The bridge log shows the cropped size:The conversion now uses libheif's
heif-dec, which assembles the grid. If a file holds several top-level images, heif-dec numbers its outputs, and the first one is used. heif-dec also copies the photo's EXIF and XMP (location, device model), which ffmpeg didn't, so every APP1 segment is stripped from the JPEG. The color profile stays. The Dockerfile addslibheif-tools. The megabridge runtime image needslibheif-examplesbefore this rolls out there (beeper/megabridge#88), or HEIC sends will fail.Before / after
convertHEICToJPEGat main vs this branch, same file:Not yet checked with a live send to LINE.
Tag
@indentto continue the conversation here.