View Full Version : How to convert anaglyph to side by side?


Pages : [1] 2

Seref Halulu
January 9th, 2011, 02:49 PM
Hi Adam,

The Pantarheon 3D AviSynth Toolbox not only lets you combine two videos into one 3D video, it also makes it possible for you yo extract the left or the right view from anything created with the Basic Functions into a 2D video. Note I only mentioned the Basic Functions, but not anaglyphs. That is because the anaglyphs do not have enough of the original video data available to reconstruct the left and right originals.

I think most of us have anaglyph 3D HD wmv files downloaded from net but we want to watch them with our shutter glasses.

Would you give us a direction how to do this? (half resolution full color would be sufficient.)

Thanks.

Adam Stanislav
January 9th, 2011, 07:15 PM
That is because the anaglyphs do not have enough of the original video data available to reconstruct the left and right originals.

You answered your own question there. It is not possible.

Anaglyphs are lossy. They throw away the green and the blue channels from the left view and the red channel from the right view. And once that data is gone, it is gone. Forever. You need to know what was in those channels if you want to reconstruct the full color.

That has nothing to do with resolution. You can lower the resolution all you want, the full color information is not there.

It is kind of like my name. Adam is my middle name, Stanislav is my last name. Can you tell my first name from that information? No, you cannot. You could find it elsewhere (e.g., in my passport) but you cannot tell it from the available information. You cannot even guess it, approximate it.

Similarly, you would need the original files from which the anaglyphs were created. But you cannot get that information from the anaglyphs.

Well, there is one thing you could do, but that would require some very sophisticated software: You could analyze the two views, find which pixel in the left view corresponds to which pixel in the right view, then you could take the red channel from the left view and the green and blue channels from the corresponding pixel in the right channel. Even then you would not reconstruct the exact original (because of the way light is affected by the angle you look at it from) but you might get a satisfactory result. That would require a detailed and sophisticated analysis with a corresponding price tag.

I personally have never given much thought to the algorithmic details of performing such an analysis, so while the principle I have just described may sound simple, I am not the right person to implement it. It is the same type of analysis done by software that stitches several images into one panoramic image, so someone who has developed stitching software would have enough experience to do it. Or perhaps someone who created some deshaking software.

Seref Halulu
January 10th, 2011, 03:21 PM
Oh, i forgot it then.
Thanks.

Tony Asch
January 10th, 2011, 05:54 PM
You might want to look at this technique:

Dump Those Silly Colored 3D Glasses! - V-Rtifacts (http://www.vrtifacts.com/how-to-teardowns-tutorials/dump-those-silly-colored-3d-glasses/)

Full AVISynth code is included.

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.

There's lots more detail in the linked article. Give it a try.

Seref Halulu
January 11th, 2011, 03:21 PM
Thanks Tony but the link doesn't work.
Any mirror?

Tony Asch
January 11th, 2011, 04:16 PM
Link seems OK here... Just looked at the page.

Dump Those Silly Colored 3D Glasses! How-To; Teardowns; Tutorials V-Rtifacts (http://www.vrtifacts.com/how-to-teardowns-tutorials/dump-those-silly-colored-3d-glasses/)

Or you can find the article through the link in my signature.

Seref Halulu
January 11th, 2011, 05:28 PM
Tony,
the problem is i've already found your site but i've never been able to link the main page of your site too..
I don't know what type of issue it is but it's existence for me at least.
Would you upload the documents to mediafire please?
Thanks.

Adam Stanislav
January 11th, 2011, 05:58 PM
I don't know whether that is the reason you cannot see the site, but Turkey blocks many web sites for reasons beyond the understanding of those of us in the West. I know that some people within Turkey have been able to bypass the block by using the free version of OpenDNS (http://www.opendns.com/).

Seref Halulu
January 11th, 2011, 06:23 PM
Oh, i'm already connected with Open DNS for ages :) Open DNS is open anymore: dunno?

BTW beyond the understanding of some/most of us...

Adam Stanislav
January 11th, 2011, 06:37 PM
Well, I tried. :)

Seref Halulu
January 11th, 2011, 06:52 PM
:) :) :)

********* (needed to fill the 10 charecters to post this:) )

Tony Asch
January 11th, 2011, 06:59 PM
https://proxify.com/p/001010A1000100/687474703a2f2f7777772e5652746966616374732e636f6d2f686f772d746f2d74656172646f776e732d7475746f7269616c 732f64756d702d74686f73652d73696c6c792d636f6c6f7265642d33642d676c61737365732f

