ffmpeg 向H.264编码的视频中添加 SEI

  1. SEI NALU数据格式
    1. NALU 类型 1 字节 0x06
    2. SEI 负载类型 1 字节 0x05 (用户自定义数据)
    3. 负载大小(uuid+自定义数据),如果大小 size 大于 255,前 int(size / 255) 个字节都是 FF,最后一个字节是剩余部分
    4. 负载的唯一标志 uuid 16 字节
    5. 自定义数据
  2. 完成 NALU 数据编码

          替换 00 00  为 00 00 03 

  1. ffmpeg 转封装
    1. avformat_open_input
      avformat_alloc_output_context2
      avformat_new_stream
      avcodec_copy_context
      avio_open
      avformat_write_header
      av_read_frame
      av_grow_packet
      av_interleaved_write_frame
      av_free_packet
      av_write_trailer
      avformat_close_input
      avio_close
      avformat_free_context
    2. 添加 SEI 使用 av_grow_packet 后在开头插入 SEI NALU 数据




       

你可能感兴趣的:(ffmpeg,ffmpeg,sei,H.264)