main () { AVCodec* mjpegCodec; AVCodecContext* mjpegCodecCtx; mjpegCodec = avcodec_find_encoder_by_name ("mjpeg"); if (mjpegCodec==NULL) printf ("MJpeg codec not found\n"); mjpegCodecCtx = avcodec_alloc_context (); if (mjpegCodecCtx) if (avcodec_open (mjpegCodecCtx, mjpegCodec)<0) printf ("Codec not opened\n"); }