

In case the input video uses MP4 container and you want JPEG images: ffmpeg -i input.265 %05d.jpgįor making things reproducible, start by creating an input video file using FFmpeg CLI: ffmpeg -y -f lavfi -i testsrc=size=192x108:rate=1:duration=10 -vcodec libx265 -pix_fmt yuv420p input.265 Snprintf(buf, sizeof(buf), "%s-%d.pgm", filename, dec_ctx->frame_number) Ĭonverting raw HEVC file to sequence of images image using FFmpeg CLI, is simple.Īssume input.265 is the input file (raw HEVC video stream):Ĭonverting to PNG images: ffmpeg -i input.265 %05d.pngĬonverting to PPM images: ffmpeg -i input.265 %05d.ppm

* the picture is allocated by the decoder.

If (ret = AVERROR(EAGAIN) || ret = AVERROR_EOF) Ret = avcodec_receive_frame(dec_ctx, frame) Void HevcDecoder::Decode(AVCodecContext* dec_ctx, AVFrame* frame, AVPacket* pkt, const char* filename) I have tried to save it as *.pgm file, so the picture is just grey, which not really i need.Īny suggesstion? Thanks! void HevcDecoder::Images_Save(char* filename, AVFrame *frame)įprintf(file, "P5\n%d %d\n%d\n", frame->width, frame->height, 255) įwrite(frame->data + i * frame->linesize, 1, frame->width, file) What i need is to save the frame as picture(with full colors). I'm using FFmpeg in source code to decode the Hevc file and get AVFrame and AVCodecContext. In my project, i'd like to save one of the frames from Hevc file.
