Giter VIP home page Giter VIP logo

h264-videotoolboxdecoder's Introduction

使用 VideoToolBox 进行 h264 编解码

参考: H264 Encode And Decode Using VideoToolBox

什么是 AVCC, Annex-B

  1. Annex B Annex B is widely used in Live streaming because of its simple format. In this format, it’s common to repeat SPS and PPS periodically preceding every IDR. Thus, it creates random access points for decoder. It gives the ability to join stream which is already in progress.

  2. AVCC AVCC is the common method to store H264 stream. In this format, each NALU is preceded with its length (In big endian).

Introductory image for SPS,PPS, IDR and Non IDR frames.

编码

AVCC -> Annex-B

  1. 输入 CVPixelBuffer , 获得 CMSampleBuffer
  2. 判断是否是 I 帧, 如果是 I 帧, 读取 sps, pps, 写入sps, pps, I 帧
  3. 不是 I 帧,写入 P 帧
  4. 每个 NALU 之前需要添加 start code

解码

  1. 构建 VTDecompressionSessionRef 需要先获取 sps, pps
  2. 给编码器送入 NALU, 用 CMSampleBuffer 来表示
  3. 需要将 NALU 之前需要添加的 start code 替换为该 NALU 的长度,长度需要用大端来表示

h264-videotoolboxdecoder's People

Contributors

yxibng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.