Saturday, November 13, 2010

Saturday Night Saved or vlc-sdl-yuv-color-awfulness

So you are sitting on your couch, popcorn's ready, movie is downloaded, you've downloaded the subs for the movie, you read the review in imdb. Everything is set to go. Then, suddenly, when you press play button on your vlc and you see the image with the colors all distorted. Oh my... so what do you do? cancel the movie night? NO way jose.

The automatic response is go pure logic. What changed in your Home theater pc recently? Nothing recently. Do other movies look like this? NO. Go directly to vlc image options and you see "VLC Chroma settings". Oh my.. what is chroma thing anyway. Did I touch it before? Yea, now I remember once I did this for other movie.... (I should've blogged this fix, now I don't remember). And in linux there's a chroma thingy called "xvinfo"... yea i've read this before. But why am I doing this again, because the lack of documentation... rethinking it all over. 

So here is the pic of the solution:


And here is explanation to save my precious saturday nights next time this happen.

RGB is the Red-plus-Green-Blue thingy (color space). YUV is just another way to map colors, a better way including brightness. My TV screen, and yours, uses RGB format. VLC in linux works using YUV formats because of xvideo/SDL driver (That is if you want to use hardware accelerated video).  So your video player have to interpret the YUV format in your movie file and pass it to the xvideo/SDL driver to show them on your TV or screen. Now here is the catch, your video player makes its best guess at doing this, the faster one according to the vlc documentation. Guess what happens? sometimes it fails. And when it fails, you see the colors all distorted. What's the fix? You have to provide the format manually, that means, try every YUV format your Xwindows supports ("xvinfo" will provide them for you).... 
Here is a list of all the formats. Once you found the one you want, the magic happens and your saturday is saved by googling and studying a little bit.

PD: I am no expert at this, if anyone has a suggestion or comment... it's most welcomed.
PD2: I am saying color awfulness MAY be because of this. But sometime it can mean some other things too....

No comments: