avcodec_register_all(); ctx = avformat_alloc_context(); encoder = avcodec_find_encoder(AV_CODEC_ID_H264); stream = avformat_new_stream(ctx, encoder); frame = avcodec_alloc_frame(); rframe = avcodec_alloc_frame(); avcodec_get_context_defaults3(stream->codec, encoder); stream->codec->pix_fmt = AV_PIX_FMT_RGB32; stream->codec->width = 192; stream->codec->height = 158; swsCtx = sws_getContext(stream->codec->width, stream->codec->height, AV_PIX_FMT_RGB32, stream->codec->width, stream->codec->height, SWS_BICUBIC, stream->codec->pix_fmt, nil, nil, nil);