【问题标题】:Get YUV420 bytes from JCodec Picture从 JCodec 图片中获取 YUV420 字节
【发布时间】:2014-10-13 20:27:55
【问题描述】:

使用 H264Decoder 我想以 Java 字节数组的形式获取解码后的 YUV420 数据。我已经搜索了所有内容,但没有看到任何适合的示例。

ByteBuffer buf = ByteBuffer.wrap(h264EncodedByteArray); H264Decoder 解码器 = new H264Decoder(); // 假设解码器上设置了sps和pps 图片输出 = Picture.create(320, 240, ColorSpace.YUV420); 图片真实 = decoder.decodeFrame(buf, out.getData());

“h264EncodedByteArray”是来自流或文件的 h264 编码字节数组。

【问题讨论】:

    标签: java h.264 jcodec


    【解决方案1】:

    据我所知,在进行解码时必须提供 buf 和 avcC 框。在开始任何解码之前,您必须提供 avcC 数据。

    AvcCBox avcCBox = new AvcCBox(); avcCBox.parse(buf);

    avcC创建完成后,可以使用下面一行来获取图片。

    解码器.decodeFrame(H264Utils.splitMOVPacket(buf, avcCBox), out.getData());

    在上面的代码中,buf 可能包含也可能不包含多个 NAL 元素。

    【讨论】:

      猜你喜欢
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-23
      相关资源
      最近更新 更多