How to convert anaglyph to side by side? - Page 5 at DVinfo.net
DV Info Net

Go Back   DV Info Net > Special Interest Areas > 3D Stereoscopic Production & Delivery
Register FAQ Today's Posts Buyer's Guides

3D Stereoscopic Production & Delivery
Discuss 3D (stereoscopic video) acquisition, post and delivery.

Reply
 
Thread Tools Search this Thread
Old March 29th, 2011, 05:46 PM   #61
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Finally i got it with DG.



Attached you will find working AnaExtract_DG.avs.
Attached Files
File Type: txt AnaExtract_DG.txt (4.6 KB, 1534 views)
Seref Halulu is offline   Reply With Quote
Old April 5th, 2011, 08:21 PM   #62
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

This is the copy of the same thread on doom9.

Hi, after lots of work i think i'm ready to re-introduce Tony Asch's tool.
This is based on Tony's "Dump Those Silly Colored 3D Glasses!"

Dump Those Silly Colored 3D Glasses! How-To; Teardowns; Tutorials V-Rtifacts

You will find an educational movie on the same link as well.

And most of the quotes from Tony have been taken from DV Info Net forum.


Tony says :

Quote:
Some of the functionality and ideas came from earlier scripts from Olivier Amato and Blackhole of Soul's
My thanks for their hard work.
You may enter the parameters on xx-DeAna.avs and AnaExtract.avs will use those parameters.
You will find detailed explanation on how to use it on given scripts.
But i want to make a basic summary:

Quote:
The basic idea is to pull two luminance channels from red and cyan (or green and magenta.) Or even better, if you have a 2D version of the movie, you already have one eye's view, and just need to pull the luminance from one anaglyph color. With stereoscopic luminance in hand, you then create a blurry version of just the chroma info. This can come from the 2D version, or lacking a 2D copy, just blur the original anaglyph. Finally, you apply the blurred chroma onto the two luminance channels you created as the first step, and then arrange them side by side (or top and bottom.)

This technique takes advantage of the human vision system characteristic of perceiving color in much lower resolution than the eye sees luminance (rods vs. cones.) Given clean anaglyph source, especially where the convergence/divergence is not too severe, the technique works surprisingly well.

The quality of the source material is paramount. Each generation of lossy encoding/decoding degrades the color space, and thus degrades any conversion. Blu-ray sources work quite well, while the VCD anaglyphs that circulate on Usenet and Torrents are useless. from Tony
Prerequisites:
The anaglyph movie you have has to be shot as real stereoscopic.
You should have a 2D copy of the same movie. (i insist it is an obligation.)
The best results have been taken in case of using original anaglyph blus and DVDs.



How to use:

The best way is to use VirtualDubMod to change the parameter script and see immediately what has been changed. Hit F5 in the script editor to automatically save the script and reload it in VirtualDubMod, thus revealing the newly processed images.

And after being sure you're ready to fully process the movie, just encode it to 264 using x264; internally or externally.
I always prefer to encode it externally.

Then what we need?

DirectX End-User Runtime
DirectShowSpy.dll
Proppage.dll

AviSynth
VirtualDubMod
AC3ACM Codec
ffmpeg
Haali Splitter (latest version: 03.03.2011)
FfdShow
GraphStudio
TSMuxer
MKVMerge Gui
x264 (or MeGui)

AnyDVD/AnyDVD HD (commercial)
eac3to
Video ReDo (for mpeg2 frame accurately cutting) (commercial)
Video ReDo TV Suite (for mpeg2 or h264 frame accurately cutting) (commercial)

Stereoscopic Player or TMT5 (commercial) (for playing resulting SBS files.)

Lets start:

Step by step:

1) Decrypt anaglyph BD or DVD via AnyDVD.
2) Analize decrypted DVD or BD (you may use BD Info for BDs) and find what videos are 3D or 2D.
3) Demux 2D and 3D videos with eac3to and remux to m2ts via TSMuxer.
4) Cut -if needed- to syncronize 2D and 3D videos with VideoReDo/Video ReDo TV Suite. (if the source file is VC1 cut and demux with TS Muxer and remux to mkv with MKVMerge Gui.)
5) Find the video is RC or GM.
6) Explore the 2D video is left or right.
7) Input the parameters to xx-De-Ana.avs.
8) Re-encode with x264 to SBS or TB.


