Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th January 2022, 21:23   #1  |  Link
Reclusive Eagle
Registered User
 
Join Date: Oct 2021
Posts: 83
How do you convert YUV to just Y

I'm trying to make an edge mask however when using algorithms where it applies to the whole clip and not a specific plane the result is a green white mess.

How do I convert YUV to Y only. I am only interested in the Luma layer for my mask and the edge mask I am using can not specify planes.
Do I use Fmtconv, resize? etc

Or is there a way to tell a plugin to target only a specific plane without needing the plugin to have it built in

Last edited by Reclusive Eagle; 18th January 2022 at 21:27.
Reclusive Eagle is offline   Reply With Quote
Old 18th January 2022, 21:36   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
http://www.vapoursynth.com/doc/funct...fleplanes.html

clip = core.std.ShufflePlanes(clip, planes=[0], colorfamily=vs.GRAY)
poisondeathray is offline   Reply With Quote
Old 18th January 2022, 21:41   #3  |  Link
Reclusive Eagle
Registered User
 
Join Date: Oct 2021
Posts: 83
Quote:
Originally Posted by poisondeathray View Post
http://www.vapoursynth.com/doc/funct...fleplanes.html

clip = core.std.ShufflePlanes(clip, planes=[0], colorfamily=vs.GRAY)
Thank god for people like you Poison. Was getting spammed with "vapoursynth.Error: resample: specified output colorspace is not compatible with input"

Thanks for your help!
Reclusive Eagle is offline   Reply With Quote
Old 19th January 2022, 00:23   #4  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
There was a convenient function SplitPlanes() added for API4:
Y,U,V = clip.std.SplitPlanes()
or
Y = clip.std.SplitPlanes()[0]
_Al_ is offline   Reply With Quote
Old 20th January 2022, 19:15   #5  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
@Selur

You mixed up the threads, "that" discussion is going over there: https://forum.doom9.org/showthread.php?t=183717
VoodooFX is offline   Reply With Quote
Old 20th January 2022, 20:22   #6  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
You are so right. -> deleted post.

Here's a small sample where I take a source, split it and stack
Code:
original  |   Y
U         |   U
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="G:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_6c441f37d9750b62d59f16ecdbd59393_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
original = clip

clipY,clipU,clipV = core.std.SplitPlanes(clip)
clipY = core.text.Text(clip=clipY,text="Y",alignment=7,scale=1)
clipY = core.resize.Bicubic(clip=clipY, width=clip.width, height=clip.height, format=vs.YUV420P8, range_s="limited")
clipU = core.text.Text(clip=clipU,text="U",alignment=7,scale=1)
clipU = core.resize.Bicubic(clip=clipU, width=clip.width, height=clip.height, format=vs.YUV420P8, range_s="limited")
clipV = core.text.Text(clip=clipV,text="V",alignment=7,scale=1)
clipV = core.resize.Bicubic(clip=clipV, width=clip.width, height=clip.height, format=vs.YUV420P8, range_s="limited")
stacked = core.std.StackVertical([core.std.StackHorizontal([clip,clipY]), core.std.StackHorizontal([clipU,clipV])])

# set output frame rate to 25.000fps
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=25, fpsden=1)
# Output
stacked.set_output()


Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 20th January 2022 at 20:27.
Selur is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.