Home > other >  About the new API avcodec_send_packet ffmpeg and avcodec_parameters_to_context cannot decoding probl
About the new API avcodec_send_packet ffmpeg and avcodec_parameters_to_context cannot decoding probl

Time:09-23

Using the new API, in version 3.2 of ffmpeg avcodec_parameters_to_context to initialize AVCodecContext structure, but such initialized structure is much less than the codec AVStream members information, leading to subsequent use avcodec_send_packet error function, has anyone encountered similar problems?
Use the
The code below

Video_codec=avcodec_find_decoder (param - & gt; Codec_id);
if (! Video_codec)
{
Fprintf (stderr, "ERROR: Finding video codec FAILED! \n");
Goto the end;
}
Video_codec_context=avcodec_alloc_context3 (video_codec);//will have problems using this sentence
Video_codec_context=stream - & gt; The codec.//use this sentence to normal decoding
if (! Video_codec_context)
{
Fprintf (stderr, "ERROR: Allocating video codec FAILED! \n");
Goto the end;
}
Ret=avcodec_open2 (video_codec_context video_codec, NULL);
If (ret & lt; 0)
{
Fprintf (stderr, "ERROR: Opening video codec FAILED! \n");
Goto the end;
}
Ret=avcodec_parameters_to_context (video_codec_context, param);
If (ret & lt; 0)
{
Fprintf (stderr, "ERROR: Filling video codec context FAILED! \n");
Goto the end;
}

Error is as follows:

CodePudding user response:

The mistake you solved?

CodePudding user response:

The landlord to ask a question, I recently in learning, ffmepg AVCodecContext be replaced after a lot of variables, such as the reference frame refs variable, how to take less than, you know the latest version of the building Lord refs reference frame variables where go to? Need to how can I get? Hope reply, thank you very much!
  • Related