Seref Halulu
January 11th, 2011, 07:14 PM
Thanks a lot.
It works. :)
Best.

EDIT: I gonna do my homework asap.

Seref Halulu
January 23rd, 2011, 08:33 AM
Hi Tony.

AnaExtract.avs and xx-DeAna.avs.

I can not extract them from the AnaglyphConvert.zip folder. They seem demaged or because i downloaded over a proxi.

Could you upload them please?

Thanks.

Pavel Houda
January 23rd, 2011, 09:50 AM
One other way to de-anaglyph you could try is here: 3dtv.at - DeAnaglyph (http://www.3dtv.at/knowhow/DeAnaglyph_en.aspx) .

Tony Asch
January 23rd, 2011, 10:50 AM
AviSynth Code for De-Anaglyph.

The de-anaglyph program on Peter's site is great, but too slow to process a movie.

Seref Halulu
January 23rd, 2011, 11:38 AM
Thanks,
I know it already but it is under construction yet and just for SD.

Seref Halulu
January 23rd, 2011, 11:44 AM
Thanks a lot Tony.

Seref Halulu
January 24th, 2011, 06:13 PM
Tony,

I can't correct the ghost effect on the right image.
The left video is the original full-color 2D and the right video is the anaglyph.
I suppose i have to fix it with leakcorrect but i couldn't yet.

http://img522.imageshack.us/img522/7893/vsaana.png (http://img522.imageshack.us/i/vsaana.png/)

# VSA-DeAna.avs
# Tone at VRtifacts.com
# V 0.9 June 27, 2010

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

# Anaglyph input format, either RC or GM, i.e red/cyan or green/magenta
inputFormat = "RC"

# 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 = "monoLeft"

# 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"

# 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"

# 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

# 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

# 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 = 100 # Horizontal shrinkage
decimateVert = 100 # 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)

tweakBrightR = -5 # Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.2 # Right contrast adjustment
tweakSatR = 1.1 # Right saturation adjustment

# 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.0
blurRight = 1.0

# Common code to do the conversion
# Make sure this file path points to
# the file on your system.
import("C:\test\AnaExtract.avs")
ConvertToYV12()

Thanks.

Tony Asch
January 29th, 2011, 06:01 PM
Seref,

What format is the original Anaglyph? DVD? How did it become a WMV?

Are you 100% certain that the 2D and 3D videos are exactly synchronized?

You need to set decimateHoriz to about 6 or 8 (not 100), and decimateVert to between 10 or 20 for decent results.

Seref Halulu
January 30th, 2011, 07:48 AM
Thanks Tony.

I think i made a mistake while making "copy-past"; original was like this:

decimateHoriz = 6.0 # Horizontal shrinkage
decimateVert = 8.0 # Vertical shrinkag

The file was a downloaded "wmv" (2D+3D versions)
960*720*30fps.
BTW i'm not 100% certain that the 2D and 3D videos are exactly synchronized.

Anyway i should try with a real 3D DVD.

Thanks again

Tony Asch
January 30th, 2011, 06:44 PM
Seref,

Here's a couple of frames converted from "Journey To The Center Of The Earth" DVD. Left is on top (converted) and right is on the bottom (from the 2D version.) The 3D anaglyph source is Green-Magenta, thus the converted left image is derived from the luminance of the Green and chroma from the 2D. All conversion parameters are at a neutral setting except that the left saturation is 1.2. decimateHoriz = 8, and decimateVert = 16.

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. This is why I asked about your WMV. Every time the anaglyph is compressed, the colors are distorted and 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.

If you look carefully at the left (top) images, you will see that the conversion is not perfect, but in motion, the flaws are less noticeable.

Seref Halulu
January 31st, 2011, 04:31 PM
Tony, thanks for your valuable feedback.
I've been waiting a post which includes a 3D/2D DVD (My Bloody Valentine.)
I'll report back in a week, i hope.

FYI:Those wmv files were original files, not re-encoded files.

Seref Halulu
February 3rd, 2011, 06:13 PM
Dunno what the problem is but VirtualDubMod gives this error::
http://img218.imageshack.us/img218/3963/vduberror.png (http://img218.imageshack.us/i/vduberror.png/)

Here is my AVS:
# XX-DeAna.avs
# Tone at VRtifacts.com
# V 0.9 June 27, 2010

# Setup our input files
anaglyphName = "C:\users\rica\desktop\MBV\VIDEO_TS\VTS_01_1.mpg" # Anaglyph video
PureColName = "C:\MBV\VIDEO_TS\test.mpg" # Anaglyph video"# Video with color info (either Anaglyph or 2D)
monoName = "C:\MBV\VIDEO_TS\test.mpg" # Possible 2D video for one eye, if not set to "nothing"
SoundName = "C:\MBV\VIDEO_TS\test.mpg" # Video with the sound track we want

# Anaglyph input format, either RC or GM, i.e red/cyan or green/magenta
inputFormat = "RC"

# 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 = "monoLeft"

# 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 = "Yes"

# 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"

# 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

# 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

# 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 = 8.0 # Horizontal shrinkage
decimateVert = 20.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)

