简体   繁体   English

转换为JPEG时损坏的HEIC磁贴

[英]corrupted HEIC tile when converting to JPEG

I'm having trouble converting a .HEIC image to a jpeg. 我无法将.HEIC图像转换为jpeg。 The .HEIC file an image taken with an iphone running the latest ios public beta. .HEIC文件使用运行最新ios公共测试版的iphone拍摄的图像。 I'm using the library nokia provided to parse the file and extract the image tiles from the .HEIC file, convert them to jpeg and glue them together using ffmpeg/montage. 我正在使用诺基亚提供解析文件并从.HEIC文件中提取图像切片,将它们转换为jpeg并使用ffmpeg / montage将它们粘合在一起。

There is a bit too much code to paste it all into this question so i put all of it in this github repo . 有太多的代码将它全部粘贴到这个问题中所以我将所有这些都放在这个github仓库中 Its pretty self explanatory and should be runnable with just a few dependencies. 它非常自我解释,只需几个依赖项就可以运行。 They are explained in the repo's README. 它们在repo的自述文件中有解释。 This has all been done on osx btw. 这一切都是在osx btw上完成的。

The .HEIC files contains a 8x6 grid of images(tiles) and if you put them together you get the complete image. .HEIC文件包含8x6网格图像(图块),如果将它们放在一起,您将获得完整的图像。 Simply put whatever image i input the 7th tile is corrupted as shown below and i really don't understand why. 简单地把我输入的任何图像第7个图块损坏如下所示,我真的不明白为什么。 I've filed an issue with nokia, but the repo seems pretty dead and i don't really expect an answer there. 我已经向诺基亚提出了一个问题,但回购似乎已经死了,我真的不希望有答案。

There's a bug in the VPS/SPS/PPS parameter sets in the 7th tile. 第7个瓦片中的VPS / SPS / PPS参数集存在错误。 I have not tracked down if the issue lies in the actual file or in the HEIF parser, but there is a simple workaround in the meantime. 我没有追踪问题是在实际文件中还是在HEIF解析器中,但同时还有一个简单的解决方法。

Refer to HevcImageFileReader::getItemDataWithDecoderParameters and observe how it prepends the parameter sets to the actual item data for each tile. 请参阅HevcImageFileReader :: getItemDataWithDecoderParameters并观察它如何将参数集预先添加到每个图块的实际项目数据中。

All you need to do is read the parameter sets for the first tile and reuse them for subsequent tiles instead of re-reading them. 您需要做的就是读取第一个图块的参数集,然后将它们重新用于后续图块,而不是重新读取它们。 This will work around the corrupt parameters coming from the 7th tile. 这将解决来自第7个瓦片的损坏参数。 It appears safe to do this since this is a grid format and the requirement is that each tile be identical. 这样做似乎是安全的,因为这是一种网格格式,并且要求每个图块都是相同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM