are there any updates on this? I found this thread because I had the same question. I want to compress a video stream in YUY2 or UYVY format to, say H265. If I understand the answers given here correctly, I should be able use the function av_image_fill_arrays()
to fill the data and linesize arrays of an AVFrame object, like this:
av_image_fill_arrays(m_pFrame->data, m_pFrame->linesize, pData, ePixFmt, m_pFrame->width, m_pFrame->height, 32);
and call avcodec_send_frame()
, followed by calling avcodec_receive_packet()
to get encoded data.
I must have done something wrong. The result is not correct. For example, rather than a video with a person's face showing in the middle of the screen, I get a mostly green screen with parts of the face showing up at the lower left and lower right corners.
Can someone help me?