tweakBrightR = -30 # Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.2 # Right contrast adjustment
tweakSatR = 1.5 # Right saturation adjustment

# 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.0
blurRight = 1.0

# Common code to do the conversion
# Make sure this file path points to
# the file on your system.
import("C:\test\AnaExtract.avs")

Tony Asch
February 3rd, 2011, 08:08 PM
Looks like you don't have the proper Windows DirectShow decoder for your audio file installed on your system.

Probably AC3 format.

Try: AC-3 ACM Codec (http://fcchandler.home.comcast.net/~fcchandler/AC3ACM/)

(also attached to this post)

Seref Halulu
February 5th, 2011, 06:01 PM
Thanks Tony, i seem to forget how to use VirtualDubMod.

Btw, i've been trying with some 3D DVDs for two days.
What's interesting here is i get playing loops everytime.
For instance if the normal clip leght is 04:40, i get 10:00 minute clip.
Final Clip Lenght must be as original clip lenght but i get double lenght.
Lets say original clip is 04:40 but the final clip is:

=(00:00-00:04:40) + (02:30-04:40) + (03:58-04:40) + (04:14-04:40) =10:00

Please have a look at this sample encode; i can't figure out. (ofcourse i see the same effect on VirtualDubMod or GraphStudio.)

Mbv_out.rar (http://www.mediafire.com/?1a7my0b5cdigks9) (CAUTION: HORROR CONTENT AND FOR +18)



Here is my avs:

# Setup our input files
anaglyphName = "C:\test_3\mbv_cut.mpg" # Anaglyph video

PureColName = "C:\test_3\mbv-2D_cut.mpg" # Video with color info (either Anaglyph or 2D)

monoName = "C:\test_3\mbv-2D_cut.mpg" # Possible 2D video for one eye, if not set to "nothing

SoundName = "C:\test_3\mbv-2D_cut.mpg" # Video with the sound track we want

# Anaglyph input format, either RC or GM, i.e red/cyan or green/magenta
inputFormat = "RC"

isMono = "monoLeft"

swapAnaglyph = "No"

outputFormat = "SBS_Left_First"

#outputResize = "No"

leakCorrectR = 0 # Leakage of left into the right eye
leakCorrectL = 0 # Leakage of right into the left eye

#decimateHoriz = 8.0 # Horizontal shrinkage
decimateVert = 6.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)

tweakBrightR = -30 # Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.2 # Right contrast adjustment
tweakSatR = 1.5 # Right saturation adjustment

blurLeft = 1.0
blurRight = 1.0

import("C:\test_3\AnaExtract.avs")

ConvertToYV12()

Here is my encode:

C:\test_3>x264 --fps 30000/1001 --level 3.1 --sar 1:1 --aud -o Mbv_out.264 Mbv-DeAna.avs

[mpeg @ 02a77480] max_analyze_duration reached
[mpeg @ 0388e150] max_analyze_duration reached
[mpeg @ 03911230] max_analyze_duration reached
[mpeg @ 03a22870] max_analyze_duration reached
[mpeg @ 03a1f880] max_analyze_duration reached
[mpeg @ 0c2ef010] max_analyze_duration reached
[mpeg @ 02afe900] max_analyze_duration reached
[mpeg @ 0c3f22e0] max_analyze_duration reached
[mpeg @ 03d97180] max_analyze_duration reached
avs [info]: 1440x480p 1:1 @ 10000000/166833 fps (cfr)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile High, level 3.1
x264 [info]: frame I:127 Avg QP:19.10 size: 41291
x264 [info]: frame P:6911 Avg QP:23.61 size: 10267
x264 [info]: frame B:10948 Avg QP:25.86 size: 2286
x264 [info]: consecutive B-frames: 10.2% 20.4% 16.2% 53.1%
x264 [info]: mb I I16..4: 28.4% 58.0% 13.6%
x264 [info]: mb P I16..4: 3.1% 4.0% 0.6% P16..4: 36.8% 11.2% 6.2% 0.0% 0
.0% skip:38.1%
x264 [info]: mb B I16..4: 0.2% 0.1% 0.0% B16..8: 35.1% 2.0% 0.3% direct:
0.6% skip:61.7% L0:39.0% L1:56.7% BI: 4.4%
x264 [info]: 8x8 transform intra:52.4% inter:81.2%
x264 [info]: coded y,uvDC,uvAC intra: 44.0% 44.8% 17.3% inter: 11.2% 10.9% 0.4%
x264 [info]: i16 v,h,dc,p: 69% 15% 5% 12%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 11% 27% 5% 6% 8% 5% 7% 6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 15% 20% 5% 7% 7% 5% 5% 4%
x264 [info]: i8c dc,h,v,p: 57% 14% 24% 5%
x264 [info]: Weighted P-Frames: Y:6.1% UV:4.0%
x264 [info]: ref P L0: 62.9% 16.3% 15.6% 5.0% 0.2%
x264 [info]: ref B L0: 88.9% 9.7% 1.4%
x264 [info]: ref B L1: 95.5% 4.5%
x264 [info]: kb/s:1349.36

encoded 17986 frames, 20.97 fps, 1349.36 kb/s


Thanks in advance. (btw, i didn't tweak well.)

EDIT: Tony, how to modify XX-DeAna.avs and Ana_Extract.avs if i don't want to use audio? (it's better to re-mux later imo)

EDIT: I used VOB2MPG for extraction of whole mpg and used VideoReDo Plus for frame accurate cutting.

Tony Asch
February 6th, 2011, 01:01 PM
Several things...

1.) To get rid of the audio just comment out the last line in AnaExtract.avs

