Skip to content

Instantly share code, notes, and snippets.

@rlaphoenix
Created October 27, 2025 05:40
Show Gist options
  • Select an option

  • Save rlaphoenix/a51a996485b08d42fa05baab96e1304b to your computer and use it in GitHub Desktop.

Select an option

Save rlaphoenix/a51a996485b08d42fa05baab96e1304b to your computer and use it in GitHub Desktop.

Revisions

  1. rlaphoenix created this gist Oct 27, 2025.
    40 changes: 40 additions & 0 deletions bewitched-bd-luma-with-dvd-chroma.vpy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    # Example: https://slow.pics/c/VdkBeiWx

    import vapoursynth as vs
    core = vs.core

    dvd = core.lsmas.LWLibavSource(r"Bewitched.S01.Color.NTSC.DVD.DD2.0.MPEG-2.REMUX-MiU\Bewitched.S01E01.Color.NTSC.DVD.DD2.0.MPEG-2.REMUX-MiU.mkv", repeat=False, fpsnum=24000, fpsden=1001)
    #core.lsmas.LWLibavSource(source, stream_index, cache, cachefile, threads, seek_mode, seek_threshold, dr, fpsnum, fpsden, variable, format, decoder, prefer_hw, repeat, dominance, ff_loglevel, cachedir, ff_options)
    bd = core.lsmas.LWLibavSource(r"Season 1\Bewitched.S01E01.1080p.BluRay.Remux.FLAC2.0.H.264-BTN.mkv")

    dvd = dvd[47+17:]

    bd = core.std.Crop(bd, left=240, right=240)

    dvd = core.resize.Spline16(dvd, width=bd.width, height=bd.height)

    clip = core.std.StackHorizontal([dvd, bd])

    # match bd to dvd framing
    left_adj = 13
    right_adj = -5
    top_adj = 40
    bot_adj = -15
    bd_framed = core.resize.Spline16(
    bd, bd.width, bd.height,
    src_left=left_adj, src_top=top_adj,
    src_width=bd.width-left_adj-right_adj, src_height=bd.height-top_adj-bot_adj
    )

    # merge bd and dvd, taking luma from bd and chroma from dvd
    merged = core.std.ShufflePlanes([bd_framed, dvd, dvd], planes=[0, 1, 2], colorfamily=vs.YUV)

    clip = merged

    clip = core.resize.Spline16(
    bd, bd.width, bd.height,
    src_left=left_adj, src_top=top_adj,
    src_width=bd.width-left_adj-right_adj, src_height=bd.height-top_adj-bot_adj
    )

    clip.set_output()