How to convert YUV420P image to JPEG using ffmpeg's libraries?
I'm trying to convert a YUV420P image ( AV_PIX_FMT_YUV420P ) to a JPEG using ffmpeg's libavformat and libavcodec . This is my code so far: AVFormatContext* pFormatCtx; AVOutputFormat* fmt; AVStream* video_st; AVCodecContext* pCodecCtx; AVCodec* pCodec; uint8_t* picture_buf; AVFrame* picture; AVPacket pkt; int y_size; int got_picture=0; int size; int ret=0; FILE *in_file = NULL; //YUV source int in_w = 720, in_h = 576; //YUV's width and height const char* out_file = "encoded_pic.jpg"; //Output file in_file = fopen(argv[1], "rb"); av_register_all(); pFormatCtx = avformat_alloc_context(); fmt =