After decripting and analizing files, the extraction is very important.
Tony says:
Quote:
The most important thing is that I have not re-compressed the DVD video before the conversion. Both the 2D and 3D DVDs were extracted to MPEG2 with VOB2MPG, which does not recompress. If the colors are distorted, it becomes very hard to recover the left and right luminance videos because a simple Green or Magenta filter won't work with distorted colors.
And he prefers to use MakeMKV for BluRay extraction.

And i recommend you to use eac3to to demux and remux to mkv with MKV MergeGui. (if you will need to cut to synch videos, you should remux to m2ts with TSMuxer first.)

After extracting non-re-encoded 2D and 3D videos you may need to make them cut if your Anaglyph source has not a matching (time synced) 2D version which is either the left or right eye view.
This cutting must be frame accurately and i use Video ReDo Tv Suite for this.
And after cutting we have to make sure both videos have the same frame number.
The best way is to write basic scripts to check it on VirtualDubMod:

Code:
DirectShowSource("C:\bloody\2D-cut.m2ts", fps=23.976, audio=false, convertfps=true)
info()


Code:
DirectShowSource("C:\bloody\3D-cut.m2ts", fps=23.976, audio=false, convertfps=true)
info()


And we should test both videos whether they were really synchronized: (I use GraphStudio to open both videos at the same time.)




Or you may find more handy to see them as SBS on VirtualDubMod if they are 1920*1080. (just right click on the screen and select 50%.)
Or just open the same script with GraphStudio.

Code:
VidR = DirectShowSource("C:\bloody\test\2D.mkv", fps=23.976, audio=false, convertfps=true)
VidL = DirectShowSource("C:\bloody\test\3D.mkv", fps=23.976, audio=false, convertfps=true)

StackHorizontal(vidL, vidR)





Now lets have a look at our parameter avs:

Step by step:

Code:
# Setup our input files
anaglyphName = "C:\bloody\3D-cut.m2ts" # Anaglyph video
PureColName = "C:\bloody\2D-cut.m2ts" # Video with color info (either Anaglyph or 2D)
monoName = "C:\bloody\2D-cut.m2ts" # Possible 2D video for one eye, if not set to "nothing
SoundName = "C:\bloody\2D-cut.m2ts" # Video with the sound track we want
Entered our input files...

Code:
# Anaglyph input format, either RC or GM, i.e red/cyan or green/magenta
inputFormat = "GM"
How do we know whether the anaglyph is RC or GM?

Easy to understand:

RC:



GM:



Code:
# Maybe we already have one eye's version in 2D already,
# i.e. the DVD or BR has both 2D and 3D versions
# Set to: monoRight or monoLeft or monoNone
isMono = "monoRight"
Yes, this is the most critical point to be undestood very well since selecting the false view will be resulting with no stereoscopic video.
And how do we know 2D video is right or left?

Lets have a look before we decide.

Perspective look:

Left Angle:




Right Angle:



Left eye means what our left eye sees only when our right eye is closed and the reverse is true.

And compare what our left or right eyes see when the video is shot as right or left angle.

Hidden Stuff:

Quote:
Load up the anaglyph version in any media player and find a frame where there is a good 3D effect. Put on your anaglyph glasses. You'll notice that your right eye can "look around" the right edge of objects in the foreground and see parts of the background that are hidden from your left eye. Do the same thing with your left eye "looking around" the left edge of foreground objects. Remember what was hidden from one eye, but visible to the other eye.

Then load up the 2D version and seek to the same frame. You should be able to notice what is hidden behind the foreground object and compare this to the left and right anaglyph views that you previously observed. The 2D version should match either the left or right anaglyph view. Then you will know. from Tony


And finally the best way i found is to open both anaglyph and 2D videos at the same time with GraphStudio and to find which is matching to left or right. You may use the above script as well.

OK, here are some samples:



Put your Red-Cyan glasses on and close your left and right eyes and find out what eye matches to 2D video?

When your right eye is closed down, you can see both videos (as red) matches to each other, right; which means 2D is left.
(have you noticed hidden stuff here?)






Put your Green-Magenta glasses on and close your left and right eyes and find out what eye matches to 2D video?

