[Libav-user] avcodec_open return error -22

Jasleen Kaur Jasleen at beesys.com
Wed Jan 11 08:13:49 CET 2012



Following is the code i have written to use ffmpeg to open MP4 encoder.
When I call avcodec_open it returns -22.

Is there missing configuration?
What does this error mean? Is there any documentation for the error numbers?

Also what is the units for the bit_rate field?


 avcodec_init();
 avcodec_register_all();
 AVCodec *pCodec = avcodec_find_encoder(CODEC_ID_MPEG4);

 AVCodecContext *pContext = avcodec_alloc_context();
 AVFrame *picture = avcodec_alloc_frame();

 pContext->codec_id = CODEC_ID_MPEG4;
 pContext->codec_type = AVMEDIA_TYPE_VIDEO;
 pContext->codec = pCodec;

 pContext->bit_rate = 400000;
 pContext->width = 720;
 pContext->height = 576;

 pContext->time_base.num = 25;
 pContext->time_base.den = 1;

 pContext->pix_fmt = PIX_FMT_YUYV422;
 pContext->profile = FF_PROFILE_MPEG4_SIMPLE;

 int i = avcodec_open(pContext, pCodec);


regards
- Jasleen


More information about the Libav-user mailing list