简体   繁体   English

HEVC 编码器(从 JPG 转换为 HEIC)

[英]HEVC Encoder (convert from JPG to HEIC)

I have some trouble when converting from JPG to HEIC format (using HEVC Encoding) on Android在 Android 上从 JPG 转换为 HEIC 格式(使用 HEVC 编码)时遇到了一些麻烦

I'm using Nokia HEIF's library ( https://github.com/nokiatech/heif/ ) for parsing data which I need to put some data includes:我正在使用诺基亚 HEIF 的库( https://github.com/nokiatech/heif/ )来解析我需要放置一些数据的数据,包括:

  1. Decoder config data (as a byte array) following the name called by Nokia, I think that data can be profile data, header data, ... that store the VPS/PPS, Exif, metadata...以诺基亚命名的解码器配置数据(作为字节数组),我认为数据可以是配置文件数据,header 数据,......存储VPS / PPS,Exif,元数据......

  2. Image data following the name called by Nokia -> This may is a bitstream of HEVC Encoding.诺基亚调用名称后的图像数据->这可能是HEVC编码的比特流。

So now, I got the image data bitstream (2) based FFMPEG tool by command as bellow: ffmpeg -i oktest.png -crf 12 -preset medium -pix_fmt yuv420p -f hevc.bin所以现在,我通过如下命令得到了基于FFMPEG工具的图像数据比特流(2): ffmpeg -i oktest.png -crf 12 -preset medium -pix_fmt yuv420p -f hevc.bin

This is a referring link from Nokia that they guide how to do feed data and encode to HEIF format.这是来自诺基亚的一个参考链接,他们指导如何进行馈送数据和编码为 HEIF 格式。 https://github.com/nokiatech/heif/issues/44 https://github.com/nokiatech/heif/issues/44

But, I didn't understand how I can get the decoder config data from the FFMPEG tool because I'm developing on Android platforms instead.但是,我不明白如何从 FFMPEG 工具获取解码器配置数据,因为我正在 Android 平台上进行开发。 I mean some definitions are determined different from the mind so I can't find any solutions for this.我的意思是某些定义的确定与头脑不同,所以我找不到任何解决方案。 I already request a ticket to Nokia support, but no response yet.我已经向诺基亚支持请求了一张票,但还没有回复。

        val heif = HEIF()
       val decoderConfig = context.assets.open(bitStreamDecoderConfig).readBytes()
        val decoderConfig = decoderBuffer?.array() ?: ByteArray(0)
        val imageData = FileInputStream(bitStreamData).readBytes()
        val imageItem =
            HEVCImageItem(heif, Size(imageWidth, imageHeight), decoderConfig, imageData)
        heif.primaryImage = imageItem
        heif.majorBrand = HEIF.BRAND_MIF1
        heif.addCompatibleBrand(HEIF.BRAND_HEIC)
        heif.save("$targetOutputFolder/$fileNameNoneExtension.${destinationType()}")

There is a page at http://jpgtoheif.com/ which suggest use ffmpeg itself instead the nokia tool. http://jpgtoheif.com/有一个页面,建议使用 ffmpeg 本身而不是诺基亚工具。

there is another solution libheif with a windows build is at https://github.com/pphh77/libheif-Windowsbinary/releases还有另一个解决方案 libheif 与 windows 构建位于https://github.com/pphh77/libheif-Windowsbinary/releases

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

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