[Ffmpeg-devel] Cannot encode frame as rawvideo in an .avi file

Munier Nicolas Nicolas.Munier
Tue May 2 10:53:31 CEST 2006


Hi everyone,

Sorry for the double post I didn't notice the links and so it's unreadable.

I'm using the ffmpeg librairies to create an avi file containig one rawvideo stream of UYVY frames.
I pretty much follow the example of ouput_example.c and I got a problem using avcodec_encode_video. It returns -1.

00578 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 
00579????????????????????????? const AVFrame *pict)
00580 {
00581???? if(buf_size < FF_MIN_BUFFER_SIZE){
00582???????? av_log(avctx, AV_LOG_ERROR, "buffer smaller then minimum size\n");
00583???????? return -1;
00584???? }
00585???? if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
00586???????? return -1;
00587???? if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
00588???????? int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
00589???????? avctx->frame_number++;
00590???????? emms_c(); //needed to avoid an emms_c() call before every return;
00591???? 
00592???????? return ret;
00593???? }else
00594???????? return 0;
00595 }

My rawvideo codec is correctly open; I have a pointer to a decode function. My UYVY AVFrame is also correctly filled.
My buf is correctly allocated and its size is correct.
I also notice that frame_number from my CodecContext is incremented after avcodec_encode_video. So it must be codec->encode which return -1. 
My question is: is there some kind of problem encoding rawvideo or is there an error in my init which could lead to that?

Regards,

Nicolas






More information about the ffmpeg-devel mailing list