3D Vision Blog

A normal user's look into the world of 3D Stereo Technologies

3D Vision Blog header image 2

Converting 2D Videos to 3D using VirtualDub and the AviSynth Script

January 15th, 2010 · 86 Comments · 2D to 3D Conversion


The 2D to 3D Realtime Video Conversion Script for Avisynth v0.3 was designed to be used for realtime conversion, but it can as well be used to get a permanent video converted from 2D to 3D. Sometimes you might just want to have a separate video already converted or your PC might for example not being able to handle 1080p content in real time. An example for converted video is the 1080p Avatar Trailer that you can download from the links below, the video file was just converted with the script so you can see what it is capable of. Just don’t forget that here I’m talking about automated 2D to 3D conversion which can usually provide good results, but they are not as good as what you’ll get from a video shot in Stereoscopic 3D mode. In order to convert videos to 3D with a file output, besides the AivSynth script you’ll also need to download the free video editor VirtualDub along with some codecs that are needed to handle the video and audio output. A good example for that would be Xvid for video and LAME MP3 for audio, but others might as well do… just have in mind that I’m talking about encoding here and not just about being able to decode these formats.


You need to open VirtualDub and then Open as a video file the 2D to 3D AVS script instead of directly opening the video file you’ll be converting, don’t worry, the AviSynt script will do what is needed and will just pass video that VirtualDub can interpret. Then Open the Video menu, make sure that Full Processing mode is selected (on by default) and Open up the Compression menu, where you’ll see a list of compatible codecs installed on your PC. You can choose Xvid MPEG4 Codec and Configure it to use Single pass quality based encoding with a Quantizer of 4 in order to have a good ratio between compression size and image quality.


Recompressing the audio is optional, but you’d need to do it as otherwise the file has PCM audio that just makes the size of the file too big. In this case you need to open the Audio menu, select the Full Processing Mode (here it is not on by default) and choose the Compression option. Again you’ll see a list of installed and supported audio codecs, here MP3 is just fine for Stereo output and you can choose 128Kbps for good enough quality and small file size.

What you need to do now is just save the output file as Avi and the recompression of the video will begin, the time it can take varies depending on a lot of factors for example if you are using a single or multi-core CPU, what it the size and length of the video etc. Here you just need to wait a bit for the processing to finish and after that you’ll be ready to play your converted video file directly in the stereoscopic player without the need to go through the AviSynth script for real-time conversion. So now back to the Full HD 1080p teaser as an example that I’ve converted using my conversion script and VirtualDub, the file is about 170MB…

Download the Avatar 1080p teaser autoconverted in stereo 3D formatmirror 1

Tags: ·······

