FFmpeg (4)-use Avformat_find_stream_info () to detect contextual information for the encapsulation format

Source: Internet
Author: User

/** * Read packets of a media file to get stream information. This * are useful for file formats with no headers such as MPEG. This * function also computes the real framerate in case of MPEG-2 repeat * frame mode. * The logical file position is not a changed by this function; * Examined packets May is buffered for later processing.                 * * @param IC media file handle * @param options If non-null, an ic.nb_streams long array of pointers to * Dictionaries, where i-th member contains options for * codec corresponding to i-th stream. * On return each dictionary is filled with options, were not found. * @return >=0 if OK, averror_xxx on Error * * @note this function isn ' t guaranteed to open all the codecs, so * o Ptions being Non-empty at return is a perfectly normal behavior. * * @todo Let the user decide somehow "what information are needed so" * We do not waste time getting stuff the US  ER does not need.*/intAvformat_find_stream_info (Avformatcontext *ic, avdictionary **options);

This function is primarily used to obtain video stream information.

In some formats there is no header information, such as FLV format, h264 format, this time call Avformat_open_input () after opening the file there is no parameters, you can not get the information inside. You can call this function at this time, because it will try to detect the format of the file, but if there is no header information in the format, it can only get the information that is encoded, the width is high, or the total length of time is not available. If the total length is not available, you still need to read the entire file and calculate the total number of frames.

Cases:

if 0) >=0  ) {        logi ("duration is:%lld, Nb_stream is:%d", ic- >duration, ic->nb_streams);}

The IC is a pointer to Avformatcontext .

FFmpeg (4)-use Avformat_find_stream_info () to detect contextual information for the encapsulation format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.