Log in

View Full Version : Sony Vegas - Incorrect colours


HulkHoganRules
13th August 2014, 15:48
So I'm working with some 4:2:0 material in Sony Vegas (it's from a capture card I am testing). Instead of using the inbuilt Vegas encoders, I was going to export to Lagarith YV12 and handle the encoding with x264.

However, I am getting some color differences when comparing the original MP4 4:2:0 video and the Lagarith export.

MP4: http://i.imgur.com/ULdJEQ3.jpg
Lagarith: http://i.imgur.com/Q1RDyuW.jpg

What settings in Vegas can I use to keep colours the same?

mariush
13th August 2014, 16:14
I'd recommend using MagicYUV instead of Lagarith, and configure it to accept whatever format Vegas likes. Then open the avi and see what format was used.

From memory, I think Vegas insists of sending RGB24 to vfw codecs, and lagarith may re-convert to 4:2:2 or something like that.

HulkHoganRules
13th August 2014, 16:28
I'll look into MagicYUV, thanks.

Also you are right. Vegas was sending RGB to Lagarith and it was doing a pretty bad RGB to YV12 conversion. Setting Lagarith to RGB solved the issue.

Last question before I can feel easy about keeping this workflow. In my capture cards software I can toggle between 0-255 and 16-235. I only have a 16-235 TV so I use that. I noticed that when rendering with 8 bit or 32 bit (video levels) in Vegas, the black level became grey. Setting Vegas to 32 bit (full) fixed this and it looked like the capture black level. This is the correct thing to do or am I missing something? I guess it should since the captured video looks like what it does on my 16-235 TV. Additionally, I should be using 2.222 for compositing gamma, right?

mariush
13th August 2014, 16:58
Well, my first thought would be ... why encode video for YOUR TV ? Maybe you'll change your TV in the future, or you're going to give that video to someone else and then everything's screwed up.

If the signal the capture card receives is full 0..255, then I would say capture it 0..255. I don't see any reason why you'd limit your levels. Your problem is just something related to converting from some standard to another (like lets say bt601 to bt709) or the video player or tv automatically assuming one of those based on resolution of the video instead of relying on the signals in the video.

TheSkiller
14th August 2014, 09:37
Vegas needs the YV12 source to be converted to RGB in some way to work with it. But the question is: how do the original 16-235 YCbCr levels (assuming standard levels, see edit) get converted to RGB – will it result in 0-255 full range RGB or 16-235 limited range RGB? In my experience with Vegas this seems to vary, depending on whether some Vegas-internal Codec converts the color space or if a VfW Codec does it.

And then, on top of that, there may be colorimetry mismatches (rec.601 vs rec.709). Such a mismatch may arise both during conversion to RGB as well as when rendering and converting back to YV12.


In any case limited range RGB usually causes just trouble so I suggest to work with full range RGB only by ensuring the source gets converted to full range RGB.

So either make sure this is the case for the given source Codec or simply convert the source to RGB on your own beforehand. The latter is what I always do. It sounds tedious at first, but all it takes it a 2-liner AviSynth script mounted with "Avisynth Virtual File System (http://www.turtlewar.org/avfs/)" to simulate a raw AVI which you then import into Vegas – no re-rendering required. Correct Levels, correct colorimetry, no headaches.


I noticed that when rendering with 8 bit or 32 bit (video levels) in Vegas, the black level became grey. Setting Vegas to 32 bit (full) fixed this and it looked like the capture black level.If you're source is properly converted to full range RGB, then "32 bit (full)" is the right setting. However, in that case the 8 bit setting should look just the same regarding the levels! Hence I cannot explain why for you only the 32 bit (full) settings seems to reproduce the original black level.
Compositing Gamma should be 2.222 at all times.


Edit: To overcome any problems with non-standard levels of your capture I highly recommend you should check the raw levels with a histogram so that you know what levels you really did capture. Do you know how to use AviSynth?

Atak_Snajpera
14th August 2014, 11:10
I recomend using MagicYUV where you can force codec to output RGB while decompressing.

