View Full Version : How to combine luma from one source with chroma from another?


resonator79
4th May 2015, 14:23
Hi!

I hope the question is not too dumb, but I've searched the forum for days, I couldn't find anything, maybe I don't know the proper terminology.

I'm looking into different ways to undo a nasty 25>29,97 framerate conversion on one of my Doctor Who BluRays. (I'm not a pirate, bought both the DVD and the later the BD). srestore works pretty well most of the time, but especially around scene changes the chroma is more ofen than not just off and bleeds into the next or the previous frame.
Now, I do have a (25fps) DVD which, when upscaled, perfectly lines up with the picture of the BD. The transfers are likely exactly the same anyway, I synced a scene change around frame 350 and it stays in sync all the way to the end.

Now - how would I have to go about if I wanted to take the chroma from the DVD and merge it with the luma of the BD?

resonator79
4th May 2015, 14:36
I sorta figured it out right after posting, but just to be sure, would some like this be the best way to go about it?


bdsrest=AVISource("dw_planet_srestore.avi")
dvd=AVISource("dw_straight_dvd_synced2bd.avi").nnedi3_rpow2(8, fwidth=1920, fheight=1080, cshift="Spline36Resize")

bdchrswpd=MergeChroma(bdsrest, dvd, 0.9)

return(bdchrswpd)

StainlessS
4th May 2015, 15:47
Looks OK to me, so long as 0.9 is ok (rather than 1.0).

resonator79
4th May 2015, 16:46
Yeah, I'll I did some experiments with how much of the HD chroma left I could get away with, that's where the 0.9 come from. Thank you!

resonator79
5th May 2015, 19:51
I haven't dealt much with Chroma/Luma operations, so I was wondering - would it be possible to separate chroma and luma, export both to an AVI file, put them through an NLE and recombine again them afterwards?

StainlessS
6th May 2015, 00:45
So far as I'm aware, there is no codec that saves just eg chroma.
You could save each individual channel as Y8 but I'm also not aware of any particular codec that supports that (I'm sure there probably is one but I dont know of it, search).
Of course you could save as eg YV12 after GrayScale() call, to set all chroma (both channels) to 128.
I think it much more likely that your (or some other) NLE supports direct edit of U/V/Luma individually, save result in whatever format the NLE supports
and then can merge together in Avisynth.

Merge (clip1, clip2, float weight=0.5)
MergeChroma (clip1, clip2, float weight=1.0)
MergeLuma (clip1, clip2, float weight=1.0)
UToY (clip)
VToY (clip)
YToUV (clipU, clipV [, clipY])
UToY8 (clip)
VToY8 (clip)

feisty2
6th May 2015, 02:27
utoy8 ()

ffmpeg -i 1.avs -c:v rawvideo U.rgb

RawReader ("U.rgb", "Y8", w, h, packing="8:0:8").ConvertToY8 ()

resonator79
10th May 2015, 10:52
Thank you!!