When your left eye is closed down , you can see both videos (as magenta) matches to each other, right; which means 2d is right.
(have you noticed hidden stuff here?)




Resulting files just to compare:






Code:
# Swap eyes: either Yes or No
# Note: it is industry standard to put Red on the left eye for RC glasses
# and Green on the left eye for GM glasses
# It would be unusual to set this parameter to Yes
# since the un-swapped arrangement is either Red=Left or Green=Left
swapAnaglyph = "No"
It is normally "No"

Code:
# Output formatting:
# Choices are:
#	SBS_Left_First, SBS_Right_First, TB_Left_Top, TB_Right_Top
#
# Meaning Side-by-Side (SBS) or Top-Bottom (TB)
# And choosing which eye is in which position
# This happens after the optional swap (above)
# and is somewhat redundant, but makes the eye choices clearer.
outputFormat = "SBS_Left_First"
I prefer SBS_Left_First.

Code:
# Resize the output video? Either Yes or No
# If set to No, then the output video is either
# twice the width of the input (for SBS)
# or twice the height of the input (for TB)
outputResize = "No"

# If we are resizing the output, specify the dimensions (Int)
# These dimensions apply to the stacked video size
outputWidth = 500
outputHeight = 200
I don't prefer resizing.

Code:
# In case one anaglyph eye has leaked into the other
# We can try to remove that leakage by subtraction
# Expressed as percentage (int or float) (-100 to 100) (0 means none)
leakCorrectR = 0	# Leakage of left into the right eye
leakCorrectL = 0	# Leakage of right into the left eye
Normally you wouldn't need that; leave it as is.

Code:
# How much to blur the color information (Int or Float)
# This is done by shrinking the color video down in size
# and then resizing it back up to full resolution
# producing a blurred full resolution image
# The two decimate numbers are expressed as percentages
# i.e. a percentage of the full resolution to calculate
# the shrunk size. 100 means no shrink, 10 means 1/10 the
# resolution of the original, etc.
# Anaglyphs are only offset horizontally, so the color blur
# should be strong horizontally, but weak vertically
# For films where the cameras were misaligned vertically
# you will need to make the vertical blur greater.
decimateHoriz = 12.0	# Horizontal shrinkage
decimateVert = 24.0	# Vertical shrinkage - can usually be much bigger than decimateHoriz

# Final brightness and contrast adjustments
tweakBrightL = 0	# Left brightness, integer to add to each pixel (pixels are 0-255)
tweakContL = 1.0	# Left contrast adjustment (1.0 means no contrast adjustment)
tweakSatL = 1.0		# Left saturation adjustment (1.0 means no saturation adjustment)
hueL = 0		# Left hue adjustment (-180.0 (greener) to +180.0 (redder) 0=none)

tweakBrightR = 0	# Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.2	# Right contrast adjustment
tweakSatR = 1.5		# Right saturation adjustment
hueR = 0		# Right hue adjustment
This is what you need to play with to get the best final video.
Trial and error. Remember:

Quote:
The best way is to use VirtualDubMod to change the parameter script and see immediately what has been changed. Hit F5 in the script editor to automatically save the script and reload it in VirtualDubMod, thus revealing the newly processed images
Code:
# Option to horizontally blur the left and right videos,
# just before the color is restored (before optional LR swap)
# Helps remove some of the fringing that appears in poor DVD encodes
# Set to exactly 1.0 for no processing (faster!!),
# > 1.0 blurs... try 1.5 to 4.0
blurLeft = 1.5
blurRight = 1.0
Leave it as is.

Code:
# Common code to do the conversion
# Make sure this file path points to
# the file on your system.

import("C:\bloody\AnaExtract.avs")
You must show the parameter avs where the main file is.

OK, we finished to input parameters and check whether it works on VirtualDubMod.


And the final stage: encoding.

I prefer to encode to 264 externally via x264.

I put all related files under one folder including x264.exe.

A very basic encoding code: (selecting the detailed encoding parameters is up to you.)

Code:
C:\bloody>x264 --fps 24000/1001 --level 4.1 --sar 1:1 -o test.264 XX-deana.avs
After remuxing to video and audio via TS Muxer or MKV MergeGui, now we are ready to watch this SBS video with Stereoscopic Player or TMT5 on our 3D ready hardware using shutter glasses.