http://i.cubeupload.com/YeS9fh.png

hello_hello
15th August 2014, 11:22
I'll look into MagicYUV, thanks.

Also you are right. Vegas was sending RGB to Lagarith and it was doing a pretty bad RGB to YV12 conversion. Setting Lagarith to RGB solved the issue.

If I remember correctly, RGB is the default. Whatever you select though, the video won't be "upsampled". For example if you select RGB as the input and the video is YUV, it'll stay YUV. Conversely if you select YUV as the input and it's RGB, it'll be converted to YUV.
It's probably an idea to leave the input set to RGB unless you specifically want to convert it.

Lagaryth has a similar option to MagicYUV for forcing the output to be RGB. Not that there's anything wrong with MagicYUV, but I'm pretty sure Lagaryth can do the same thing.

I guess it should since the captured video looks like what it does on my 16-235 TV. Additionally, I should be using 2.222 for compositing gamma, right?

I'm not sure what the capture card is doing, but computer monitors are full range (0-255) so RGB is usually full range. Most YV12 video is 16-235.
When playing RGB video on a PC monitor it should look correct as it's usually full range. YUV video may look washed out (black is dark grey) unless it's expanded to full range on playback. Sometimes it's done correctly by the player, renderer or video card, sometimes not. The first thing to check is whether you're displaying YV12 video correctly on your monitor in the first place, before deciding the output is wrong because it looks different to the original on your PC.
I don't think any players or video cards etc would expand RGB levels on playback as it's assumed to be full range.

The input setting on your capture card..... logically one of those settings converts the levels. You're capturing a PC game?
I'd guess 16-235 would be correct if you're capturing in YUV.
The game itself would be full range and the 16-235 setting probably converts it to limited range while capturing.

If black looks grey it's sign the video is 16-235 and it's not being converted to full range as you're viewing it or previewing it on your PC monitor. What about a DVD with black bars? Is the letterboxing black or dark grey on your PC monitor?

When it comes to the TV, if you're using a standalone player, 16-235 should display correctly as the TV probably defaults to 16-235 anyway. If you're connecting a PC to your TV and it's fixed at 16-235, then you need to make sure the video levels aren't being expanded by the PC on playback.
Is your PC connected to your TV? How are you viewing the final output with your TV?

There's lots of places where things can go wrong. 8 bit vs 32 bit processing in Vegas doesn't make sense to me in respect to the levels, although I've never used it.

Warperus
15th August 2014, 12:12
Sony Vegas has quite few options for project, full screen preview, scopes and input/output. It's a bit of mess actually.
If you have time, take a look at Glenn Chan paper about color spaces in Vegas:
http://www.glennchan.info/articles/vegas/v8color/vegas-9-levels.htm
Unfortunately, it's a bit outdated as in Vegas 12 SCS added new color space options in project and some codecs.

In short, there are two color space ideologies:
* studio levels project (8-bit, 32-bit studio gamma)
* computer levels project (32-bit full range)

Studio levels project works with studio RGB, that is R,G,B nominal levels are 16-235 for each channel. You actual material can be in full range though. It's a great thing for grading to deal with superwhites and superblacks - you avoid clipping.
Computer levels project works with computer RGB, that is R,G,B nominal levels are 0-255 for each channel. Superwhites and superblacks are clipped upon input and are lost for color correction.

Internal codecs like Mainconcept AVC do output in tv range and produces studio levels on timeline in this case. For full range input it naturally produces full range RGB on timeline for studio levels projects and clips colors for computer levels projects.

To make colors correct for Lagarith (RGB) output you should apply Color Levels filter. Basic preset is Studio RGb to Computer RGB generally firs your needs.
It's possible to apply this filter just after input, but I'd not suggest following TheSkiller suggestion (I suggest to work with full range RGB only by ensuring the source gets converted to full range RGB), but instead apply this filter after color correction phase if you plan to output through vfw. If you want to make BlurRay, DVD or upload to youtube, it's easier to render through internal codecs and thus work in natural studio levels project without twisted color levels.