Log in

View Full Version : AvisynthNoob : remapping YUV to RGB


pleinlesyeux
20th March 2016, 16:10
Hello

I have a video (dnxhd 422) that has been recorded using a BMD shuttle with the hdmi input.
A computer wes the source (hdmi RGB)
Sadly, the recorder only took hdmi YUV. So I have a green picture.

Is there way to remap the YUV to RGB using a NLE or avisynth or whatnot ?

Thank you so much for helping me !

colours
21st March 2016, 01:50
You are probably screwed—it sounds like nothing was recorded at all. Upload a sample of what your file looks like so we can see if it can be salvaged.

pleinlesyeux
23rd March 2016, 11:38
Hello

Oh there are definitely things recorded. I can see the pictures, but with a heavy green tint.

Here is a sample :
https://www.wetransfer.com/downloads/c80ebd7a39add3d7784ba6549e25b44b20160323103519/b1594c12226cb459efadc09f8ec8df5120160323103519/1d17c9

Thank you so much !

Reel.Deel
23rd March 2016, 14:04
Oh there are definitely things recorded. I can see the pictures, but with a heavy green tint.


I took a look at your sample and it seems the chroma channels do not have any useful information. The only thing that you can do is is use Greyscale() to get rid of the green tint.

raffriff42
23rd March 2016, 14:18
Here are some tests you can make for yourself, which may come in handy:

XXSource("Capture Ecran Info2.mov.mp4")
UtoY (http://avisynth.nl/index.php/Swap)
...returns a black screen. So does VtoY.

ColorYUV (http://avisynth.nl/index.php/ColorYUV)(analyze=true)
...confirms both U and V channels are flat color @ 16

the vectorscope
Histogram (http://avisynth.nl/index.php/Histogram#Color_mode)("color")
...shows a single spot of color at the top left (ie, yellowish-green)

pleinlesyeux
24th March 2016, 22:18
OK. I understand that it's probably doomed(9):D to retrieve the data.

But so that I can understand, is it not normal that UtoY would return a black picture, since Y is grayscale only ?

Wouldn' I need is a YtoR, UtoG and VtoB instead, to recolor the 3 B&W pictures ?

I managed to get the greyscale with after effects. There is a way to swapped channel but in the same colorspace, so I had pinkish pictures as a choice...

Thanks anyway for taking the time...:thanks:

Asmodian
24th March 2016, 23:54
UtoY is for displaying the color channel "U" directly, as if it was luma data. It is only used a way of testing to see if there is any image data in the color plane; if UtoY gives a flat image the U channel is flat and contains no image data. If you actually wanted to use the U and V data, along with Y, to generate an RGB image you would use ConvertToRGB.

Y is not the R data, it takes a mixture of Y, U, and V to convert to R, G, and B. Converting Y into R, U into G, and V into B would give you a Black and Red version of your image instead of a Black and White one. Without valid U and V data there really is no color data recorded, the green tint is an artifact of near zero U and V values.
R = Y + 1.4075 * (V - 128)
G = Y - 0.3455 * (U - 128) - (0.7169 * (V - 128))
B = Y + 1.7790 * (U - 128)

pleinlesyeux
25th March 2016, 22:13
Hi Asmodian
thank you very much for your reply


Y is not the R data,

Usually it is not. But in this very case, I recorded a RGB hdmi image to a YUV only capable recorder. So chances are that to recover the right colors, Y is carrying the Red data.
And U the Green and V the blue ?

If I had used a simple hdmi to sdi converter (which would have change rgb colorspace to yuv), I would have been fine.
I still cannot wrap my head around why the matricing cannot be undone...