FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    EasyRTMPClient extension supports HEVC (H.265) solution compatible H264 and H265 frame data analysis detailed explanation

     

    "In the previous two articles on EasyrtmpClient Extension Support HEVC (H.265) solution, we have completed H265 support, this article mainly explains the adaptive compatibility of H26 and H265 support to achieve adaptive compatibility of different video coding formats. Adaptation. 1. Determine the data encoding type according to CODECID Depending on the video encoding ID, if the video encoding ID == flvcodeid_hevc (12), it is determined that the video encoding format is H265, and it is H264 (because we only support the video push of these two coding formats), as follows Down: Parser_videOTAG * Video_TAG = (Parser_VIDEOTAG *) (BUF + PARSER_OFFSET); FLVCODEID Video_CODE_ID = (FLVCodeID) (Video_TAG-> Code_ID & 0x0F); IF (video_code_id == flvcodeid_hevc) { Av_frame.u32avframeflag = easy_SDK_VIDEO_CODEC_H265; // HEVC; } Else { AV_FRAME.U32AVFRAMEFLAG = EASY_SDK_VIDEO_CODEC_H264; / / Default H264, other types need to be judged?!; } 12345678910 2. Data frame head judgment According to the FLV / RTMP extension supports H265 standard, support HEVC's vidEOTAGHEADER definition as shown below: i.e., when codeciD == 12, avcpackettype is HevcPacketType: If HEVCPacketType is 0, that is stored in HEVCVIDEOPACKET HEVC sequence header; if HEVCPacketType 1, showing HEVCVIDEOPACKET is stored HEVC NALU; if HEVCPacketType 2, showing HEVCVIDEPACKET is stored in HEVC end of sequence, i.e. HEVCDecoderConfigurationRecord; When CodeCid == 7, AvcPacketType is AVCPACKETTYPE: If AVCPacketType is 0, that is stored in HEVCVIDEOPACKET AVC sequence header; if AVCPacketType 1, showing HEVCVIDEOPACKET is stored AVC NALU; if AVCPacketType 2, showing HEVCVIDEPACKET is stored AVC end of sequence, i.e. AVCDecoderConfigurationRecord; EasyRTMPClient's resolution function for Sequence Header is shown in the following code segment: INT ParservideosequencePacket (flvcodeid video_code_id, char * buf, int LEN) { INT PARSER_OFFSET = 0; Char * Parser_Config = BUF; IF (video_code_id == flvcodeid_hevc) { IF (len <= sizeof (Parser_hevcdecoderConfigurationRecord)) { Return -1001; } ... ' // Parser HevcdecoderConfigurationRecord ...... RTMPCLIENT_H265_DECODE_SPS ((unsigned char *) SPS_BUF_, SPS_LEN_, Width_, Height_); } Else { IF (len <= sizeof (Parser_AVCDecoderHead)) { Return -1001; } ... ' // Parser HevcdecoderHeader ...... RTMPCLIENT_H264_DECODE_SPS ((unsigned char *) SPS_BUF_, SPS_LEN_, WIDTH_, HEIGHT_); } Return 0; } 1234567891011121314151617181920212223242526272829 3. Video Data Frame Data NALU Type Judgment According to the FLV / RTMP extension support protocol standard, supporting H265's videotagbody is defined as follows, and the extended videoagbody is shown below (red font for HEVC) :: When the CODECID is 12, the VIDEOTAGBODY is stored in the HEVC video frame content. EasyRTMPClient video frame NALU parses the following code: INT PARSERONEVIDEONALU (EasyrtmpClient_AV_FRAME & AV_FRAME, CHAR * BUF, INT LEN, Char * ProcessBuf) { IF (ProcessBuf == Null || buf == null || LEN == 0) { Return-3001; } IF (SPS_LEN_ == 0 || PPS_LEN_ == 0) { Printf ("Do Not get Sequence Head Yet \ n" "); Return-3002; } INT parse_offset = 0; INT NALU_LEN = 0; INT NALU_TYPE = 0; INT processlen = 0; While (PARSE_OFFSET > 1) & 0x3f; IF (NALU_TYPE == E_H265_NAL_UNIT_VPS) { Ask_PARSER (NALU_LEN, MAX_VPS_LEN); Memcpy (VPS_BUF_, BUF + PARSE_OFFSET, NALU_LEN); VPS_LEN_ = NALU_LEN PARSE_OFFSET + = NALU_LEN CONTINUE; } } else { NALU_TYPE = BUF [PARSE_OFFSET] & 0x1F; } // H265 and H264 SPS head analysis is compatible IF ((av_frame.u32avframeflag == easy_SDK_VIDEO_CODEC_H265 && NALU_TYPE == E_H265_NAL_UNIT_SPS) || AV_FRAME.U32AVFRAMEFLAG == easy_SDK_VIDEO_CODEC_H264 && NALU_TYPE == E_H264_FRAME_TYPE_SPS) { AskERT_PARSER (NALU_LEN, MAX_PPS_LEN); Memcpy (SPS_BUF_, BUF + PARSE_OFFSET, NALU_LEN); SPS_LEN_ = NALU_LEN PARSE_OFFSET + = NALU_LEN IF (width_ == 0 && SPS_LEN_> 0) { IF (av_frame.u32avframeflag == easy_SDK_VIDEO_CODEC_H265) RTMPCLIENT_H265_DECODE_SPS ((unsigned char *) SPS_BUF_, SPS_LEN_, Width_, Height_); Else RTMPCLIENT_H264_DECODE_SPS ((unsigned char *) SPS_BUF_, SPS_LEN_, WIDTH_, HEIGHT_); } CONTINUE; } // h265 and H264 PPS head analysis is compatible Else IF ((av_frame.u32avframeflag == easy_SDK_VIDEO_CODEC_H265 && NALU_TYPE == E_H265_NAL_UNIT_PPS) || AV_FRAME.U32AVFRAMEFLAG == EASY_SDK_VIDEO_CODEC_H264 && NALU_TYPE == E_H264_FRAME_TYPE_PPS) { Memcpy (PPS_BUF_, BUF + PARSE_OFFSET, NALU_LEN); PPS_LEN_ = NALU_LEN PARSE_OFFSET + = NALU_LEN CONTINUE; } // h265 and H264 I frame parsing compatible ELSE IF ((av_frame.u32avframeflag == easy_SDK_VIDEO_CODEC_H265 && NALU_TYPE> = E_H265_NAL_UNIT_SLICE_BLA && NALU_TYPE <= E_H265_NAL_UNIT_SLICE_CRA) || AV_FRAME.U32AVFRAMEFLAG == EASY_SDK_VIDEO_CODEC_H264 && NALU_TYPE == E_H264_FRAME_TYPE_IDR) { IF (av_frame.u32avframeflag == easy_SDK_VIDEO_CODEC_H265) { Memcpy (ProcessBuf + Processlen, NALU_HEAD_, 4); PROCESSLEN + = 4; Memcpy (ProcessBuf + Processlen, VPS_BUF_, VPS_LEN_); PROCESSLEN + = VPS_LEN_; } ....... // Copy SPS and PPS and Idr NALU ...... Av_frame.u32vframetype = easy_SDK_VIDEO_FRAME_I; CONTINUE; } // h265 and H264 P frame analysis compatible ELSE IF ((av_frame.u32avframeflag == easy_sdk_video_codec_h265 && nalu_type> = E_H265_NAL_UNIT_SLICE_TRAIL_R && NALU_TYPE <= E_H265_NAL_UNIT_SLICE_TFD) || AV_FRAME.U32AVFRAMEFLAG == Easy_SDK_Video_CODEC_H264&&nalu_type == e_H264_Frame_Type_Slice) { memcpy(processbuf + processlen,nalu_head_,4); processlen += 4; memcpy(processbuf + processlen,buf + parse_offset,nalu_len); processlen += nalu_len; parse_offset += nalu_len; av_frame.u32VFrameType = EASY_SDK_VIDEO_FRAME_P; continue ; } else { parse_offset += nalu_len; continue; } } av_frame.pBuffer = (uint8_t *)processbuf; av_frame.u32AVFrameLen = processlen; return 0; }

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us