# Dub in the sound
# AudioDub(vidsound)

2.) For My Bloody Valentine, the 2D version is the right eye view. The sample you sent me used the 2D as left eye, and then converted another copy of the left eye to produce the right; thus no stereo!

So.... you want: isMono = "monoRight"

3.) The monoRight setting revealed a software bug in AnaExtract.avs. I have attached an updated version which fixes the bug. Sorry!

4.) I'm not sure about the "repeating" problem. It probably has something to do with your source files. Perhaps one is longer than the other. If you want to send me the two source files, I'll take a look.

5.) With MBV you can set decimateVert = 20.0 or more. This will help with the color bleeding on the converted left image.

All the best,

Tony

Seref Halulu
February 6th, 2011, 01:37 PM
Thanks Tony.

I've just started uploading files. (takes 2 hours for both)

Meanwhile i gave it a go with the whole movie and i checked the frame numbers and the durations seperately; both 144.089 frames and the duration (1:40:09:712). (used VideoReDo Plus for frame accurate cutting.)

Two findings :
1) EDIT:Sorry it's false information. (i had to trim)
2) VirtualDubMod or GraphStudio crashes when trying to open new full movie avs while MeGui opens the same avs without any problem.
When i check what MeGui is using i saw LAVF directShow Source Filter.

I will check out with the new parameter avs and new core AnaExtract avs.

(BTW how do you understand whether 2D is right or left?)

Thanks for everything.

Best.

EDIT: No crash anymore with VirtualDubMod: i used new AnaExtract.avs and revised parameter avs.(the whole movie) THX

Here is the new parameter avs: (Mbv-DeAna.avs)

# Setup our input files
anaglyphName = "C:\test_4\mbv_longcut.mpg" # Anaglyph video

PureColName = "C:\test_4\mbv2D_longcut.mpg" # Video with color info (either Anaglyph or 2D)

monoName = "C:\test_4\mbv2D_longcut.mpg" # Possible 2D video for one eye, if not set to "nothing

SoundName = "C:\test_4\mbv2D_longcut.mpg" # Video with the sound track we want

# Anaglyph input format, either RC or GM, i.e red/cyan or green/magenta
inputFormat = "RC"


isMono = "monoRight"


