[FFmpeg-user] How can I convert rbg to yuv420p loseless?
adf.lists at gmail.com
Mon Aug 19 21:16:35 CEST 2013
> I'm doing a convert picture to MP4 video, the original image is
> PIX_FMT_BGRA format, now converted from RGB to YUV420P, I found many
> black spot around the picture, the follow is part of the core code,
> please help me to how to clear these black dots, or can tell me what
> information is missing, thank you.
> libffmpeg::SwsContext* swsContext = libffmpeg::sws_getContext( srcW,
> srcH, libffmpeg::PIX_FMT_BGRA,codecContext->width,
> codecContext->height, libffmpeg::PIX_FMT_YUV420P, SWS_BICUBIC, NULL,
> NULL, NULL);
> libffmpeg::sws_scale( swsContext , srcData, srcLinesize, 0,
> frame->Height, data->VideoFrame->data, data->VideoFrame->linesize );
> original png file
> yuv420p image file(scale and clip)
It does seem that there is an issue here.
Out of curiosity I made a 420 from your png, played it with ffplay, took
an xwd and displayed it with display from image magick so I could zoom.
It looks OK and doesn't have any of the blackness of your example. It
does show some darkening of the boundary red pixels.
I decided to try some other 420 -> rgb convertions with mplayer,
vdpau,xv and gl all looked the same as ffplay.
-vo x11, though, looked like your example so it seems there is an issue
somewhere. Of course mplayer is not ffmpeg and I don't know what code is
being run when it says -
[swscaler @ 0x7fba4aac65b0] using unscaled yuv420p -> bgra special converter
but it would seem you have found something similar with ffmpeg -
assuming you are actually using ffmpeg to display/convert back to rgb
More information about the ffmpeg-user