[FFmpeg-user] How can I convert rbg to yuv420p loseless?
adf.lists at gmail.com
Wed Aug 21 00:04:49 CEST 2013
> I generated a test that contains a variety of colors pictures,
> red/green have black dot.
> Here is part of the core code:
It's the same using ffmpeg directly, but there's probably nothing wrong
with the rgb -> yuv420p and using the flags below for this conversion
does not affect the outcome.
A more interesting test would be to find something else that can make
yuv420p from rgb.
> original png file
> yuv420p zoom in 4x, use the software yuv
> viewer(http://sourceforge.net/projects/yuviewer/), and screenshot
So yuviewer does the same yuv -> rgb scale as ffmpeg in default mode.
> original png file to yuv420p use above code
Playing your .yuv looks fine with ffplay and mplayer + three different
ways of using my gpu to scale/csc.
It's likely that anyone playing your yuv with a normal player that will
choose h/w to scale/csc won't see the issue.
Due to the height being >=720 some code may assume it's 709 rather than
601 colourspace, but that's nothing to do with this issue.
ffmpeg -s 1024x768 -pix_fmt yuv420p -i P0001.yuv P0001-noopt.png
Will show the artifacts you see
ffmpeg -s 1024x768 -pix_fmt yuv420p -i P0001.yuv -sws_flags
Doesn't produce them, so it looks like the yuv its self is sound, but
the accuracy of yuviewer/ffmpeg default is the issue when converting
back to rgb.
More information about the ffmpeg-user