Thanks for reading.


EDIT: Test files (raw) for whom interested in:

2D.mkv

3D.mkv


_ _ _ _ __ _

Last edited by Seref Halulu; April 6th, 2011 at 03:09 PM.
Seref Halulu is offline   Reply With Quote
Old April 6th, 2011, 04:01 PM   #63
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Now i'm adding a general purpose AnaExtract.avs.
You may select DirectShowSource, FFVideoSource or DGSource on xx-deana.avs.

XX-DeAna.avs:

DG:
Code:
  
#	XX-DeAna.avs
#	Tone at VRtifacts.com
#	V 0.9	June 27, 2010
#       Modified by @rica April 6, 2011 (source options included and selectable)

# Select our input method (Source); DS (DirectShow Source), FF (FFVideo Source), DG (DGSource)
inputMethod = "DG"

# Setup our input files
anaglyphName = "C:\bloody\3D-cut.dgi" # Anaglyph video
PureColName = "C:\bloody\2D-cut.dgi" # Video with color info (either Anaglyph or 2D)
monoName = "C:\bloody\2D-cut.dgi" # Possible 2D video for one eye, if not set to "nothing
SoundName = "C:\bloody\2D-cut.ac3"
DS or FF:
Code:
 inputMethod = "FF"

# Setup our input files
anaglyphName = "C:\bloody\3D-cut.mkv" # Anaglyph video
PureColName = "C:\bloody\2D-cut.mkv" # Video with color info (either Anaglyph or 2D)
monoName = "C:\bloody\2D-cut.mkv" # Possible 2D video for one eye, if not set to "nothing
SoundName = "C:\bloody\2D-cut.mkv" # Video with the sound track we want
You might need to add this line first to xx-deana.avs if you live memory issues when you select DirectShowSource: (while encoding.)

Code:
 SetMemoryMax (64)



Tony, please have a look at this attachment.

Thanks.
Attached Files
File Type: zip AnaExtract_G.zip (1.8 KB, 218 views)

Last edited by Seref Halulu; April 6th, 2011 at 06:41 PM.
Seref Halulu is offline   Reply With Quote
Old April 26th, 2011, 04:35 PM   #64
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Hi Tony.

Anaglyph (!!!!) 3D DVD coming with Jakass 3 BD is not a real 3D shot. (at least this anaglyph is fake 3D.)
Please put your green-magenta glasses on and tell me do you see any difference betwwen left and right eye?



Or am i missing something?

Thanks.
Seref Halulu is offline   Reply With Quote
Old April 27th, 2011, 06:25 PM   #65
Regular Crew
 
Join Date: Jul 2010
Location: Central NJ
Posts: 42
Re: How to convert anaglyph to side by side?

Much of JackAss 3D doesn't seem to be 3D, but there are parts that have some 3D. See the attached images - side-by-side and RC anaglyph. I didn't have the patience to actually watch the movie to see how much is 3D and how much is not.
Attached Thumbnails
How to convert anaglyph to side by side?-jackasssbs.jpg   How to convert anaglyph to side by side?-jackassrc.jpg  

__________________
VRtifacts
Tony Asch is offline   Reply With Quote
Old April 28th, 2011, 03:24 PM   #66
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Tony,
This is the first time that i can't find any differences between left and right using silly anaglyph eye-wear.
Bizarre shot and i agrre i don't have patience to finish this rubbish stuff.
Anyway when somebody from avsforum insisted it's not fake 3D, i seperated left and right videos using Adam's tool and the source was only anaglyph itself:

AVS Forum - View Single Post - The Official AVS 3D Blu-ray Topic!

And here is a close-up:



_ _ _ _

Last edited by Seref Halulu; April 28th, 2011 at 06:15 PM.
Seref Halulu is offline   Reply With Quote
Old May 8th, 2011, 05:24 AM   #67
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Last night i tried to convert "Night of the Living Dead" anaglyph movie.

Anaglyph is "Red-Cyan":



But this time "cyan" is on the left instead of "red". So you will find non-standard glasses besides anaglyph DVD; "Cyan" is put on the left eye and "Red" is put on the right eye.

