View Single Post
Old 8th January 2006, 23:45   #3  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
BTW, your approach will leave the frames looking very wrong, which would be bad if you ran any filters on the video between colorspace conversions.

A better approach might be something like:
Code:
function YV12toYUY2(clip last) {
    y = Tweak(sat=0, coring=false).ConvertToYUY2()
    uy = UtoY()
    vy = VtoY()
    u = Interleave(uy, uy).AssumeFieldBased().Weave().ConvertToYUY2()
    v = Interleave(vy, vy).AssumeFieldBased().Weave().ConvertToYUY2()
    return YtoUV(u, v, y)
}

function YUY2toYV12(clip last) {
    y = Tweak(sat=0, coring=false).ConvertToYV12()
    u = UtoY().AssumeFrameBased().SeparateFields().SelectEven().ConvertToYV12()
    v = VtoY().AssumeFrameBased().SeparateFields().SelectEven().ConvertToYV12()
    return YtoUV(u, v, y)
}
which duplicates chroma samples instead of using blank ones (and is what I expected the internal ConvertToYV12() and ConvertToYUY2() to do).

Last edited by stickboy; 8th January 2006 at 23:55.
stickboy is offline   Reply With Quote