swapAnaglyph = "No"


outputFormat = "SBS_Left_First"


outputResize = "No"



leakCorrectR = 0 # Leakage of left into the right eye
leakCorrectL = 0 # Leakage of right into the left eye


decimateHoriz = 8.0 # Horizontal shrinkage
decimateVert = 20.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)

tweakBrightR = -5 # Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.0 # Right contrast adjustment
tweakSatR = 1.5 # Right saturation adjustment

blurLeft = 1.0
blurRight = 1.0


import("C:\test_4\AnaExtract.avs")

ConvertToYV12()

Tony Asch
February 6th, 2011, 02:02 PM
It is fairly easy to see whether the 2D version is left or right.

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.

If you have some video editing software (Premiere, After Effects, Vegas, etc...) you can just stack the 2D and the Anaglyph versions on two timeline layers, being certain that the two videos are synchronized. Put on your anaglyph glasses and turn on and off one of the layers until you figure out whether the 2D matches the left or right anaglyph view.

Be aware than some media players and editors have trouble accurately seeking to a specific timecode with MPEG2. You may just have to let it play from the beginning and just pause the player at a good 3D effect.

Seref Halulu
February 6th, 2011, 02:22 PM
Thanks a lot for detailed explanation.

Here are the source files:

mbv-2D_cut.mpg (http://www.mediafire.com/?3qlx6x9vkbesgo1)

http://www.mediafire.com/?y77qv2bu348llb0

But unfortunately, after encoding to x264, i have again "repeating problem" which i stated on post 26. (even i used new parameter avs and new Ana-Extract.)

Lets say original clip is 04:40 but the final clip is:

=(00:00-00:04:40) + (02:30-04:40) + (03:58-04:40) + (04:14-04:40) =10:00

Please have a look at.

EDIT:Even i seperated left and right (with Adam's tool) and re-encode them seperately to x264 and avi. After encoding i get loop. I don't understand "how this happens" at all?

_ _ _ _

Seref Halulu
February 6th, 2011, 06:29 PM
Here is my latest trial; extracted right and left and re-orginized with Adam's tool. But after encoding still loop issue exists:

Avs used in re-encoding:

C = AviSource("C:\test_3\Mbv-DeAna.avs")
lv=LeftRight3DToLeft(c)
rv=LeftRight3DToRight(c)
LeftRight3D(lv, rv)
ConvertToYV12()

Parameter avs:

# Setup our input files
anaglyphName = "C:\test_3\mbv_cut.mpg" # Anaglyph video

PureColName = "C:\test_3\mbv-2D_cut.mpg" # Video with color info (either Anaglyph or 2D)

monoName = "C:\test_3\mbv-2D_cut.mpg" # Possible 2D video for one eye, if not set to "nothing

SoundName = "C:\test_3\mbv-2D_cut.mpg" # Video with the sound track we want


inputFormat = "RC"


isMono = "monoRight"


outputFormat = "SBS_Left_First"


outputResize = "No"


leakCorrectR = 0 # Leakage of left into the right eye
leakCorrectL = 0 # Leakage of right into the left eye


decimateHoriz = 8.0 # Horizontal shrinkage
decimateVert = 20.0 # Vertical shrinkage - can usually be much bigger than decimateHoriz


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)

tweakBrightR = -5 # Right brightness, integer to add to each pixel (pixels are 0-255)
tweakContR = 1.0 # Right contrast adjustment
tweakSatR = 1.5 # Right saturation adjustment


blurLeft = 1.0
blurRight = 1.0

import("C:\test_3\AnaExtract.avs")
ConvertToYV12()


And i used the latest Ana-Extract.avs.


Tony, pls redo it.
_ _ _

Tony Asch
February 6th, 2011, 08:17 PM
Seref,

I can't reproduce the looping problem. The files you gave me converted OK. They were both exactly 5 min. long and the side-by-side output is exactly 5 min. long. You can download my conversion:

MBV-5-LR.avi (http://www.mediafire.com/?1mkishcsydusc13)

It is encoded with XVID codec and includes audio track.

The AVS parameter file I used is attached to this post.

The conversion worked pretty well, except for the small red cast credits which were obviously composited differently for the 2D vs. the 3D version (a vertical offset about 1/2 the height of the letters.)

After setting the parameters, all I do in VirtualDubMod is:

1.) File->Open Video File (and choose my AVS parameter file)
2.) File->Save As... (and choose a video codec, name the file, and click Save)