Code:
 # Swap eyes: either Yes or No
# Note: it is industry standard to put Red on the left eye for RC glasses
# and Green on the left eye for GM glasses
# It would be unusual to set this parameter to Yes
# since the un-swapped arrangement is either Red=Left or Green=Left
swapAnaglyph = "No"
So we should select "Yes" this time.

I bought a 2D version as well to get the best true color.
So as to be sure 2D is "left" or "right", i extracted "left" and "right" videos from the anaglyph version first.

Left-Right SBS: (Check out aviscript, it works:Left on the left side, right on the right side.)



Left only:



Right only:



OK, lets have a look at to the "2D" video. It is obviously "Left" and this is the reference view.
So we should select "isMono = "monoLeft"




But if we use below script we can not get stereoscopic result:




Interstingly if i select "monoRight", i get sterescopic:




Or instead if i select "GM" with "monoLeft" together, i get stereoscopic too:



Tony could you have a look at that issue some time? Thanks in advance.

Here are the sample videos. (2D and 3D)

2D.mkv

3D.mkv



_ _ _ _ _ _

Last edited by Seref Halulu; May 8th, 2011 at 06:41 AM.
Seref Halulu is offline   Reply With Quote
Old May 8th, 2011, 10:05 AM   #68
Regular Crew
 
Join Date: Jul 2010
Location: Central NJ
Posts: 42
Re: How to convert anaglyph to side by side?

Actually, everything is correct:

isMono = "Right"
inputFormat = "RC"
swapAnaglyph = "Yes"

The script does the swap as the very last step. The rest of the processing is done before the swap. Thus, the final left side is processed as if it were on the right. This explains why you need to declare the mono file as Right, because at the end Right is swapped with Left.

Internally the script doesn't really know much about left and right, it operates purely on color filters. In this case when you say isMono="Right", what you really are saying is: "please don't bother to extract the cyan video because I already have a better version in my 2D file....and although cyan is normally a right side video, and I know you're going only process the red as if it were on the left, and then swap left and right when everything is finished.... and I understand that while you are processing the colors, right and left are reversed, so even though my mono video represents the left view, I need to process it on the right side (cyan) before reversing the left and right as the last step."

Sorry to make this complicated... it's just related to the ordering of how the parameters are executed. I guess I could change the syntax to isMono="R", "C", "G", or "M" and that would make things clearer.
__________________
VRtifacts
Tony Asch is offline   Reply With Quote
Old May 8th, 2011, 01:53 PM   #69
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Thanks Tony for the detailled explanation.
Seref Halulu is offline   Reply With Quote
Old June 12th, 2011, 05:29 PM   #70
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Quote:
Originally Posted by Tony Asch View Post
. I guess I could change the syntax to isMono="R", "C", "G", or "M" and that would make things clearer.
Maybe modifying the script as "Red-Cyan, Cyan-Red, Green-Magenta, Magenta-Green" looks better?
Seref Halulu is offline   Reply With Quote
Old August 19th, 2011, 04:34 PM   #71
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

Hi Tony.
Please have a look at to the post 63 and post 70.
Still no response.
And here is what SP does on settings:



Tony, please do us a favor. You know i'm not a coder.

Thanks.

Last edited by Seref Halulu; August 19th, 2011 at 05:28 PM.
Seref Halulu is offline   Reply With Quote
Old August 19th, 2011, 05:09 PM   #72
Regular Crew
 
Join Date: Dec 2010
Location: Istanbul Turkey
Posts: 74
Re: How to convert anaglyph to side by side?

We need the final avs which has been improved.
Seref Halulu is offline   Reply
Reply

DV Info Net refers all where-to-buy and where-to-rent questions exclusively to these trusted full line dealers and rental houses...

B&H Photo Video
(866) 521-7381
New York, NY USA

Scan Computers Int. Ltd.
+44 0871-472-4747
Bolton, Lancashire UK


DV Info Net also encourages you to support local businesses and buy from an authorized dealer in your neighborhood.
  You are here: DV Info Net > Special Interest Areas > 3D Stereoscopic Production & Delivery


 



All times are GMT -6. The time now is 07:19 AM.


DV Info Net -- Real Names, Real People, Real Info!
1998-2024 The Digital Video Information Network