[Libav-user] Lossless encoding - red color sharpness defect

koli at koli.sk koli at koli.sk
Mon May 28 13:39:00 CEST 2012


Hi,

I was trying to use ffmpeg for screen capture and come to this problem. 
I was using x264 for encoding with many different options, but the 
result was unsatisfactory. Problem is with red colored labels, which are 
really important in screen videos that should be captured. Here is 
series of sample PNG pictures

http://tucniak.sk/ffmpeg/GrabedPictures.zip

It is just simple desktop with running Thunderbird with one email 
selected as "Important" so it is red colored text in dark background.
Simple encoding via command line

ffmpeg -r 5 -i ./GrabedPictures/Pic%d.png -r 5 -vcodec libx264 
TestX264.avi

made this result
http://tucniak.sk/ffmpeg/TestX264.avi

Everything is pretty sharp, except the red text in Thunderbird. Then I 
used "lossless" option

ffmpeg -r 5 -i ./GrabedPictures/Pic%d.png -vcodec libx264 -x264opts 
qp=0 TestLosslessX264.avi

Everything is almost the same, except the file size (almost twice), but 
the red text still remains fuzzy

We have developed a simple grabber using ffmpeg library, where we used 
hardcoded YUV444 colorspace and with that we made this video with 
similar screen.

http://tucniak.sk/ffmpeg/OwnGrabX264_YUV444.avi

and the problem still remains.

I don't know how much "LOSSLESS" is the qp=0 option but it seems that 
it is not enough to produce the same output as input. Can anybody give 
some hint for options that could be used to make it REAL LOSSLESS.

For testing purpose I tried also "ffv1" and "huff" codec. I am not 
posting the result videos because of the size, but you can do it 
yourself by downloading GrabedPictures.zip and comands

ffmpeg -r 5 -i ./GrabedPictures/Pic%d.png -r 5 -vcodec huffyuv 
OutHuff.avi
ffmpeg -r 5 -i ./GrabedPictures/Pic%d.png -r 5 -vcodec ffv1 -sameq 
TestFfv1.avi

But these are not a good solution.
-Huff produced 270MB video from 50MB of PNG, and maybe I am doing 
somethig wrong but direct playing PNGs as frames would be more 
efficient.
-Ffv1 produced 22MB video which is some kind better but it is still too 
much in comparison with 0,3MB for standard X264 and 0,6MB for "lossless" 
X264.

What is more interesting when I was trying to play huff or ffv1 video 
with mplayer or ffplay the red text was still fuzzy. So I thought that 
even these codecs are not real lossless. Then by accident I played these 
videos with vlc player and with this the red text was sharp. So the 
problem was not encoding but decoding. It seems that ffmpeg has not 
correct decoding of "lossless" video codecs.

Then I tried to play my "lossless" videos (TestLosslessX264.avi, 
OwnGrabX264_YUV444.avi) with vlc hoping that the problem is just in 
decoding. But again I was not successful. The first one shows only first 
frame in vlc, and the second one only black screen.

Any hints or tips how to make "lossless" video with sharp red labels 
are welcome
Best regards
Juraj Kolesar


More information about the Libav-user mailing list