making 3d video and converting 2d video to 3d video

Talk about Head Mounted Displays (HMDs), augmented reality, wearable computing, controller hardware, haptic feedback, motion tracking, and related topics here!
Post Reply
JDuncan
Cross Eyed!
Posts: 130
Joined: Wed Feb 09, 2011 3:30 pm
Location: My Left Hand
Contact:

making 3d video and converting 2d video to 3d video

Post by JDuncan »

First I made the 2d to 3d conversion to get my bearings, second I made the test video, third I went back and tweaked the 2d to 3d video using my test video.

So I will show how I made the test video first, then the 2d to 3d conversion.

- i had to have a bmp picture to use as a test pattern. I first used two thick lines in a xy axis cross.
This was the first test pattern, the lines were too think to make any meaningful judgement, so I had to make a better test pattern.

I used the thinnest line the ms paint had and made a xy cross again, and then I put a diamind shape over when the x and y lines crossed, and then I put a circle touching the 4 lines of the diamond.
Then that wasn't good enough I made a second line near the first y axis line, this was the key pattern the second y axis line.

- then I made a folder and copied the same picture of the pattern 30 times in the folder, naming them from 1 to 30. This is to make the avi video file.
Then I used the bmpseq1.03 software and made the avi.
I had to install java for the sw to work, then I opened the sw and from the action tab this is what I clicked;
start, the number 1 picture,
end the number 30 picture,
frame rate 30
save test.avi on my desktop
run ran the program and saved the test.avi to my desktop.

- this file is large so I had to make it small and to do that I used virtual dub.
To use virtual dub I had to use ffdshow tryouts sw and I also had MatroskaSplitter23062013 sw installed.

I opened virtual dub and from the video compression tab I clicked ffdshow, configure, encoder tab I clicked encoder and set it to ffv1.

Then I opened the video file I made and saved it as a avi file in my documents.
Then I repeated copying the file 30 times in its own folder, naming them in numerical order from 1 to 30.

Then I made these 30 video files into one video file using virtual dub.
I opened the folder with the 30 video files and clicked 1, then from virtual dub file tab I clicked append then from the video folder I clicked 2, then I clicked save as avi and saved it to my desktop.
Making sure the video tab, compression set as ffdshow.

Then I had my test video, I could make it into side by side 3d to then test on my google cardboard.

- I had to install avisynth and megui.

Then I made a text file and renamed the extension to avs from txt.

Then I put this code into the avs file;

"
loadplugin("C:\Program Files (x86)\AviSynth\plugins\DirectShowSource.dll")

left=directshowsource("C:\Users\jerry\Desktop\test.avi", audio=false, 29.970).crop(14, 0, 0, 0)
right=directshowsource("C:\Users\jerry\Desktop\test.avi", audio=false, 29.970).crop(0, 0, -14, 0)

return stackhorizontal(left, right).converttoyv12()
"

Then I opened the avs file in megui and changed mkv to mp4, and saved the file to my desktop.

Then I had my side by side test video I could look at in my google cardboard.
What is important is the 14 in the avs code, I set it from 2 to 72, odd numbers won't work, even numbers only.
I found 14 had the cleanest separation of the 2 y axis lines out of all the other numbers, and at 20 to 72 the results went from bad to worse.

The resulting video looks fine using 14 when I did the 2d to 3d conversion which I'm going to tell you how I did that now.

______________________________________________________________

2d video to 3d video guide

first your going to need these sw,
graphedit10-090724 (use the 32 bit version),
ffdshow_rev4532_20140717_clsid,
MatroskaSplitter23062013,
mkvtoolnix-64bit-8.8.0-setup (32 bit version will work the same),
tsMuxeR_2.6.12, MeGUI_2624_x86
AviSynth_260

- first you use tsmuxer, open the video file you want, a mp4 youtube video will work.
Then demux it, click demux and where to save it to. I find making a folder with 1 then the demux name works so the 2d to 3d process is clean.

