View Full Version : 3D convert
Pr07o7yp3
26th July 2010, 16:27
Hello guys, I'm new in this forum and I'm not sure that is correctly place of this thread.
However, I need from yours help to transform this code that to look like optimized anaglyph method of this page http://mitglied.multimania.de/stereo3d/anaglyphcomparison.htm
Ok, the code which I have is that:
video2d = DirectShowSource("video.avi")
video2d = video2d.Tweak(Bright=10)
video2d = ConvertToRGB32(video2d)
videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 100)
CropW = (ResW - videoW) / 2
f1 = video2d
f2 = DeleteFrame(video2d, 0)
f1 = LanczosResize(f1, ResW, videoH)
f1 = Crop(f1, 0, 0, videoW, videoH)
f2 = LanczosResize(f2, ResW, videoH)
f2 = Crop(f2, CropW, 0, videoW, videoH)
MergeRGB(f2.ShowRed, f1.ShowGreen, f1.ShowBlue)
It must to transform 2D to 3D video like optimized anaglyph method.
The code works, but there are different between my code and optimized anaglyph method.
I would be grateful if you help me. :)
BTW: Sorry for my English. I'm still learn it.
fenomeno83
27th July 2010, 19:33
there are 2 main script to trasform 2d into 3d (are proposed many output format..you can uncomment which you want..by default I uncommented anaglyph red and cyan output so you can use avs in what player do you want..but I prefer use Side by Side L/R output and manage it with stereoscopic player (where you can set output that you want, as anaglyph red and cyan, optimized etc)..this means that using side by side I open avs script with stereoscopic player)
first method (faster)
## 2D to 3D Realtime Video Conversion Avisynth script v0.3b MultiThreading
## Made by Anton Belev at 3D Vision Blog
## http://www.3dvision-blog.com
## Additionally extended by Martin Haverland at audiomh.de for quality resize
## and different output modes including interlaced format for use in non-3d specific players e.g. windows media player.
## For this to work you need to have AviSynth with MT mod 0.7 installed!!!
SetMTMode(2,0)
## Open the video file for conversion, change the video file name
video=FFVideoSource ("C:\Video031.mp4")
audio=FFAudioSource("C:\Video031.mp4")
video2d = AudioDub(video,audio)
## Increase video brightnes on dark videos, good for 3D Vision owners
# video2d = video2d.Tweak(Bright=10)
## Convert to RGB32 to avoid the width restrictions
video2d = ConvertToRGB32(video2d)
## Optional aspect ratio maintaining quality resize for 3d monitor target resolution.
## Very cpu intensive, may be for offline use only, e.g. in virtualdubmod.
## 2x 3.0ghz cpu may give you a framerate of 16fps while running the whole script in virtualdubmod including xvid compression in HDTV quality saving setting.
## Offers great quality in the result video for fullscreen playback in every .avs capable player later.
## Also reduces ghosting if the original file resolution is smaller than the target resolution.
# videoW = width(video2d)
# videoH = height(video2d)
## For 19" Zalman use 1280, for 22" Zalman Trimon it is 1680 etc.
# hzTargetSize = 1280
# video2d = Lanczos4Resize(video2d, hzTargetsize, hzTargetsize * videoH / videoW)
## Commenting out the above resizing maintains realtime capability!
## Get video width/height and set the frame stretch factor
## Lower the value 100 to increase frame stretch, may introduce ghosting
videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 100)
CropW = (ResW - videoW) / 2
## Create variables for left and right frame with one frame difference
## This is the Plufrich-like simulation that creates illusion of depth from movement
f1 = video2d
f2 = DeleteFrame(video2d, 0)
## Stretch the right frame to further the depth effect
f1 = LanczosResize(f1, ResW, videoH)
f1 = Crop(f1, 0, 0, videoW, videoH)
## Stretch the left frame to further the depth effect
f2 = LanczosResize(f2, ResW, videoH)
f2 = Crop(f2, CropW, 0, videoW, videoH)
## Output the two video frames in a side-by-side / parallel format
## Use this as a default for playing back on 3D Vision (Side by Side L/R)
#StackHorizontal(f2, f1)
## Output the two video frames in a Above/Below format (like Sony?)
# StackVertical(f2,f1)
## Output the two video frames in a page flipping format for shutter glasses etc.
## The Tweak as proposed by eslave is for brighter image, modify the value 30
# f1 = f1.ConvertToYV12.Tweak(Bright=30)
# f2 = f2.ConvertToYV12.Tweak(Bright=30)
# Interleave(f2,f1)
## Output the two video frames in anaglyph red-cyan as proposed by eslave
MergeRGB(f2.ShowRed, f1.ShowGreen, f1.ShowBlue)
## For reversed anaglyph i.e. cyan-red
# MergeRGB(f1.ShowRed, f2.ShowGreen, f2.ShowBlue)
## Output the two video frames in anaglyph yellow-blue as proposed by eslave (untested)
# f1 = f1.ConvertToYV12(matrix="PC.601").tweak(bright=12.5, sat=1.25, coring=false)
# f1 = f1.ConvertToRGB32
# f1 = f1.Levels(0, 1.05, 255, 0, 255, coring=false)
# MergeRGB(f2.ShowRed, f1.ShowGreen, f1.ShowBlue)
## Output the two video frames in anaglyph blue-Yellow as proposed by eslave (untested)
# f2 = f2.ConvertToYV12(matrix="PC.601").tweak(bright=12.5, sat=1.25, coring=false)
# f2 = f2.ConvertToRGB32
# f2 = f2.Levels(0, 1.05, 255, 0, 255, coring=false)
# MergeRGB(f1.ShowRed, f2.ShowGreen, f2.ShowBlue)
## Output two video frames in Interlaced mode
## Ueed for Zalman Trimon, Acer Aspire 3D etc.
# f1 = SeparateFields(f1)
# f1 = SelectEven(f1)
# f2 = SeparateFields(f2)
# f2 = SelectOdd(f2)
# interleave(f2,f1)
# AssumeFieldBased()
# weave()
fenomeno83
27th July 2010, 19:33
the second (slower)
################################################################
# 2D to 3D CONVERSION
# Copyright (C) 2010 under GPL by Branko Jermanis <branko.jermanis@hi.hinet.hr>
# My web pages: "Nikola Tesla and My Thoughts": http://free-ri.htnet.hr/Branko/index.html
#
# This codes are based on 2d-to-3d-03b.avs script from Anton Belev at 3D Vision Blog (http://www.3dvision-blog.com),
# and some ideas from fauxD code from eslave,
# and Caleb Davis ideas with light depth detection codes,
# with indirect help of all that create this Avisynth language and useful plugin functions. Thanks to all...
# Tools that I use:
# 1. Avisynth video scripting language
# 2. AvsP script editor
# 3. VirtualDub video editor (I use xvid compression for avi output)
# 4. Media Player Classic
# 5. Download helper for Firefox browser (download from YouTube...)
# 6. WinFF convertor (flv to xvid conversion ...)
# For multimedia linux, I sugest Mint audio/video distribution:
# (I add real time kernel, JACK, Ardour, Hidrogen, Rosegarden... with M-Audio 1010LT sound card)
# Tip: press ESC for Grub, add gksudo in properties of icons, disable Timidity server on start and add starting line in JACK
#############
SetMTMode(4, 1) # For multicore procesor (you need copy MT.dll and its avisynth.dll in .../windows/system32 directory)
# It can crash...
#Technical info from MT documentation:
#It contains the two new functions SetMTMode() and GetMTMode() and is needed by MT.dll.
#Install it by overwriting avisynth.dll in your c:\windows\system32 (and remember to take a backup of the old file first)
#On linux with Wine, I have with standard Avisynth version around 4 frame for second (Phenom II 4x) without MT version (MT don't work on linux for me) with DVD quality (~480p)
LoadPlugin ("mvtools2.dll") # Movement detector (some old version has problem with blksize=32)
# Input file ( minimum DVD: 480p video)
video=FFVideoSource("C:\Video031.mp4").ConvertToYV12
audio=FFAudioSource("C:\Video031.mp4")
fl = AudioDub(video,audio)
# Input on linux (it need Wine for VirtualDub, and disable DirectX in preference if you have black screen like me):
#fL = AVISource("Voyager-S1-10.avi").ConvertToYV12 # For linux input I use xvid avi format, because DirectShow don't work. With dvd-rip I transcode to xvid with 480p quality. Sometimes it need recompress XVID or 'normal recompress mode' conversion, if 'full processing mode' don't work.
# Try to chose right bright, contrast and saturation for bad looking video:
#fL = Tweak(fL, bright=10, cont=1.25, sat=1.25, coring=false) # Dark video correction ( disable this line if video look good, and is not dark)
W = width(fL)
H = height(fL)
fR = DeleteFrame(fL, 0) # Set the right frame with one frame difference
# If W is less than 640, algorithm for light depth will not work good enough (integer number will eat pixels, because it depend of dW/2).
dW = W / 128 # More depth perception, but little more artifact on details (it is usefull for me on 640x480 video)
fL = ConvertToRGB32(fL) # Input in RGB, because of 'crop-even' problem with YV12 (on some movie)
###################### M O T I O N D E P T H D E T E C T I O N ###############
## Motion mask:
super = MSuper(fR)
bvectors = MAnalyse(super, isb = true, blksize=32) # greatest blocksize, less problem with picture and best speed (I have been reported that on Vista 64 bit has error with 32 with some old version of mvtools2.dll).
m = MMask(fR, bvectors, kind=3, ml=1)
m = RGBAdjust(ConvertToRGB32(m),1,1,1,1,-127,-255,-255)
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1).Invert
fR = ConvertToRGB32(fR)
# Replace moving object on frame with oposite movement from next frame (copy/paste from R to L):
m = Layer( fL, Mask(fR, m1) )
fL = Layer( fR, Mask(fL, m1) )
fR = m
# Posible improvement in this part of code :
# 1. Some detection when camera rotate around object create oposite Pulfrich effect, and then it need oposite switching left/right frames (rare condition)
# 2. With high speed vertical movement, frames are too different and create bad visual overlap, and it will be better switch off this cut/paste system
###################### LIGHTING DEPTH DETECTION ( ideas from Caleb Davis code) ####################
# On 0.5 version I replace Overlay with Layer function. It is faster function (2x)...
# Add more pixels for less than HD video resolution because quality and depth improvement (for HD can be disabled, because of speed):
W = 2*W
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
#Create L mask:
fG = Greyscale(fL)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255) # For light scenes
m2 = RGBAdjust(fG, 1,1,1,1, -60,-255,-255) # For dark scenes
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "60") # Switch light/dark scenes
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fL = Layer(fL, Mask(fL, m12), x= dW/2) # move light part of picture to right on L frame (and remove borders too)
fL = Layer(fL, Mask(fL, m12.Invert), x= -1*dW/2) # move dark part of picture to left on L frame
#Create R mask:
fG = Greyscale(fR)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255)
m2 = RGBAdjust(fG, 1,1,1,1, -70,-255,-255)
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "70")
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fR = Layer(fR, Mask(fR, m12.Invert), x= dW/2) # move dark part of picture to right on R frame
fR = Layer(fR, Mask(fR, m12), x= -1*dW/2) # move light part of picture to left on R frame
# Going back to standard input Width (for HD can be disabled, because of speed):
W = W/2
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
# Posible improvement in this part of code :
# 1. Sometimes background is more white than foreground. Then it will be better if this is in reverse.
#################### OUTPUT TO GLASSES: #############################
### UNIVERZAL FILE FORMAT OUTPUT (FOR ENCODING):
# If you need ColorCode format output from this file, you can use my YouTube3D.avs script to convert with VirtualDub
##side by side L/R
#return StackHorizontal(fL, fR)
##above below
#return StackVertical(fL, fR)
# Or found some standard format (Colorcode?) with some differences information (put around picture)...
### ColorCode, Intel InTrue3d ( brown/blue glasses for best color viewing with standard 60-70 Hz LCD monitors):
# Plastic glasses from xinan8888 (China) on eBay is 9 $ for 6 pair (I didn't try it yet, but look good. ColorCode plastic is around 40$ for 1 pair.)
# Improvement in blue color: Need less blue color when blue is not part of other color ( R and/or G ).
# Example: blue sky with white clouds.
#fRa = MergeRGB(fR.ShowBlue, fR.ShowBlue, fR.ShowBlue)
#m = Subtract(fRa, Greyscale(fR)).Levels(220, 1, 222, 0, 255) # Diference of blue and greyscale can extract just blue places
#fRb=RGBAdjust(fR, 1, 1, 1, 1, 0, 0, -50) # Corection on blue intensity if blue is not part of other colors
#fR = Layer(fR, Mask(fRb, m))
# Mask for reducing yellow and blue ghosting:
#m1=RGBAdjust(Subtract(fL, fR), 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Yellow
#m2=RGBAdjust(Subtract(fL, fR).Invert, 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Blue
#fL=RGBAdjust(fL, 1, 1, 1, 1, 0, -10, -255) # Going down with all green color because of difference on amber filter
#fR=RGBAdjust(fR, 1, 1, 1, 1, -255, -255, 10) # Going up with all blue color because of dark blue filter
#fR = Greyscale(fR)
#out = MergeRGB(fL.ShowRed, fL.ShowGreen, fR.ShowBlue) # Output before blue/yellow line intensity correction
#out1=RGBAdjust(out, 1, 1, 1, 1, -20, -20, 0).Levels(0, 1, 255, 30, 250) # Correction inside yellow depth lines
#out2 = Layer(out, Mask(out1, m1))
#out3=RGBAdjust(out, 1, 1, 1, 1, 0, 0, -30).Levels(0, 1, 255, 0, 220) # Correction inside blue depth lines
#out = Layer(out2, Mask(out3, m2)) # Main output after blue/yellow line intensity correction
# Posible improvement in this part of code :
# Need better filters for blue (green passing problem) and yellow (blue passing problem).
# I am optimize this code for card glasses. I wait for china plastic glasses, to see its filters.
# China glasses are come after 1 month of waiting. Nice look and feel, better transparancy, but little more ghosting. On version 0.75, I try to optimize it.
# On my 2Dto3D conversion look good, but with real 3D it has ghost problem with high depth part of scenes.
# Because of that ghosting, I reduce blue and yellow line intensity. Scenes in focus look good and for my low-level depth conversion this glasses are good enough.
# Solutions: maybe metalic filters on glass (like filters in Dolby glasses with 6 color) will improve this viewing system. But I can't find this 'perfect' filter glasses...
#return out
### Red-cyan glasses (because of red color problem, I don't use them):
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
################## TECHNOLOGICAL INFO: #########################
### Good FPS conversion algorithm:
#super = MSuper(video)
#bvectors = MAnalyse(super, isb = true, blksize=4, chroma=true, truemotion=true, search = 3)
#fvectors = MAnalyse(super, isb = false, blksize=4, chroma=true, truemotion=true, search = 3 )
#video = MFlowFps(video, super, bvectors, fvectors, num=60, den=1) # going to 60 fps
# Interesting setup:
# 1. DLP projector (ViewSonic 120Hz PJD6211 or better)
# 2. DLP-link active switching glasses without connection or emitters: XpanD X102
# 3. We need white LED emmiters (and electronic) for simulate this white flash from projector for possible using this kind of glasses on 120 Hz monitors.
# (white flash sync is when active glasses are in switching position, and both eyes are black)
# VirtualDub can open this script. Chose video-compress-xvid, and than Save as AVI, can create useful output file.
# You need lot of CPU power...
ConvertToYV12()
instead here there is an avisinth tool to manage video between different 3d format with very easy functions (not 2d to 3d)
http://www.pantarheon.org/AviSynth3DToolbox/
Jeremy Duncan
30th July 2010, 00:23
This part of the code confuses me:
### UNIVERZAL FILE FORMAT OUTPUT (FOR ENCODING):
# If you need ColorCode format output from this file, you can use my YouTube3D.avs script to convert with VirtualDub
##side by side L/R
#return StackHorizontal(fL, fR)
##above below
#return StackVertical(fL, fR)
# Or found some standard format (Colorcode?) with some differences information (put around picture)...
### ColorCode, Intel InTrue3d ( brown/blue glasses for best color viewing with standard 60-70 Hz LCD monitors):
# Plastic glasses from xinan8888 (China) on eBay is 9 $ for 6 pair (I didn't try it yet, but look good. ColorCode plastic is around 40$ for 1 pair.)
# Improvement in blue color: Need less blue color when blue is not part of other color ( R and/or G ).
# Example: blue sky with white clouds.
#fRa = MergeRGB(fR.ShowBlue, fR.ShowBlue, fR.ShowBlue)
#m = Subtract(fRa, Greyscale(fR)).Levels(220, 1, 222, 0, 255) # Diference of blue and greyscale can extract just blue places
#fRb=RGBAdjust(fR, 1, 1, 1, 1, 0, 0, -50) # Corection on blue intensity if blue is not part of other colors
#fR = Layer(fR, Mask(fRb, m))
# Mask for reducing yellow and blue ghosting:
#m1=RGBAdjust(Subtract(fL, fR), 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Yellow
#m2=RGBAdjust(Subtract(fL, fR).Invert, 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Blue
#fL=RGBAdjust(fL, 1, 1, 1, 1, 0, -10, -255) # Going down with all green color because of difference on amber filter
#fR=RGBAdjust(fR, 1, 1, 1, 1, -255, -255, 10) # Going up with all blue color because of dark blue filter
#fR = Greyscale(fR)
#out = MergeRGB(fL.ShowRed, fL.ShowGreen, fR.ShowBlue) # Output before blue/yellow line intensity correction
#out1=RGBAdjust(out, 1, 1, 1, 1, -20, -20, 0).Levels(0, 1, 255, 30, 250) # Correction inside yellow depth lines
#out2 = Layer(out, Mask(out1, m1))
#out3=RGBAdjust(out, 1, 1, 1, 1, 0, 0, -30).Levels(0, 1, 255, 0, 220) # Correction inside blue depth lines
#out = Layer(out2, Mask(out3, m2)) # Main output after blue/yellow line intensity correction
# Posible improvement in this part of code :
# Need better filters for blue (green passing problem) and yellow (blue passing problem).
# I am optimize this code for card glasses. I wait for china plastic glasses, to see its filters.
# China glasses are come after 1 month of waiting. Nice look and feel, better transparancy, but little more ghosting. On version 0.75, I try to optimize it.
# On my 2Dto3D conversion look good, but with real 3D it has ghost problem with high depth part of scenes.
# Because of that ghosting, I reduce blue and yellow line intensity. Scenes in focus look good and for my low-level depth conversion this glasses are good enough.
# Solutions: maybe metalic filters on glass (like filters in Dolby glasses with 6 color) will improve this viewing system. But I can't find this 'perfect' filter glasses...
#return out
### Red-cyan glasses (because of red color problem, I don't use them):
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
I want stacked horizontally.
here is the code i'm using now and it looks ugly:
SetMTMode(4, 1) # For multicore procesor (you need copy MT.dll and its avisynth.dll in .../windows/system32 directory)
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mt.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mvtools2.dll") # Movement detector (some old version has problem with blksize=32)
video=mpeg2Source("C:\Documents and Settings\Duncan\Desktop\source.d2v").ConvertToYV12
fl = video
W = width(fL)
H = height(fL)
fR = DeleteFrame(fL, 0) # Set the right frame with one frame difference
dW = W / 128 # More depth perception, but little more artifact on details (it is usefull for me on 640x480 video)
fL = ConvertToRGB32(fL) # Input in RGB, because of 'crop-even' problem with YV12 (on some movie)
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR)
bvectors = MAnalyse(super, isb = true, blksize=32) # greatest blocksize, less problem with picture and best speed (I have been reported that on Vista 64 bit has error with 32 with some old version of mvtools2.dll).
m = MMask(fR, bvectors, kind=3, ml=1)
m = RGBAdjust(ConvertToRGB32(m),1,1,1,1,-127,-255,-255)
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1).Invert
fR = ConvertToRGB32(fR)
m = Layer( fL, Mask(fR, m1) )
fL = Layer( fR, Mask(fL, m1) )
fR = m
W = 2*W
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
fG = Greyscale(fL)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255) # For light scenes
m2 = RGBAdjust(fG, 1,1,1,1, -60,-255,-255) # For dark scenes
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "60") # Switch light/dark scenes
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fL = Layer(fL, Mask(fL, m12), x= dW/2) # move light part of picture to right on L frame (and remove borders too)
fL = Layer(fL, Mask(fL, m12.Invert), x= -1*dW/2) # move dark part of picture to left on L frame
fG = Greyscale(fR)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255)
m2 = RGBAdjust(fG, 1,1,1,1, -70,-255,-255)
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "70")
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fR = Layer(fR, Mask(fR, m12.Invert), x= dW/2) # move dark part of picture to right on R frame
fR = Layer(fR, Mask(fR, m12), x= -1*dW/2) # move light part of picture to left on R frame
W = W/2
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
#################### OUTPUT TO GLASSES: #############################
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
################## TECHNOLOGICAL INFO: #########################
ConvertToYV12()
Am I doing it wrong? I'm opening the script in megui and I'm using my ntsc test disk: 23.976 fps, ntsc, pulldown, 4:3 aspect ratio
(http://www.mediafire.com/?xfetd323l42dqcm)
fenomeno83
30th July 2010, 01:11
This part of the code confuses me:
### UNIVERZAL FILE FORMAT OUTPUT (FOR ENCODING):
# If you need ColorCode format output from this file, you can use my YouTube3D.avs script to convert with VirtualDub
##side by side L/R
#return StackHorizontal(fL, fR)
##above below
#return StackVertical(fL, fR)
# Or found some standard format (Colorcode?) with some differences information (put around picture)...
### ColorCode, Intel InTrue3d ( brown/blue glasses for best color viewing with standard 60-70 Hz LCD monitors):
# Plastic glasses from xinan8888 (China) on eBay is 9 $ for 6 pair (I didn't try it yet, but look good. ColorCode plastic is around 40$ for 1 pair.)
# Improvement in blue color: Need less blue color when blue is not part of other color ( R and/or G ).
# Example: blue sky with white clouds.
#fRa = MergeRGB(fR.ShowBlue, fR.ShowBlue, fR.ShowBlue)
#m = Subtract(fRa, Greyscale(fR)).Levels(220, 1, 222, 0, 255) # Diference of blue and greyscale can extract just blue places
#fRb=RGBAdjust(fR, 1, 1, 1, 1, 0, 0, -50) # Corection on blue intensity if blue is not part of other colors
#fR = Layer(fR, Mask(fRb, m))
# Mask for reducing yellow and blue ghosting:
#m1=RGBAdjust(Subtract(fL, fR), 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Yellow
#m2=RGBAdjust(Subtract(fL, fR).Invert, 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Blue
#fL=RGBAdjust(fL, 1, 1, 1, 1, 0, -10, -255) # Going down with all green color because of difference on amber filter
#fR=RGBAdjust(fR, 1, 1, 1, 1, -255, -255, 10) # Going up with all blue color because of dark blue filter
#fR = Greyscale(fR)
#out = MergeRGB(fL.ShowRed, fL.ShowGreen, fR.ShowBlue) # Output before blue/yellow line intensity correction
#out1=RGBAdjust(out, 1, 1, 1, 1, -20, -20, 0).Levels(0, 1, 255, 30, 250) # Correction inside yellow depth lines
#out2 = Layer(out, Mask(out1, m1))
#out3=RGBAdjust(out, 1, 1, 1, 1, 0, 0, -30).Levels(0, 1, 255, 0, 220) # Correction inside blue depth lines
#out = Layer(out2, Mask(out3, m2)) # Main output after blue/yellow line intensity correction
# Posible improvement in this part of code :
# Need better filters for blue (green passing problem) and yellow (blue passing problem).
# I am optimize this code for card glasses. I wait for china plastic glasses, to see its filters.
# China glasses are come after 1 month of waiting. Nice look and feel, better transparancy, but little more ghosting. On version 0.75, I try to optimize it.
# On my 2Dto3D conversion look good, but with real 3D it has ghost problem with high depth part of scenes.
# Because of that ghosting, I reduce blue and yellow line intensity. Scenes in focus look good and for my low-level depth conversion this glasses are good enough.
# Solutions: maybe metalic filters on glass (like filters in Dolby glasses with 6 color) will improve this viewing system. But I can't find this 'perfect' filter glasses...
#return out
### Red-cyan glasses (because of red color problem, I don't use them):
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
I want stacked horizontally.
here is the code i'm using now and it looks ugly:
SetMTMode(4, 1) # For multicore procesor (you need copy MT.dll and its avisynth.dll in .../windows/system32 directory)
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mt.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mvtools2.dll") # Movement detector (some old version has problem with blksize=32)
video=mpeg2Source("C:\Documents and Settings\Duncan\Desktop\source.d2v").ConvertToYV12
fl = video
W = width(fL)
H = height(fL)
fR = DeleteFrame(fL, 0) # Set the right frame with one frame difference
dW = W / 128 # More depth perception, but little more artifact on details (it is usefull for me on 640x480 video)
fL = ConvertToRGB32(fL) # Input in RGB, because of 'crop-even' problem with YV12 (on some movie)
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR)
bvectors = MAnalyse(super, isb = true, blksize=32) # greatest blocksize, less problem with picture and best speed (I have been reported that on Vista 64 bit has error with 32 with some old version of mvtools2.dll).
m = MMask(fR, bvectors, kind=3, ml=1)
m = RGBAdjust(ConvertToRGB32(m),1,1,1,1,-127,-255,-255)
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1).Invert
fR = ConvertToRGB32(fR)
m = Layer( fL, Mask(fR, m1) )
fL = Layer( fR, Mask(fL, m1) )
fR = m
W = 2*W
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
fG = Greyscale(fL)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255) # For light scenes
m2 = RGBAdjust(fG, 1,1,1,1, -60,-255,-255) # For dark scenes
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "60") # Switch light/dark scenes
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fL = Layer(fL, Mask(fL, m12), x= dW/2) # move light part of picture to right on L frame (and remove borders too)
fL = Layer(fL, Mask(fL, m12.Invert), x= -1*dW/2) # move dark part of picture to left on L frame
fG = Greyscale(fR)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255)
m2 = RGBAdjust(fG, 1,1,1,1, -70,-255,-255)
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "70")
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fR = Layer(fR, Mask(fR, m12.Invert), x= dW/2) # move dark part of picture to right on R frame
fR = Layer(fR, Mask(fR, m12), x= -1*dW/2) # move light part of picture to left on R frame
W = W/2
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
#################### OUTPUT TO GLASSES: #############################
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
################## TECHNOLOGICAL INFO: #########################
ConvertToYV12()
Am I doing it wrong? I'm opening the script in megui and I'm using my ntsc test disk: 23.976 fps, ntsc, pulldown, 4:3 aspect ratio
(http://www.mediafire.com/?xfetd323l42dqcm)
this generate anaglyph red and cyan..
if you want stack horizzontal (side by side L/R)
delete
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue
and add
return StackHorizontal(fL, fR)
before than
ConvertToYV12()
so side by side you can manage with stereoscopic player
Jeremy Duncan
30th July 2010, 07:09
This is the code I tweaked. It has no halos and it's a lot more detailed than the one posted before by fenomeno83.
I will share the code I tweaked for better resolution and picture:
new code in new thread about 3D trailers. Use the forum search function to find it.
However I suffer from the picture being squeezed and losing resolution - it's not good for my test disk with is basically a resolution test disk. I mean it works, but it's not what I was looking for when I show the public my test disk.
What I want is frame sequential 3d so I can keep full resolution and not squeeze the picture.
I am wondering if you can post a script that has frame sequential 3d?
edit. I will post the 3D version of my test disk. I don't know how it looks on a 3D tv though since I haven't bought one yet.
I hope it looks good on a 3D tv? :)
Link removed
Want to try but don't know how. I will tell you how I did it:
Run the vob through dgindex, then put the d2v in the code. (see code for where I put the d2v)
Open megui and set it to avchd profile and set the presets to very slow.
Press encode and it will encode it for you. I don't know how to add sound though, I never learned how using a avs script. I always use megui muxer but that's only for 2d, I never added sound to a 3d video before.
Jeremy Duncan
30th July 2010, 18:16
I want to add some code to this script but don't know how.
This is the code I want to alter from my previous post in this thread:
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR,pel=2, hpad=16, vpad=16)
bvectors = MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
m = MMask(fR, bvectors, kind=0, ml=50)
I want to add this code:
backward_1=MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
forward_1=MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, search=5, searchparam=2, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=2)
Here is what I tried and it didn't work:
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR,pel=2, hpad=16, vpad=16)
bvectors_1 = MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
bvectors_2 = MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, search=5, searchparam=2, badrange=(-24))
bvectors_3 = MRecalculate(super, chroma=false, bvectors_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
bvectors_4 = MRecalculate(super, chroma=false, bvectors_2, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=2)
m = MMask(fR, bvectors_3, bvectors_4, kind=0, ml=50)
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR,pel=2, hpad=16, vpad=16)
bvectors = MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24)).MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, search=5, searchparam=2, badrange=(-24)).MRecalculate(super, chroma=false, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1).MRecalculate(super, chroma=false, forward_1, blksizev=32, thSAD=100, search=5, searchparam=2)
m = MMask(fR, bvectors, kind=0, ml=50)
Can I ask they somebody please post the correct way so I don't get any error? :thanks:
fenomeno83
31st July 2010, 10:01
you can go in the original forums that created this scripts:
http://3dvision-blog.com/forum/
and
http://free-ri.htnet.hr/Branko/
Jeremy Duncan
31st July 2010, 14:27
I got some work done, but it seems that mvtools2 needs both frames and doesn't work with DeleteFrame(fL, 0).
http://thumbnails22.imagebam.com/9097/03b82590963445.jpg (http://www.imagebam.com/image/03b82590963445)
"avisynth script error:
MRecalculate: super clip does not contain needed color data"
SetMTMode(4, 1) # For multicore procesor (you need copy MT.dll and its avisynth.dll in .../windows/system32 directory)
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mt.dll")
LoadPlugin ("C:\Program Files\AviSynth 2.5\plugins\mvtools2.dll") # Movement detector (some old version has problem with blksize=32)
video=mpeg2Source("C:\Documents and Settings\Duncan\Desktop\source.d2v").ConvertToYV12
fl = video
W = width(fL)
H = height(fL)
fR = DeleteFrame(fL, 0) # Set the right frame with one frame difference
dW = W / 80 # More depth perception, but little more artifact on details (it is usefull for me on 640x480 video)
fL = ConvertToRGB32(fL) # Input in RGB, because of 'crop-even' problem with YV12 (on some movie)
###################### M O T I O N D E P T H D E T E C T I O N ###############
Super = MSuper(fR, pel=2, hpad=16, vpad=16)
bvectors = MAnalyse(Super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
fR.MRecalculate(bvectors, chroma=false, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
m = MMask(fR, MRecalculate, kind=0, ml=50)
I haven't got to the bolded part yet without that error so I don't know if it works or not.
So it looks like I'm going to have to ask Fizick for some help and maybe he will update mvtools 2 so it works with delete frame adjusting the right frame.
Didée
31st July 2010, 16:55
You have several errors in handing paramters to a filter.
From post#7 above:
I want to add this code:
backward_1=MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
forward_1=MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, search=5, searchparam=2, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=2)
Here is what I tried and it didn't work:
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR,pel=2, hpad=16, vpad=16)
bvectors_1 = MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
bvectors_2 = MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, search=5, searchparam=2, badrange=(-24))
bvectors_3 = MRecalculate(super, chroma=false, bvectors_1, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
bvectors_4 = MRecalculate(super, chroma=false, bvectors_2, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=2)
m = MMask(fR, bvectors_3, bvectors_4, kind=0, ml=50)
In a filter call, you cannot use unnamed parameters after having used named paramters.
Also, the vector clips (backward_1/forward_1) must be the 2nd parameter given to MRecalculate. (The 1st is the 'super' clip.) The correct order of parameters is given in MVTools' documentation. Read that more closely.
###################### M O T I O N D E P T H D E T E C T I O N ###############
super = MSuper(fR,pel=2, hpad=16, vpad=16)
bvectors = [removed_very_long_line]
m = MMask(fR, bvectors, kind=0, ml=50)
In short, that [removed_very_long_line] reads
bvectors = MAnalyse(super).MAnalyse(super).MRecalculate(super).MRecalculate(super)
I'm not going to explain why that doesn't work ... it's so obviously wrong.
From the last post:
###################### M O T I O N D E P T H D E T E C T I O N ###############
Super = MSuper(fR, pel=2, hpad=16, vpad=16)
bvectors = MAnalyse(Super, chroma=false, isb=true, blksize=32, blksizev=32, search=5, searchparam=1, badrange=(-24))
fR.MRecalculate(bvectors, chroma=false, blksize=32, blksizev=32, thSAD=100, search=5, searchparam=1)
m = MMask(fR, MRecalculate, kind=0, ml=50)
You have no super clip at all in the blue line. Instead you're referring to the "fR" clip, which can't work. fR is a normal clip, but you need a super clip from MSuper().
In the "m=..." line, there should probably be "last" instead of "MRecalculate".
Really, you have to pay more attention to correct parameter handling. It's a basic necessity that you hand the correct parameters in the correct order to any filter. Without correct syntax/grammar, things won't work. Simple as that.
Regarding the "trimmed-by-one" issue, it seems pretty wrong to me to trim an input clip, then trying to adjust the now-off-by-one-frame vectors with MRecalculate. Correct way would be to do the initial vector search between the corresponding frames.
There's too much vagueness from those various errors, therefore I can't give a "correct" script.
Pr07o7yp3
2nd August 2010, 17:34
fenomeno83, thanks but you gave me code from 3dvision-blog.
I just want to change my code that it look like optimized anaglyph method from this page http://mitglied.multimania.de/stereo3d/anaglyphcomparison.htm :)
fenomeno83
3rd August 2010, 10:33
mmm..\I don't know..you can ask there...
I had similar quesrtion because I like several algorithm that applies stereoscopic player and I can't repropose in an avs script..
I solved recording with fraps the stereoscopic output and after encoding with ripbot264 in h264
if you want only a realtime view, leave in avs script 2d->3d from 3dvisionblog the side by side output(stackhorizzontal), so when you open with stereoscopic player will have a side by side input and you can set anaglyph optimized red and cyan output for example
mariner
19th December 2010, 14:53
the second (slower)
################################################################
# 2D to 3D CONVERSION
# Copyright (C) 2010 under GPL by Branko Jermanis <branko.jermanis@hi.hinet.hr>
# My web pages: "Nikola Tesla and My Thoughts": http://free-ri.htnet.hr/Branko/index.html
#
# This codes are based on 2d-to-3d-03b.avs script from Anton Belev at 3D Vision Blog (http://www.3dvision-blog.com),
# and some ideas from fauxD code from eslave,
# and Caleb Davis ideas with light depth detection codes,
# with indirect help of all that create this Avisynth language and useful plugin functions. Thanks to all...
# Tools that I use:
# 1. Avisynth video scripting language
# 2. AvsP script editor
# 3. VirtualDub video editor (I use xvid compression for avi output)
# 4. Media Player Classic
# 5. Download helper for Firefox browser (download from YouTube...)
# 6. WinFF convertor (flv to xvid conversion ...)
# For multimedia linux, I sugest Mint audio/video distribution:
# (I add real time kernel, JACK, Ardour, Hidrogen, Rosegarden... with M-Audio 1010LT sound card)
# Tip: press ESC for Grub, add gksudo in properties of icons, disable Timidity server on start and add starting line in JACK
#############
SetMTMode(4, 1) # For multicore procesor (you need copy MT.dll and its avisynth.dll in .../windows/system32 directory)
# It can crash...
#Technical info from MT documentation:
#It contains the two new functions SetMTMode() and GetMTMode() and is needed by MT.dll.
#Install it by overwriting avisynth.dll in your c:\windows\system32 (and remember to take a backup of the old file first)
#On linux with Wine, I have with standard Avisynth version around 4 frame for second (Phenom II 4x) without MT version (MT don't work on linux for me) with DVD quality (~480p)
LoadPlugin ("mvtools2.dll") # Movement detector (some old version has problem with blksize=32)
# Input file ( minimum DVD: 480p video)
video=FFVideoSource("C:\Video031.mp4").ConvertToYV12
audio=FFAudioSource("C:\Video031.mp4")
fl = AudioDub(video,audio)
# Input on linux (it need Wine for VirtualDub, and disable DirectX in preference if you have black screen like me):
#fL = AVISource("Voyager-S1-10.avi").ConvertToYV12 # For linux input I use xvid avi format, because DirectShow don't work. With dvd-rip I transcode to xvid with 480p quality. Sometimes it need recompress XVID or 'normal recompress mode' conversion, if 'full processing mode' don't work.
# Try to chose right bright, contrast and saturation for bad looking video:
#fL = Tweak(fL, bright=10, cont=1.25, sat=1.25, coring=false) # Dark video correction ( disable this line if video look good, and is not dark)
W = width(fL)
H = height(fL)
fR = DeleteFrame(fL, 0) # Set the right frame with one frame difference
# If W is less than 640, algorithm for light depth will not work good enough (integer number will eat pixels, because it depend of dW/2).
dW = W / 128 # More depth perception, but little more artifact on details (it is usefull for me on 640x480 video)
fL = ConvertToRGB32(fL) # Input in RGB, because of 'crop-even' problem with YV12 (on some movie)
###################### M O T I O N D E P T H D E T E C T I O N ###############
## Motion mask:
super = MSuper(fR)
bvectors = MAnalyse(super, isb = true, blksize=32) # greatest blocksize, less problem with picture and best speed (I have been reported that on Vista 64 bit has error with 32 with some old version of mvtools2.dll).
m = MMask(fR, bvectors, kind=3, ml=1)
m = RGBAdjust(ConvertToRGB32(m),1,1,1,1,-127,-255,-255)
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1).Invert
fR = ConvertToRGB32(fR)
# Replace moving object on frame with oposite movement from next frame (copy/paste from R to L):
m = Layer( fL, Mask(fR, m1) )
fL = Layer( fR, Mask(fL, m1) )
fR = m
# Posible improvement in this part of code :
# 1. Some detection when camera rotate around object create oposite Pulfrich effect, and then it need oposite switching left/right frames (rare condition)
# 2. With high speed vertical movement, frames are too different and create bad visual overlap, and it will be better switch off this cut/paste system
###################### LIGHTING DEPTH DETECTION ( ideas from Caleb Davis code) ####################
# On 0.5 version I replace Overlay with Layer function. It is faster function (2x)...
# Add more pixels for less than HD video resolution because quality and depth improvement (for HD can be disabled, because of speed):
W = 2*W
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
#Create L mask:
fG = Greyscale(fL)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255) # For light scenes
m2 = RGBAdjust(fG, 1,1,1,1, -60,-255,-255) # For dark scenes
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "60") # Switch light/dark scenes
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fL = Layer(fL, Mask(fL, m12), x= dW/2) # move light part of picture to right on L frame (and remove borders too)
fL = Layer(fL, Mask(fL, m12.Invert), x= -1*dW/2) # move dark part of picture to left on L frame
#Create R mask:
fG = Greyscale(fR)
m1 = RGBAdjust(fG, 1,1,1,1, -127,-255,-255)
m2 = RGBAdjust(fG, 1,1,1,1, -70,-255,-255)
m = ConditionalFilter(m1, m1, m2, "AverageLuma(fG.ConvertToYV12)", ">", "70")
m1 = RGBAdjust(ShowRed(m), .5, .5, .5, 1,0,0,0,0,255,255,255,1)
m2 = Layer(m1, Mask(m1, m1), x= -1*dW, op="add") # Resize mask to left
m12 = Layer(m2, Mask(m1, m1), x= dW, op="add") # Resize mask to right
fR = Layer(fR, Mask(fR, m12.Invert), x= dW/2) # move dark part of picture to right on R frame
fR = Layer(fR, Mask(fR, m12), x= -1*dW/2) # move light part of picture to left on R frame
# Going back to standard input Width (for HD can be disabled, because of speed):
W = W/2
fL = LanczosResize(fL, W, H)
fR = LanczosResize(fR, W, H)
# Posible improvement in this part of code :
# 1. Sometimes background is more white than foreground. Then it will be better if this is in reverse.
#################### OUTPUT TO GLASSES: #############################
### UNIVERZAL FILE FORMAT OUTPUT (FOR ENCODING):
# If you need ColorCode format output from this file, you can use my YouTube3D.avs script to convert with VirtualDub
##side by side L/R
#return StackHorizontal(fL, fR)
##above below
#return StackVertical(fL, fR)
# Or found some standard format (Colorcode?) with some differences information (put around picture)...
### ColorCode, Intel InTrue3d ( brown/blue glasses for best color viewing with standard 60-70 Hz LCD monitors):
# Plastic glasses from xinan8888 (China) on eBay is 9 $ for 6 pair (I didn't try it yet, but look good. ColorCode plastic is around 40$ for 1 pair.)
# Improvement in blue color: Need less blue color when blue is not part of other color ( R and/or G ).
# Example: blue sky with white clouds.
#fRa = MergeRGB(fR.ShowBlue, fR.ShowBlue, fR.ShowBlue)
#m = Subtract(fRa, Greyscale(fR)).Levels(220, 1, 222, 0, 255) # Diference of blue and greyscale can extract just blue places
#fRb=RGBAdjust(fR, 1, 1, 1, 1, 0, 0, -50) # Corection on blue intensity if blue is not part of other colors
#fR = Layer(fR, Mask(fRb, m))
# Mask for reducing yellow and blue ghosting:
#m1=RGBAdjust(Subtract(fL, fR), 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Yellow
#m2=RGBAdjust(Subtract(fL, fR).Invert, 1, 1, 1, 1, 0, 0, 0).Levels(200, 1, 202, 0, 255).Greyscale # Blue
#fL=RGBAdjust(fL, 1, 1, 1, 1, 0, -10, -255) # Going down with all green color because of difference on amber filter
#fR=RGBAdjust(fR, 1, 1, 1, 1, -255, -255, 10) # Going up with all blue color because of dark blue filter
#fR = Greyscale(fR)
#out = MergeRGB(fL.ShowRed, fL.ShowGreen, fR.ShowBlue) # Output before blue/yellow line intensity correction
#out1=RGBAdjust(out, 1, 1, 1, 1, -20, -20, 0).Levels(0, 1, 255, 30, 250) # Correction inside yellow depth lines
#out2 = Layer(out, Mask(out1, m1))
#out3=RGBAdjust(out, 1, 1, 1, 1, 0, 0, -30).Levels(0, 1, 255, 0, 220) # Correction inside blue depth lines
#out = Layer(out2, Mask(out3, m2)) # Main output after blue/yellow line intensity correction
# Posible improvement in this part of code :
# Need better filters for blue (green passing problem) and yellow (blue passing problem).
# I am optimize this code for card glasses. I wait for china plastic glasses, to see its filters.
# China glasses are come after 1 month of waiting. Nice look and feel, better transparancy, but little more ghosting. On version 0.75, I try to optimize it.
# On my 2Dto3D conversion look good, but with real 3D it has ghost problem with high depth part of scenes.
# Because of that ghosting, I reduce blue and yellow line intensity. Scenes in focus look good and for my low-level depth conversion this glasses are good enough.
# Solutions: maybe metalic filters on glass (like filters in Dolby glasses with 6 color) will improve this viewing system. But I can't find this 'perfect' filter glasses...
#return out
### Red-cyan glasses (because of red color problem, I don't use them):
fL = Greyscale(fL)
return MergeRGB(fL.ShowRed, fR.ShowGreen, fR.ShowBlue)
################## TECHNOLOGICAL INFO: #########################
### Good FPS conversion algorithm:
#super = MSuper(video)
#bvectors = MAnalyse(super, isb = true, blksize=4, chroma=true, truemotion=true, search = 3)
#fvectors = MAnalyse(super, isb = false, blksize=4, chroma=true, truemotion=true, search = 3 )
#video = MFlowFps(video, super, bvectors, fvectors, num=60, den=1) # going to 60 fps
# Interesting setup:
# 1. DLP projector (ViewSonic 120Hz PJD6211 or better)
# 2. DLP-link active switching glasses without connection or emitters: XpanD X102
# 3. We need white LED emmiters (and electronic) for simulate this white flash from projector for possible using this kind of glasses on 120 Hz monitors.
# (white flash sync is when active glasses are in switching position, and both eyes are black)
# VirtualDub can open this script. Chose video-compress-xvid, and than Save as AVI, can create useful output file.
# You need lot of CPU power...
ConvertToYV12()
instead here there is an avisinth tool to manage video between different 3d format with very easy functions (not 2d to 3d)
http://www.pantarheon.org/AviSynth3DToolbox/
Greetings fenomeno83 and Jeremy,
You need to find 3 dll library: mvtools2.dll, reform.dll and faudD.dll from other Avisynth and 3D projects.
1. Do you know where I can find these plugins?
2. Does the script work with standard non-MT version of AviSynth?
3. Does it work with 1920x1080/60p mts/mp4 streams?
4. Can it work without performing YV12-->RGB conversion?
5. If conversion is performed, are the video levels converted from 16-235 to 0-255?
6. Can you detect significant improvement over the script by Martin Haverland ?
Many thanks and best regards.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.