[Libav-user] sws_scale has weird behavior when not resizing

沉默的大多数 nowget at qq.com
Fri Jul 13 13:32:47 CEST 2012

------ 原始邮件 ------
From:"Alex Cohn"<alexcohn at netvision.net.il>;
Date:2012年7月13日(星期五) 凌晨2:18
To:"This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<libav-user at ffmpeg.org>;
Subject:Re: [Libav-user] sws_scale has weird behavior when not resizing

 On Jul 12, 2012 6:30 PM, "Alexandre Millette" <amillett at matrox.com> wrote:
 > Hello all.
 > I'm working on a C++ video player using libav.
 > Upon testing with various video formats and files, I've encountered a problem with a small MPEG4/mp4v file (190x240).
 > The issue is that a small green band (6 px in width) will appear on the right side of the frames.
 > This is what I've gathered so far:
 > - The YUV420 frame read in the stream is ok.
 > - The RGB32 frame output by sws_scale (there is no resize, the function is used only for conversion purpose) has the green band, so the problem comes from sws_scale.
 > - The green color comes from the original allocation of the YUV frame (data to 0 equals to a green shade).
 > - If sws_scale is used also as a resizing device (say converting YUV420 190x240 to RGB32 191x240), there is no colored band, but the frame is of course 1 pixel wider than intended (frame accuracy is an important feature of the project, so this is not acceptable).
I believe your problem could be rooted in bicubic transform. It makes n9 sense when source and target sizes are the same. Try to set linear.
> img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P,
 > Thank you,
 > Alex M
I hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120713/fd75a8c9/attachment.html>

More information about the Libav-user mailing list