3D Vision Blog

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

3D Vision Blog header image 4

2D to 3D Realtime Video Conversion with Avisynth v0.2b

January 1st, 2010 · 53 Comments · 2D to 3D Conversion

3d-vision-realtime-2d-3d-convert


Maybe I should start by wishing you all a Happy New Year 2010 and right after that comes the new updated version 0.2b of the Avisynth script I wrote about realtime conversion of 2D video to 3D. The first version of the script was a bit rough and not very functional, but it was more like a proof of concept. The new version is a bit more complete as it works not only with a 720p videos, but with just about anything you give it in terms of resolution. I’ve also addressed another drawback of the first version and that is the fact that the script can now take advantage of multi-core CPUs as the first version was only using just one of the cores. The multithreaded script however is a different one, because it requires a bit of additional work on Avisynth in order to be used and maybe a bit unstable at times, but if you have a dual or quad core processor and get slower framerates you should definitely try it. Just as a reminder, this script is to be opened instead of a video file from 3D Vision Stereoscopic Player or the Stereoscopic Player in a Side by Side format and is designed to be viewed on a computer that is equipped with a 120Hz display and Nvidia’s GeForce 3D Vision. You may however be able to play it on other stereoscopic 3D setup you have if it is capable of playing back videos in side by side stereosopic format…


# 2D to 3D Realtime Video Conversion Avisynth script v0.2b
# Made by Anton Belev at 3D Vision Blog
# www.3dvision-blog.com

# Load the Reform plugin for the skew function
LoadPlugin ("Reform.dll")

# Open the video file for conversion, change the video file name
video2d = DirectShowSource("avatar_trailer_720p.mov")
video2d = ConvertToRGB32(video2d)
videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 16)
CropW = (ResW - videoW) / 2

# Create variables for left and right frame with one frame difference
f1 = video2d
f2 = DeleteFrame(video2d, 0)

# Add the perspective effect to the second frame and crop it
f1 = Spline16Resize(f1, ResW, videoH)
bg = BlankClip(f1, color = $000000)
f1 = skew(f1, bg, ltopx=2, ltopy=2, lbotx=CropW-4, lboty=videoH-2, rtopx=ResW-2, rtopy=2, rbotx=ResW-CropW, rboty=videoH-2, resize = "point")
f1 = Crop(f1, CropW, 0, videoW, videoH) 

# Output the two video frames in a side by side format
StackHorizontal(f2, f1)

The new singlethreaded version of the script requires you to download and install AviSynthon your PC, and then you also need to download V. C. Mohan ‘s Reform plugin for AviSynth and extract it at the same folder when you have the AVS script and the video file you are going to play and convert from 2D to 3D in real time. In version 0.2b of the script you can replace the video file name to just about any file, no matter what is the resolution, although with HD videos over 720p you might have some trouble playing them with normal framerate, so for this the multithreading version of the script might help if you have a processor with multiple cores or even multiprocessor PC. And don’t forget to save the code above with AVS file extension and to replace the avatar_trailer_720p.mov with the name of your video file.


# 2D to 3D Realtime Video Conversion Avisynth script v0.2b MultiThreading
# Made by Anton Belev at 3D Vision Blog
# www.3dvision-blog.com

# For this to work you need to have AviSynth with MT mod 0.7 installed!!!
SetMTMode(2,0)

# Load the Reform plugin for the skew function
LoadPlugin ("Reform.dll")

# Open the video file for conversion, change the video file name
video2d = DirectShowSource("avatar_trailer_720p.mov")
video2d = ConvertToRGB32(video2d)
videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 16)
CropW = (ResW - videoW) / 2

# Create variables for left and right frame with one frame difference
f1 = video2d
f2 = DeleteFrame(video2d, 0)

# Add the perspective effect to the second frame and crop it
f1 = Spline16Resize(f1, ResW, videoH)
bg = BlankClip(f1, color = $000000)
f1 = skew(f1, bg, ltopx=2, ltopy=2, lbotx=CropW-4, lboty=videoH-2, rtopx=ResW-2, rtopy=2, rbotx=ResW-CropW, rboty=videoH-2, resize = "point")
f1 = Crop(f1, CropW, 0, videoW, videoH) 