On my computer, it converts and encodes in about 5 min.

I suspect you may have troubles with Windows codecs on your computer which is causing the looping. Don't try anything complicated with codecs... first get the conversion working properly, even if you create an uncompressed test file. Once the conversion works, then you can optimize the compression.

All the best,

Tony

Seref Halulu
February 7th, 2011, 03:39 PM
Tony,
i put a clean HDD and gave it a go again.
No looping issues left.
Xvid over VirtualDubmod and x264 external encodgings work finally.
Thank you.
But i gonna going on bothering you, believe me. (just started)
Best.

Seref Halulu
February 8th, 2011, 05:45 PM
BTW i bewared after 4:00:00 your and mine re-encodes start looping.
Please check out your MBV-5-LR.avi. (player is windows media player)
Yes there must be a problem with windows filters.
(i can play it as is with VirtualDubMod -no looping issues.)

BTW i used my problematic HDD.

EDIT: Sorry, i gave it a go with my non-problematic HDD again and everything works well. Even with Windows Media Player.

Seref Halulu
February 8th, 2011, 06:44 PM
Tony, i want to try with a RC DVD//BD too,what do you suggest?

Seref Halulu
February 13th, 2011, 10:01 AM
Hi Tony.

Today i gave it a go with anaglyph BD edition of "My Bloody Valentine".

VirtualDubMod doesn't show left and right video at the same time since it is 3840x1080.

Which means i can not use "script editor" to configure "parameter" aviscrypt.

This time i was lucky and used the "parameter" file which you managed from the same movie's DVD. (and i re-encoded it as 3840x1080 to x264.)

If i have only anaglyph BD, how can i config the parameter file? (without making cut-test avi encodes to manage it.)

Thanks.

Tony Asch
February 13th, 2011, 10:24 AM
Just right click on the image in VirtualDubMod and set a viewing magnification. See the attached screen grab.

Seref Halulu
February 13th, 2011, 10:56 AM
Thank you.
I was just trying to add this line to the end of the parameter.avs: (after configured the file i was going to remove it.)

LanczosResize(1920,1080) # Lanczos (Sharp)

EDIT: I don't know how this resizing affects the configuration result?

Tony Asch
February 13th, 2011, 04:00 PM
Not sure what you're trying to achieve. Resizing is already completely configurable in my conversion system:

# 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

Seref Halulu
February 13th, 2011, 05:34 PM
I don't want to resize. (I didn't mean to resize the resulting file.)

Before you recommended me (post 37) i was thinking to resize just for opening the avs as 1920*1080 on VirtualDubmod so as to be able to see both right and left videos together to configure parameter avs. And after configured i was going to remove that line from avs. So the question was if i follow this way, does (temporary) resizing affect the final configuration negatively?

http://img827.imageshack.us/img827/1476/mbv19201080.png (http://img827.imageshack.us/i/mbv19201080.png/)

_ _ _ _ _

Tony Asch
February 15th, 2011, 12:52 PM
Resizing the preview in VirtualDubMod by right clicking on the image will not affect the output file resolution. It only affects the screen preview.

Adding resizing to the AVS file will change the resolution of the output file.

Seref Halulu
February 15th, 2011, 04:56 PM
Do you mean even we remove that rezing line before re-encoding?

(Maybe horizontal stretching affects re-creating of new aviscrypts but i don't think it's gonna affect resizing if we removed that line before re-encoding?)

Seref Halulu
February 15th, 2011, 07:16 PM
And one thing: i would suggest "FFVideoSource" instead of "DirectShowSource" on AnaExtract.avs. (assuming we are translating mpg or m2ts files.)
This "DirectShowSource" filter is always problematic. (DGNVTools is another alternative btw.)

Seref Halulu
February 19th, 2011, 07:32 PM
This is what i suggest: (on AnaExtract.avs)


# Snag our video files
vidL = FFvideoSource(anaglyphName)
vidOrig = FFVideoSource(anaglyphName)
vidsound = FFAudioSource(SoundName)

Tony Asch
February 20th, 2011, 09:34 AM
Ah!!! The beauty of open source software. Feel free to improve anything on the project, just make sure to provide complete source if you choose to distribute it.

The "confusion of tongues" in file formats is the Achilles Heel of these projects, even more so when extracting stereo channels from anaglyphs, as re-encoding the input files into some standard format results in significant degradation of the final product.

