[FFmpeg-user] How can I convert rbg to yuv420p loseless?
adf.lists at gmail.com
Mon Aug 19 00:21:47 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
> 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)
Well I don't know if you can do better with ffmpeg or not as I haven't
tried and others may be able to suggest tweaks.
Referring to the title of this post RGB -> 420 can't be lossless.
Chroma subsampling roughly works on "normal" video images, but if you
push it with saturated graphics it can artifact.
Broadcasters will take this sort of thing into account when designing
text overlays etc.
Below is just as some sort of explanation - I don't know if it's why in
your particular case/commands used.
More information about the ffmpeg-user