FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Introduction to H264 AVC1 in MP4 file

     

    "Transfer from: http://www.mworkbox.com/wp/work/314.html The MP4 video H264 package has 2 formats: H264 and AVC1, which is easily ignored for this detail. The author also encountered the problem when adapting the Live555 streaming media, increasing the MP4 file type support. (1) First, learn from the principle of this two formats: AVC1 Description: H.264 BitStream WitHout Start Codes. The video generated by FFMPEG transcoding is not from the beginning code 0 × 00000001. H264 Description: H.264 BitStream with Start Codes. General for the pressing format of the movie such as HDVD, is the start code 0 × 00000001. Source Document: http://msdn.microsoft.com/zh-cn/library/dd757808 (v = vs.85) .aspx (2) Second, through the VLC player, you can view the specific format. After opening the video, you can see the [Code) specific format by menu [Tool] / [Code Information], for example, codec information: Encoding: H264 - MPEG-4 AVC (Part 10) (AVC1) Code : H264 - MPEG-4 AVC (Part 10) (H264) (3) Finally, after sharing the FFMPEG DEMUX MP4 file, the experience and method of converting the video stream to the Live555 can directly use the H264 ES stream: For (AVC1), the av_read_frame, take the first four bytes as the length, put the top four The byte is replaced directly to 0 × 00, 0 × 00, 0 × 00, 0 × 01, but pay attention to each frame may have multiple NAUL: Avpacket PKT ; Avpacket * Packet = & pkt ; AV_INIT_PACKET (Packet ) ; AV_READ_FRAME (CTX , Packet ) ; Be Be Be IF (Packet -> stream_index == 0 ) Be { // is Video Stream Be Be Const Char start_code " 4 ] = { 0 , 0 , 0 , 1 } ; Be IF (IS_AVC_ || Memcmp (start_code , Packet -> Data , 4 ) ! = 0 ) Be { // is Avc1 Code, Have no start code of h264 Be Int Len = 0 ; Be Uint8_t * P = Packet -> Data ; IS_AVC_ = TRUE ; Be DO Be { // Add Start_code for Each Nal, One Frame May Have Multi Nals. Len = NTOHL ( * ( ( Long * ) P ) ) ; Be Memcpy (p START_CODE , 4 ) ; P + = 4 ; P + = LEN ; Be IF (p > = Packet -> Data + Packet -> SIZE ) Be { Be Break ; Be } Be } While ( 1 ) ; Be } Be } For another format, (H264), directly call the av_bitstream_filter_filter to each Packet to handle each packet: BSFC_ = Av_bitstream_filter_init ( "H264_MP4TOANNEXB" " ) ; Be Be IF (pkt -> stream_index == 0 ) Be { // is Video Stream Be AvbitstreamfilterContext * BSFC = BSFC_ ; Be Int a ; Be While (BSFC ) { Avpacket new_pkt = * PKT ; A = AV_BITSTREAM_FILTER_FILTER (BSFC , Encode_CTX_ NULL , Be & new_pkt. Data , & new_pkt. Size , PKT -> Data , PKT -> SIZE , PKT -> Flags & AV_PKT_FLAG_KEY ) ; Be IF (a == 0 && new_pkt. Data ! = Pkt -> Data && new_pkt. Destruct ) { Be Uint8_t * T = ( Uint8_t * ) (new_pkt. Size + FF_INPUT_BUFFER_PADDING_SIZE ) ; // the new sales be a subset of the old so cannot overflow Be IF (T ) { Be Memcpy (T , New_pkt. Data , New_pkt. Size ) ; Be MEMSET (T + New_pkt.NGTH Field Can Vary, But IS Typically 1, 2, or 4 Bytes. This paragraph is roughly: the H.264 video that does not start code is mainly stored in a file in the MP4 format. Its data stream begins with 1, 2 or 4 bytes to represent length data. The "NALU" in the original text is simply the most basic unit in the H.264 format, which is a packet. http://www.mysilu.com/archiver/?tid-721741.html Here: https://msdn.microsoft.com/zh-cn/library/dd757808 (v = vs.85) .aspx EN This content does not have your language version, but there is a English version. H.264 Video Types The Following Media Subtypes Are Defined for H.264 Video. Subtype FOURCC Description MEDIASUBTYPE_AVC1 'AVC1' H.264 bitstream without start codes. MEDIASUBTYPE_H264 'H264' H.264 bitstream with start codes. MEDIASUBTYPE_h264 'h264' Equivalent to MEDIASUBTYPE_H264, with a different FOURCC. MEDIASUBTYPE_X264 'X264' Equivalent to MEDIASUBTYPE_H264, with a Different Fourcc. MediaSubtype_x264 'x264' Equivalent to MediaSubtype_H264, with a different fourcc. Be ............. The Main Difference Between The Media Types Is The Presence of Start Codes in The BitStream. If The Subtype Is MediaSubtype_AVC1, The BitStream Does Not Contain Start Codes. H.264 BitStream with Start Codes H.264 bitstreams that are transmitted over the air, or contained in MPEG-2 program or transport streams, or recorded on HD-DVD, are formatted as described in Annex B of ITU-T Rec. H.264. According to this specification The BitStream Consists of a Sequence of Network Abstract Layer Units (NALUS), EACH OF WHICH IS prefixed with a start code equal to 0x000001 or 0x00000001. When Start Codes Are Present in The BitStream, The Following Media Type IS Used: Major type MEDIATYPE_Video Subtypes MEDIASUBTYPE_H264, MEDIASUBTYPE_h264, MEDIASUBTYPE_X264, or MEDIASUBTYPE_x264 Format type FORMAT_VideoInfo, FORMAT_VideoInfo2, FORMAT_MPEG2Video, or GUID_NULL Be If The Format Type IS Guid_null, No Format Structure Is present. When the bitstream contains start codes, any of the format types listed here is sufficient, because the decoder does not require any additional information to parse the stream. The bitstream already contains all of the information needed by the decoder, and the start codes enable the Decoder to Locate The Start of Each Nalu. The Following Subtypes Are Equivalent: H.264 BitStream without Start Codes The MP4 container format stores H.264 data without start codes. Instead, each NALU is prefixed by a length field, which gives the length of the NALU in bytes. The size of the length field can vary, but is typically 1, 2, OR 4 bytes. When Start Codes Are Not Present in The BitStream, The Following Media Type IS Used. Major Type MediaType_Video Subtype MediaSubtype_avc1 Format Type Format_mpeg2Video Be The Format Block is an MPEG2VideoInfo Structure. This Structure Should Be Filled in As Follows: hdr: A VIDEOINFOHEADER2 structure that describes the bitstream No color table is present after the BITMAPINFOHEADERportion of the structure, and biClrUsed must be zero.dwStartTimeCode:. Not used Set to zero.cbSequenceHeader:. The length of the dwSequenceHeader array in bytes.dwProfile: Specifies the H.264 profile.dwLevel: Specifies the H.264 level.dwFlags: The number of bytes used for the length field that appears before each NALU The length field indicates the size of the following NALU in bytes for example, if.. dwFlags is 4, each NALU is preceded by a 4-byte length field The valid values ​​are 1, 2, and 4.dwSequenceHeader:. A byte array that may contain sequence parameter set (SPS) and picture parameter set (PPS) NALUs. The MP4 container might contain sequence parameter sets (SPS) or picture parameter sets (PPS) as special NAL units in file headers or in a separate stream (distinct from the video stream). When the format is established, the media type can specify SPS and PPS NAL units in the dwSequenceHeader array. If cbSequenceHeader is greater than zero, dwSequenceHeader is the start of a byte array containing SPS and PPS NALUs, delimited by 2-byte length fields, all in network byte order (big-endian). It IS POSSIBLE TO HAVE BTH SPS AND PPS, ONLY One of these Types, or none. The actual type of each nal_unit_type field of the nalu itself. When Media Type IS Used, Each Media Sample Starts At The Beginning of A Nalu, And Nal Units The Decoder To Recover from Data Corruption or Dropped Samples. Size , 0 , FF_INPUT_BUFFER_PADDING_SIZE ) ; NEW_PKT. Data = T ; A = 1 ; Be } Else A = AVERROR (ENOMEM) ) ; Be } Be IF (a > 0 && pkt -> Data ! = New_pkt. Data ) { AV_FREE_PACKET (pkt ) ; NEW_PKT. Destruct = AV_DESTRUCT_PACKET ; Be } Else IF (a In 0 ) { Envir ( ) << "" "!!!!!!!!!! AV_bitstream_filter_filter failed" " << "", res = "" << a << "\ n" " ; Be } Be * PKT = New_pkt ; Be BSFC = BSFC -> Next ; Be } Be } Category: Technical Articles | Tags: H264 Code Flow, MP4 DEMUX, MP4 FFMPEG DEMUX, MP4 Files Different Formats AVC1 and H264 | Readings: 2,184 I have been questioning why there are some video decodes to display the format: H264, most of them: AVC1 I found on Microsoft's MSDN when searching programming: Original: http://msdn.microsoft.com/en-us/ Library / DD757808 (V = vs.85) .aspx Fourcc: AVC1 Description: H.264 BitStream without Start Codes. Fourcc: H264 Description: H.264 BitStream with Start Codes H.264 BitStream with Start Codes H.264 BitStreams That are transmitted over the air, or contained in MPEG-2 program or transport streams, or recorded on HD-DVD, are formatted as described in Annex B of ITU-T Rec. H.264. According to this specification, the bitstream consists of A SEQUENCE OF NETWORK Abstract Layer Units (NALUS), EACH OF WHICH IS Prefixed with a start code equal to 0x000001 or 0x00000001. This paragraph is righteous: H.264 video with start code is generally used for wireless transmission, Wired broadcast or HD-DVD. The beginning of these data streams has a start code: 0x000001 or 0x00000001. H.264 BitStream Without Start Codes The MP4 Container Format Store H.264 Data Without Start Codes. Instead, Each Nalu Is Prefixed by a Length Field, Which Gives The Length Of the nalu in bytes. The size of the le

     

     

     

     

    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