FFVideoSource is a good option, but I would suggest that it be incorporated as an option rather than the only choice. Perhaps the parameter file could allow you to choose DirectShowSource, FFVideoSource, or some future input filters that may yet prove helpful.

Something like:

inputMethod = "DS"

or

inputMethod = "FF"

and so forth...

Seref Halulu
February 20th, 2011, 12:47 PM
It is a great idea.

You know i'm not a coder. So i made a mistake.
VirtualDubMod crashes.

Could you please help me in writing the right code?

Here are the modifications i made on parameter file and AnaExtract;

MBV-DeAna:

# Source input method, either DS or FF, i.e DirectShowSource or FFvideoSource

inputMethod = "DS"

# Setup our input files

anaglyphName = "C:\test_new\3D-cut.mpg" # Anaglyph video

PureColName = "C:\test_new\2D-cut.mpg" # Video with color info (either Anaglyph or 2D)

monoName = "C:\test_new\2D-cut.mpg" # Possible 2D video for one eye, if not set to "nothing

SoundName = "C:\test_new\2D-cut.mpg" # Video with the sound track we want



AnaExtract:

# FF/DS? Selects "source"


(inputMethod == "FF") ? Eval("""
vidL = FFvideoSource(anaglyphName)
vidOrig = FFVideoSource(anaglyphName)
vidsound = FFAudioSource(SoundName)
""") : Eval(""" """)

(inputMethod == "DS") ? Eval("""
vidL = DirectShowSource(anaglyphName)
vidOrig = DirectShowSource(anaglyphName)
vidsound = DirectShowSource(SoundName, audio=true, video=false)
""") : Eval(""" """)

Best.
_ _ _ _ _ _

Seref Halulu
February 23rd, 2011, 05:41 PM
I think the code is working. Crash happens with only Gabest filter. MS, FFdshow and Cyberlink filters work.
Do you confirm?

Seref Halulu
March 9th, 2011, 05:29 PM
Hi Tony.
I'm living issues with vc1 based HD Blu (Journey to the center of the earth.. -3D anaglyph)

First of all i tested individual 2D /3D with VirtualDubMod using these codes:
LoadPlugin("C:\DG\DGDecodeNV.dll")
DGSource("C:\journeytothecenter\2D-cut.dgi")
info()

DirectShowSource("C:\journeytothecenter\2D-cut.m2ts")
info()

FFVideoSource("C:\journeytothecenter\2D-cut.m2ts")
info(

DGSource gives 23.976 and 1080 information but i can not open xx-DeAna.avs.

As for DirectShowSource and FFVideoSource:;

With Haali > MPC Video Decoder::

DirectShowSource gives 23.976 fps and 1088 info (instead of 1080)
FFVideoSource gives veird (like 24.737) fps and 1080 info

With MPC MPEG Source (Gabest) > MPC Video Decoder or with
Cyberlink Demuxer > Cyberlink Video Decoder

DirectShowSource gives 23.976 fps and 1088 info (instead of 1080)
FFVideoSource gives 23.976 fps and 1080 info

Even FFVideoSource seems suitable for option b, XX-DeAna gives this error:

http://img96.imageshack.us/img96/1567/virtualduberror.png (http://img96.imageshack.us/i/virtualduberror.png/)

_ _ _ _ _

Tony Asch
March 10th, 2011, 09:31 AM
Sorry... I don't understand why you use all these extra codecs, decoders, and formats.

Simply install K-Lite which handles all the formats you'll ever need.

Rip the Blu-Ray 2D and 3D with MakeMKV: MakeMKV - Download (http://www.makemkv.com/download/)

Use the standard Anaglyph Conversion scripts to process.

Works fine on Journey Blu-Ray.

Seref Halulu
March 10th, 2011, 01:55 PM
Sorry but K-lite pack uses the same codecs what i gave it a go with.
I wanted to show the negative results of the combination of source and decoder filters.
FFVideo Source together with MPC MPEG Source (Gabest) > MPC Video Decoder (or with
Cyberlink Demuxer > Cyberlink Video Decoder) works individually but it doesn't work as multiple videos with XX-DeAna. (I use FFVideoSource on that scrypt.)

(BTW i used AnyDVD HD only or AnyDVD HD++eac3to+TSMuxer. I'll try with Make MKV too.)