This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA746: How to pass codecdata/extra_data to libdce for h264?

Part Number: DRA746

Tool/software: Linux

there is codec data (ffmpeg calls it extra_data) when h264 is contained in mp4 format.

(it contains SPS/PPS info, but not raw format of SPS/PPS)

how to pass these data to libdce?

thanks.

  • should app convert extradata to IH264VDEC_NAL_UNIT_FORMAT format? then send it to libdce?
  • Hi Halley,

    I could not which extra_data you have mentioned. Can you please add more information?

    IH264VDEC_NAL_UNIT_FORMAT bitStreamFormat is to indicate that stream doesn't have start codes for NAL units.

    Ramprasad

  • take ffmpeg as example, here it is: github.com/.../avcodec.h
    it contains sps/pps information for H264, which is extracted from mp4 container.

    does libdce accept it directly? or I need convert it to sps/pps in IH264VDEC_NAL_UNIT_FORMAT format?
  • Hi Halley,

    Decoder itself detects and decodes SPS /PPS header from a IDR frame . You can try the .264 elementary stream present in /usr/share/ti/video of targetfs

    Ramprasad

  • 1. the extradata from mp4 file format includes sps/pps information, but not raw sps/pps. sps/pps should be extracted from extradata:
    github.com/.../h264_parse.c
    2. since you said libdce parses SPS/PPS from a IDR frame. (and we can see from libdce API that one output frame is sent with one input buffer)

    so, I draw the conclusion that:
    app need parse sps/pps from extradata, then prefix it to the first video frame data (before send the buffer to libdce).

    when we talk about h264 decoding, usually, it is not about elementary stream; but contained in mp4 file format.
    the sps/pps information is provided in file format in a different way.
  • Hi Halley,

    Halley Zhao said:
    1. the extradata from mp4 file format includes sps/pps information, but not raw sps/pps. sps/pps should be extracted from extradata:
    github.com/.../h264_parse.c

    Do you mean, its the extra data as in this link's section 19.5? 

    Halley Zhao said:
    so, I draw the conclusion that:
    app need parse sps/pps from extradata, then prefix it to the first video frame data (before send the buffer to libdce).

    when we talk about h264 decoding, usually, it is not about elementary stream; but contained in mp4 file format.
    the sps/pps information is provided in file format in a different way.

    Yes,your assumption is right if you are pointing to the extradata as in the above link or the data in the mp4 format, in this case application or the framework should parse all these extradata and provide the elementary format stream to the libdce which will in-turn send this to codec.

    Codec accepts the data only in elementary format and it doesn't understand container/mp4 file format. 

  • yes, we are talking about the same thing.

    I challenge the interface design, why not support extra_data and nal_size+nalu data for libdce?

    it can avoids some computation to pare element stream into multiple nal/slices  -- I assume hardware process data slice by slice.