# Output the two video frames in a side by side format
StackHorizontal(f2, f1)

For the multithreading version, besides the need for Avisynth and the Reform plugin, you’ll also need to download the latest Avisynth MT 0.7 mod and then apply it. This means extracting the MT.dll library in the plugins folder of the Avisynth installation and then overwriting the original avisynth.dll with the modified one (\Windows\System32 for 32-bit OS or \Windows\SysWOW64 for 64-bit OS). After that you’ll be ready to run the script and see that all the available cores of the CPU are being used for processing and thus get a better framerate than with the singlethreading version of the script.

I’ll continue to work on the 2D to 3D conversion script with Avisynth, although I’m actually quite new to using this tool, but it is really very easy to use and can be quite useful at times for different kinds of video processing. So next will probably be a version of the conversion script that will output directly an anglyph video and then maybe even an interlaced image so that you’ll be able to watch these in your favorite video player and not have to use a specific stereoscopic video player. And as always don’t forget to share your comments if you try the scripts and any ideas for further improvements are more than welcome too, especially if they are related to improving the performance as this is a bit of an issue at the moment.

- Download the 2D to 3D conversion scripts and all the needed installation files…

→ 53 CommentsTags:··········

Impressive Realtime 2D to 3D Video Conversion for 3D Vision

December 21st, 2009 · 30 Comments · 2D to 3D Conversion

3d-vision-realtime-2d-3d-convert


I have just found an impressive piece of software, or not actually a standalone software, but a DirectShow filter that can transform normal 2D video files into Stereoscopic 3D in real time and with very good results. I’m talking about the 3Dfier DirectShow filer developed by a Taiwanese company called Radiant Star that in my opinion is the best real time 2D to 3D video conversion solution available so far. That said I’m not meaning that the 3Dfier is absolutely problem free, but still it gives really good results when converting the 2D videos to 3D. You might notice some issues mostly on fast moving and more blurry objects and maybe some jaggy edges on straight lines, but still the depth feeling it quite good having in mind that we actually don’t have the needed depth information as with a true stereoscopic 3D videos. But enough about that, you better try it yourself, the only problem is that the DirectShow filter is not free, but a time limited version (30 days trial, 10 minutes of playback and no depth level control), but maybe Nvidia could license it and provide it free with their future Player software… ;)

3d-vision-player-setup


For usage of this filter with 3D Vision (the filter can also be used with other S3D systems!) we are going to first need the latest version of Nvidia 3D Vision Video Player and the 3Dfier 2D-3D transform DirectShow filter side-by-side demo v0.2. Download and install them, then run the 3D Vision Video Player, open the File menu, choose Settings… and go to the Decoder panel. From the Preferred Filters menu you need to select the Video Processor and click on the Add button, then select the 3Dfy 2D-to-3D Transformer filter from the from the list of available filters on your system. This is it, now you are done and ready to test the real time 2D to 3D video conversion…

3d-vision-format-to-play


When you try to open a normal 2D video file after you’ve selected to use the 3Dfier DirectShow filter with the 3D Vision Video Player you’ll be asked what is the stereoscopic video format, here you need to choose Side by Side format with the default Aspect Ratio in order for things to work. Have in mind that when the player is in window mode you’ll still see everything in 2D, but when you switch to full screen mode and 3D Vision gets activated you’ll see the filter at work. That is is, you are ready to enjoy your 2D video in automatically converted stereoscopic 3D mode…

For best results you’ll need higher quality, preferably HD videos, but even low quality clips might still look quite well when converted… and you can as well try some DVD Videos you have. One of the issue you’ll face is that you’ll have to remove and then add again the filter in the settings every time you decide to watch 2D or true stereoscopic 3D movies as with the 3Dfier loaded things will get a bit messy when you try to open a stereoscopic video file. Also if you use a Media Player Classic and maybe some other players for normal video playback you might notice that the filter is automatically loaded when you open a movie and you see it side by side. This is something you can manage to fix, but you’ll have to play a bit with the filter settings for the player. And please do not forget to share your experience and comments should you decide to test what was described in this guide.

- You can find more information about the filter on the official 3Dfier website…

→ 30 CommentsTags:·········