[FFmpeg-user] Efficient way to extract AVFrame data when linesize > frame width

Daniel Moraes daniel.b.moraes at gmail.com
Tue Jun 16 20:07:35 CEST 2015


Hello guys,

I noticed that linesize of an AVFrame can be greater than the width of an
YUV video, for example. After searching about the reason behind it, I saw
that some decoders can be faster when linesize of the frame is multiple of
16, and in some cases, when linesize > frame width. When it happens, the
bytestream (frame->data) of an AVFrame has empty spaces, with no pixel
information, which gives an right-padded border when the frame is exported
to an image file directly.

I can solve that problem by iterating through the frame->data array, line
by line, and copying only the first (frame->width) values of each row
(instead all the frame->linesize values). However, I am looking for a more
efficient way, preferably using the functions of ffmpeg.

So, my question is, It is possible to remove such extra borders from
frame->data with ffmpeg functions?

Bests,
Daniel


More information about the ffmpeg-user mailing list