86 responses so far ↓

  • 1 Tamas // Jan 15, 2010 at 18:15

    Thanks so much. It’s working.

  • 2 Nader // Jan 16, 2010 at 00:08

    It is realy working man

    thank you for sharing your thoughts with us

  • 3 Martin Haverland // Jan 16, 2010 at 02:47

    Please note,
    if you are using the interlaced 3d output option of the avisynth script you *MUST* do the following in the XVID Configuration Main Settings window:
    Click ‘more’ behind the profile@level option.
    Check ‘interlaced emcoding’ checkbox.
    Click ‘OK’.

    If you do not do this step, your interlaced 3d format will be destroyed immediately by the following compression!

    (Otherwise, the above is exactly what I have done with some movies with great success – the results were astonishingly good for one night of processing time per DVD size movie!)

    Kind regards,

  • 4 Martin Haverland // Jan 16, 2010 at 02:57

    BTW: To even cut processing time down and keep audio quality, I do the following:
    Demux Video and Audio stream of the original video.
    Take the audio from the separate file when creating the final output avi.
    No re-encoding and therefore also no quality loss.
    Tool of choice for this is Avidemux (free software).

  • 5 Martin Haverland // Jan 17, 2010 at 18:20

    BTW, guys, I just read that IZ3D already has 2D to 3D support in their lates beta test of their MediaPlayerClassic.
    After taking sneak peak into their source code trunk, I instantly noticed that they are using parts of virtualdub (for script interpreting) and (more interesting) Avisynth.
    I would not be surprised to see something like we have here, just in a binary package….

    Kind regards,

  • 6 MovLab // Jan 23, 2010 at 04:38

    All this works Great!!

    Thank you…


  • 7 Sherif // Feb 2, 2010 at 20:25

    What are properties of the video file which can be converted by using of this method (dimensions – frames per second – others)? What are the required changes in your script (avs file) to fit every type? I suggest to make a program to prepare avs files (3d avs editor) according to properties of every video file (as subtitles editors instead of the manual editing).

  • 8 Bloody // Feb 2, 2010 at 21:08

    There is no need for such thing, the script takes the dimensions and other parameters automatically and makes the output the same. You just need to change the input video file name and that is all. If you need to resize, change framerate, change audio parameters etc. you can use additional filters to do that in VirtualDub…

  • 9 Martin Haverland // Feb 18, 2010 at 20:03

    …or even simpler , add the required filters in front of the 3d conversion in the avisynth script. The builtin filters of avisynth are excellent, well worth reading the avisynth docs.

  • 10 Toli // Feb 27, 2010 at 10:31

    I’m just wondering is it possible to produce stereoscopic file for colored glaces that could be played with mplayer-hc or kmplayer? I mean a file that has merged 2 pictures and do not require specific software capable to merge 2 video channels.

  • 11 Toli // Feb 27, 2010 at 10:46

    Hah :) I found how to achieve this… I just changed the script and the encoded file is exactly what I wanted.

  • 12 Martin Haverland // Mar 2, 2010 at 03:13

    BTW, toli, if you want to see *optimized* anaglyph, like stereoscopic player dies offer (much better color impression), it is no rocket science. On the stereoscopic player webpage, the matrix transformation on the colors is explicitly mentioned.
    Do this information in your avisynth script and whoa…i mean, voila!

  • 13 Toli // Mar 2, 2010 at 10:55

    You may have in mind this article http://www.3dtv.at/Knowhow/AnaglyphComparison_en.aspx right?
    There are some matrix calculations … hmm I will try to add them to the script.

  • 14 Toli // Mar 3, 2010 at 12:26

    I tried to do some changes in the script but without success. I could not understand how to do the matrix calculations over clip.
    So I added :
    r1 = (f1.ShowGreen * 0.7) + (f1.ShowBlue * 0.3)
    g1 = 0
    b1 = 0

    r2 = 0
    g2 = f1.ShowGreen
    b2 = f1.ShowBlue

    MergeRGB(r1+r2, g1+g2, b1+b2)

    Of course it is wrong :)
    Now I am waiting 5 dais before having access to doom9 forum :)
    If anyone have an idea how this calculation could be done please share …

  • 15 thachSanh1987 // Mar 4, 2010 at 19:15

    Audio Compression MPEG Layer-3 in my computer is maximun 56 kBit/s 24000hz Stereo 7KB/s. How to get 128Kbit/s 48000Hz like image above. ^^

  • 16 Bloody // Mar 4, 2010 at 19:17

    You can download and install the LAME ACM codec.

  • 17 thachSanh1987 // Mar 5, 2010 at 06:13

    I’ve just downloaded codec that U give, after i install by right-click LameACM and choose “install”, Audio Compression MPEG Layer-3 in my computer still is maximun 56 kBit/s 24000hz Stereo 7KB/s. :(. What’s wrong

  • 18 thachSanh1987 // Mar 5, 2010 at 06:26

    Could I use VirtualDub to convert MKV file( 2d t0 3D) to AVI file?
    U know, when I do this, at Audio=>Compression only “AC-3 ACM Codec can be chosen. Mean, I cannot choose MPEG-Layer3.

  • 19 Bloody // Mar 5, 2010 at 11:04

    You have another category named Lame MP3, go there…

    The container of the file does not matter provided that it is being passed through AviSynth you get AVI contained output, but then again it depends on what audio and video codecs were used for compressing the content in the MKV file. And also what codecs you have installed in your system that can be used to decode the input file, you may try installing a codec pack like K-lite for example.

  • 20 Simut // Mar 17, 2010 at 09:48

    Hi, I’m a noob in this field but i want to ask u guys smth. I’vre converted succesfully with this method some trailers. I’ve got some red-cyan glasses. The monitor must be an 120 Hz? Or I can use the old CRT one? I’ve got the full version of stereoscopic player. I’ve tried to open the converted file there to play. What option should I use? I tried to use sensio option but the colors are not ok. Can i watch the trailer in 3D with the full colors, not in redish blue? Thanx

  • 21 Bloody // Mar 17, 2010 at 11:05

    If you have converted directly into anaglyph red-cyan format with the script then you can play the movie with just about any video player and normal monitor (no need for 120 Hz). If you’ve converted in a side by side format, then you need the Stereoscopic player configured to combine these and output anaglyph again on normal display with no special requirements. If you want full colors then you should go for 3D Vision shutter glasses with a 100Hz display or more (CRT or LCD).

  • 22 Simut // Mar 18, 2010 at 22:49

    thanx bloody, but how can i modify the script to convert it directly into anaglyph red-cyan? I haven’t made any changes to the 2d-to-3d-03b.avs script that I have downloaded from the above link. I suppose it converted to an side-by-side format right? In stereoscopic player where do I configure it to combine these and output it in anaglyph again? Thanx

  • 23 Bloody // Mar 19, 2010 at 22:13

    Look at the comments in the script, they start with #, then comment the side by side output and uncomment the red-cyan anaglyph one and you are done.

  • 24 Simut // Mar 20, 2010 at 21:46

    thanx bloody, it worked ;) but how to get a decent deph perception? if i use anaglyph red-cyan in the script it seems like the deph isn’t there..or maybe is the display’s fault…

    I must get a set of shutter glasses and an 120 Hz display :P

  • 25 Rich // Apr 7, 2010 at 19:58

    I tried running to avs script and get an error. I tied 2 different avi files, one at 25 fps and one at 23.967. HELP
    Avisync openfailure:
    DirectShowSource: I can’t determine the frame rate
    of the video, you must use ‘fps parameter.
    D:\1c\2d-to-3d video-conversion-scripts|2d to ed .avs,line 9

  • 26 Bloody // Apr 7, 2010 at 20:07

    What was the file container (video file extension) and what compression was used? The problem might be coming from the codec used for decompressing the videos that is installed on you PC…

  • 27 Alex // May 17, 2010 at 02:53

    Hi all,

    Real time conversion works an absolute treat ! :-) (using Nvidea’s player and AVIsynth script)

    However, if i try to open the AVIsynth script in VirtualDub (same video) I get the following error

    “AVI Import Filter Error: Unknown (80040154)”

    Any ideas?


  • 28 Bloody // May 17, 2010 at 12:07

    It seems there is something wrong with VirtualDub, having trouble to understand the input it gets… try reinstalling/updating it.

  • 29 hajerry // May 27, 2010 at 14:01

    Hi just a quick question will there be any lost in quality if i use the default setting of the script and follow the instruction as above?

    Video file is in mkv format 1080p

    I don’t really understand this part of the script:

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

    If i uncomment this part and use 1920 for horizontal size will it produce the same quality video as the original file?

  • 30 Bloody // May 27, 2010 at 14:13

    It depends on the input video quality and the compression settings and output codec you select, with Quantizer 4 for quality based output using XviD there should be some insignificant loss of quality that will be hardly noticeable.

    The part of the script you are wondering about is intended only for row interleaved passively polarized 3D displays, and the settings for quality improvement is related only to them!

  • 31 hajerry // May 27, 2010 at 15:12

    Wow fast reply!

    This is the video info:
    Video: MPEG4 Video (H264) 1920×1080 23.98fps
    Audio: DTS 48000Hz 6ch

    So using the default settings for the script even if there is loss in quality it would be insignificant with xvid encodes?

    I’ll be converting the file and try it once it done.

    Thanks a lot!

  • 32 Bloody // May 27, 2010 at 15:25

    Yes, and you can decrease the number of the quantizer to less than 4 to get higher quality, but the file size will also be bigger. For the audio you don’t need to recompress it, you can just copy the audio stream to retain the same quality.

  • 33 hajerry // May 27, 2010 at 16:15

    Weird, the MT doesnt work for me.

    I mean it works fine for small file but when i try it on large file like this 1080p file i’m trying to convert VirtualDub will popup an error “Out of memory” but if i use the normal single thread script it works fine.

    Not that it matters a lot as long as it can be converted.. running it now.

  • 34 hajerry // May 28, 2010 at 08:35

    All done and nice but i lost my subtitles..

    Anyway to go around this?

  • 35 Bloody // May 28, 2010 at 10:06

    There is a free VirtualDub filter to import and overlay subtitles over the videos you are encoding, so that they can be encoded in the exported video file. You need to convert the subtitles to SSA format for the filter to work, but there are enough subtitle conversion programs that can do that…

  • 36 emmerick // Jun 18, 2010 at 05:34

    hello people here did some videos and they were perfect, using the script to-2d-3d-03b, but how do I increase even more depth. where to change it in the script.
    a hug to everyone

  • 37 Bloody // Jun 18, 2010 at 10:10

    Unfortunately not much you can do to get more “depth” with this algorithm…

  • 38 emmerick // Jun 18, 2010 at 16:40

    thanks friend
    would know if some software that could make it more depth.

  • 39 Bloody // Jun 18, 2010 at 16:54

    Generally all these automated real-time solutions provide very shallow depth, because of the way they work. So you cannot get much with any of them, for much better results you’ll have to manually define depth maps for the objects in each frame for example.

  • 40 emmerick // Jun 18, 2010 at 17:21

    Now I understand, most if not ask how much it would rsrsrsrsr. Do you have any tutorial.

  • 41 tuti // Jul 17, 2010 at 03:56

    “I mean a file that has merged 2 pictures and do not require specific software capable to merge 2 video channels” what change you did to the script that merge 2 video channels.

  • 42 Timothy // Jul 22, 2010 at 16:50

    hey, i dont understand how to use this..
    i’m using the asus g51J 3d n i want to convert VOB file
    cn u help mee.. please?

  • 43 Bloody // Jul 22, 2010 at 17:15

    Which part exactly are you having trouble with?

  • 44 Arif // Aug 18, 2010 at 02:22

    I am not a movie person or a techie but I managed to create a video (thanx to easy to follow instructions) however the output video is in a cross-eyed format (sidde by side ) how do i view it in 3D ? i am playing it in Nvidia 3D vision Player. Or do i need a specific glass to view these videos (side-by-side formats). Any help is appreciated.


  • 45 Bloody // Aug 18, 2010 at 09:31

    It is just in side by side format, not crosseye side by side format (you can do that by reversing the left and right frames in the output if you wish to). You can then open the output video with the 3D Vision Video Player and watch it in 3D…

  • 46 Arif // Aug 18, 2010 at 19:18

    But i i dont make it a cross eyed and let it be just side-by-side, is thre a way to watch it in 3D? I downloaded your sample video and it open in the same format as mine side by side (not like the screenshot on top of this page). What is the best way to view it in 3D? I am sorry for stupid and kiddish questions on techie forum, and really appreciate all your help.

  • 47 Regis Maltais // Aug 26, 2010 at 18:55


    When I try to convert a video with the script and VirtualDub, i can see two videos sides by sides, but the end result is just one video like the original one. I cannot obtain the video with two parts sides by sides. Can you assist me?

    Many thanks


  • 48 BijuSasi // Aug 27, 2010 at 18:22

    I found that MediaCoder software (freeware Converter) is compatible AVISYNTH script you can convert any video to 3D with 3D converting script which was given by 2D to 3D Realtime Video Conversion Script for Avisynth v0.3

  • 49 Philip // Sep 12, 2010 at 20:26

    Got a problem:(
    when I open the AVS script it says Avatar_Trailer_Hd cant be found
    so i renamed the file to that name. then it opened it but when I want to save it it says that the source image format was not acceptable.
    and that way I can only open avi:(

  • 50 3D Video Clips // Sep 20, 2010 at 01:40


    Just like to know, if there’s any way you could post embed codes for your videos. Great site btw. Love the concept.

Leave a Comment