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:··········

Realtime 2D to Stereoscopic 3D Conversion from Live TV Source

December 23rd, 2009 · 6 Comments · 2D to 3D Conversion

stereoscopic-player-live-video


I’ve already written about the interesting DirectShow 3Dfier filter that is doing quite well with realtime conversion from 2D video to stereoscopic 3D. After playing a bit more with the filter I was able to make it work with live TV feed coming from a TV tuner, but I had to use the Stereoscopic Player instead of Nvidia’s 3D Vision Video Player as only the first one supports the Live Video mode for use with TV tuners and other video capture devices. That said I should also note that I was able to make things work with NVidia’s player too, but with a bit of workaround which is making it a bit harder and not so convenient. If you use VideoLAN (VLC) for capture of the live stream from the TV tuner to a file and then open the video file in 3D Vision Video Player you are still good to go, but with just a little bit of a delay.


stereoscopic-player-playback-options


And since the Stereoscopic Player is a multipurpouse stereoscopic 3D video player that supports much more than what Nvidia’s player offers, you’ll have to open the File menu and then Settings in order to configure the player to use 3D Vision as a viewing method.


stereoscopic-player-decoder-settings


Then you need to go to the Decoder menu and there under the Video Processor category Add the 3Dfy 2D-to-3D Transformer. This is actually the DirectShow 3Dfier filter (download it here) that is going to be used for the realtime 2D to stereoscopic 3D video conversion, unfortunately as I already said this is not a free filter and has some limitations for use. I still haven’t gotten any response from the authors of the filter…


stereoscopic-player-video-properties


The last thing you need to do is to open the File menu and form there to go to Video Properties in order to setup the incoming video stream. By default it will be a monoscopic source, but after adding the 3Dfier filter it will be converted into a Side by Side format, so you need to change the Format Layout to that mode. This is the last step in the setup process, what is left is only to open the Live Video stream from your TV tuner. After you do that you’ll have some additional settings for the TV tuner that will be available in the File menu, you need to use these in order to select the TV channel and to configure the TV Tuner. You can also just choose the right settings from your TV Tuner software, select the needed channel and the close the software and open the Stereoscopic Player to have the tuner settings already applied. It might not be the most convenient way, but still you get pretty nice results from this realtime 2D to stereoscopic 3D conversion from the live TV feed. As always if you try this, please report your experiences in the comments below…

→ 6 CommentsTags:·········

Fly Me to the Moon Trailer in Stereoscopic 3D (720p)

September 7th, 2009 · 4 Comments · 3D Movies & Videos

Fly_Me_to_the_Moon_Trailer-720p-S3D


Fly Me to the Moon is a kids story about three flies that went aboard the Apollo 11 flight to the moon along with the first human astronauts that was first released beginning in 2008, but did not get that much attention. It is still aired in some countries in 3D cinemas, including the one I live in and although quite a bit hard to find, thanks to a guy in Nvidia’s forums we now have a stereoscopic 3D version of the trailer fro the movie. The movie comes in animated 3D and in stereoscopic 3D and although it is rated for kids of 3+ years it is still fun to watch even by adults, especially the ones that are interested in S3D and now with “the right” trailer you can get a nice feel on what to expect from the movie right on your PC equipped with GeForce 3D Vision or some other Stereo 3D viewing setup…


flyme-trailer-player-settings


The trailer is in 720p (1280×720 resolution) with the two frames not in the typical Side by Side format, but in Over/Under format. So when viewing with NVIDIA’s Stereoscopic 3D Video Player you need to select the Left image on top and the right at the bottom for optimum results. And please share your experience if you watch the trailer and on what S3D system are you doing it…

- For the official website of Fly Me to the Moon Movie
- Download Fly Me to the Moon Trailer in S3Dmirror 1mirror 2

→ 4 CommentsTags:·········