0
votes

I am using ffmpeg to decode mp4 format video.

After calling avcodec_decode_video2 function, I got a decoded frame in AVPixelFormat.AV_PIX_FMT_YUV420P.

Is there a ffmpeg function that can convert the decoded frame into a jpeg file? I need to get the byte stream of the decoded jpeg images.

1

1 Answers

0
votes

Use avcodec_encode_video2() on a AVCodecContext initialized with the AVCodec return value from avcodec_find_encoder(AV_CODEC_ID_JPEG). A full example of avcodec_encode_video2() can be found here.