[FFmpeg-user] avcodec_open return error -22

Jasleen Kaur Jasleen at beesys.com
Tue Jan 10 12:39:50 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_RGBA;
 pContext->profile = FF_PROFILE_MPEG4_SIMPLE; 

 int i = avcodec_open(pContext, pCodec);


regards
- Jasleen


More information about the ffmpeg-user mailing list