Look at the fps in tsmuxer for use in the next step, it is 23.976, or 29.970, or 25, etc.

- next open mkvtoolnix, open the file in the 1 demux folder you just made, and click the second box that has the name of the video file which highlights the settings on the right.
Then set the fps to the fps you saw in tsmuxer, if it was 29.970 this is the same as 30000/1001.
23.976 is the same as 24000/1001.

click where to save the file, make a folder called 2 mkvmerge and save the file in there by clicking start muxing.

- now open the 32 bit version of graphedit, and then drag and drop the file mkvmerge made from the previous step.
click the ms video decoder then from the edit tab delete it, then click the mkv video link and drap the line to the ffdshow video link.
Then click the renderer box and from the edit tab delete that.
Then save the file as the name of the video . grf in a folder named 3 graphedit

- Then make the avs file like I showed in the previous guide above on making the test file, make a text file and rename the file extension to avs instead of txt.
Then copy and paste this code into the avs file;

"
loadplugin("C:\Program Files (x86)\AviSynth\plugins\DirectShowSource.dll")

left=directshowsource("C:\Users\jerry\Desktop\New folder\3 graphedit\name of video.grf", audio=false, 29.970).crop(14, 0, 0, 0)
right=directshowsource("C:\Users\jerry\Desktop\New folder\3 graphedit\name of video.grf", audio=false, 29.970).crop(0, 0, -14, 0)

return stackhorizontal(left, right).converttoyv12()

"

Notice the 29.970, this is what I saw in tsmuxer, and the location of the grf file is different on my computer than on your computer.

- then open megui and open the avs file, and where to save it and save it as mp4 not mkv.
Then click the queue button, not the one in the bottom right corner the one in the middle right. This should automatically start wrking.

Then you have the video file now you need the audio muxed in, so from the megui tools tab, click muxer, mp4 muxer.
Open the file you just made, and add the audio in the tsmuxer folder, then click queue and it should automatically start working.

Then you can save this to your phone and look at it in google cardboard or something like the rift or vive.
If your phone is weak 720p videos in side by side will stutter.

- if ffdshow is giving you problems I set the codecs tab to use mp4 and mpeg2, and the codecs, raw video, to "all supported".
You do not have the required permissions to view the files attached to this post.

JDuncan
Cross Eyed!
Posts: 130
Joined: Wed Feb 09, 2011 3:30 pm
Location: My Left Hand
Contact:

Re: making 3d video and converting 2d video to 3d video

Post by JDuncan »

video guide part 1
https://www.youtube.com/watch?v=pc4lVfAP-8s

video guide part 2
https://www.youtube.com/watch?v=w2GsgGRedGQ

the guide is for 720p aspect ratio, for different aspect ratios you might need to make a test disk and change the avs file 14, -14, to something else.

JDuncan
Cross Eyed!
Posts: 130
Joined: Wed Feb 09, 2011 3:30 pm
Location: My Left Hand
Contact:

Re: making 3d video and converting 2d video to 3d video

Post by JDuncan »

I couldn't play the videos I had in 720p 2d as 3d using the avisynth code in the guide, so I tweaked the code and got the same picture but less cpu usage;

Code: Select all

loadplugin("C:\Program Files (x86)\AviSynth\plugins\DirectShowSource.dll")

left=directshowsource("C:\Users\jerry\Desktop\3d video\3 graphedit\Perfume Cling Cling.grf", audio=false, 29.970).crop(14, 0, 0, 0).spline64resize(640, 360)
right=directshowsource("C:\Users\jerry\Desktop\3d video\3 graphedit\Perfume Cling Cling.grf", audio=false, 29.970).crop(0, 0, -14, 0).spline64resize(640, 360)

return stackhorizontal(left, right).converttoyv12()


This is for 16:9 aspect ratio video. It looks exactly the same ratio wise and filling up the screen as the previous code, it just uses less pixels to do so but looks no different in my google cardboard.

https://www.youtube.com/watch?v=EGRa7I0t4xc

Post Reply

Return to “General VR/AR Discussion”