avcodec_open return error -22

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

avcodec_open return error -22

Jasleen Kaur
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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: avcodec_open return error -22

Carl Eugen Hoyos
Jasleen Kaur <Jasleen <at> beesys.com> writes:

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

This mailing list is primarily for questions about the tool ffmpeg, there is a
mailing list for API questions, please read http://ffmpeg.org/contact.html

>  pContext->codec_id = CODEC_ID_MPEG4;

>  pContext->pix_fmt = PIX_FMT_RGBA;

I don't know much about FFmpeg API, but encoding RGB to ASP is definitely not
supported (and not defined afaik).

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: avcodec_open return error -22

Stefano Sabatini-2
In reply to this post by Jasleen Kaur
On date Tuesday 2012-01-10 11:39:50 +0000, Jasleen Kaur encoded:
> 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?

AVERROR(EINVAL) if I'm not in error, check libavutil/error.h but you
should debug and see where it fails (in case the log doesn't tell
nothing meaningful).
 
> Also what is the units for the bit_rate field?

bits per second IIRC.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: avcodec_open return error -22

Jasleen Kaur
In reply to this post by Carl Eugen Hoyos


________________________________________
From: [hidden email] [[hidden email]] on behalf of Carl Eugen Hoyos [[hidden email]]
Sent: Tuesday, January 10, 2012 6:38 PM
To: [hidden email]
Subject: Re: [FFmpeg-user] avcodec_open return error -22

Jasleen Kaur <Jasleen <at> beesys.com> writes:

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

This mailing list is primarily for questions about the tool ffmpeg, there is a
mailing list for API questions, please read http://ffmpeg.org/contact.html

>  pContext->codec_id = CODEC_ID_MPEG4;

>  pContext->pix_fmt = PIX_FMT_RGBA;

I don't know much about FFmpeg API, but encoding RGB to ASP is definitely not
supported (and not defined afaik).


I have tried with YUV also but same error.
Is there any help available for the error numbers returned?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: avcodec_open return error -22

Jasleen Kaur
In reply to this post by Stefano Sabatini-2


________________________________________
From: [hidden email] [[hidden email]] on behalf of Stefano Sabatini [[hidden email]]
Sent: Tuesday, January 10, 2012 11:18 PM
To: FFmpeg user questions and RTFMs
Subject: Re: [FFmpeg-user] avcodec_open return error -22

On date Tuesday 2012-01-10 11:39:50 +0000, Jasleen Kaur encoded:
> 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?

AVERROR(EINVAL) if I'm not in error, check libavutil/error.h but you
should debug and see where it fails (in case the log doesn't tell
nothing meaningful).

> Also what is the units for the bit_rate field?
bits per second IIRC.


thanks for guiding
I am unable to find the error log, where is error log generated?

-Jasleen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: avcodec_open return error -22

sagifer
In reply to this post by Jasleen Kaur
I have a same problem.

Use de error callback method.:


void my_log_callback(void *ptr, int level, const char *fmt, va_list vargs)
{
        printf ("\n%s",fmt);
}

av_log_set_callback(my_log_callback);
av_log_set_level(AV_LOG_VERBOSE);

The error message: Specified pix_fmt is not supported

I tired much pixel formets, but the results was same like before.