![]() |
Producing 3D files in AviSynth
A while ago Pavel mentioned he had no tool to produce HDMI v.1.4a 3D files which consist of the left view on the top, the right view at the bottom, and a 45-line gap in-between.
I said I would add the ability of creating such files in Bororo 3D if I could find a reasonable way of doing that in a Sony Vegas plug-in. Well, to this day I have not found such a way. Then I noticed people on the DVInfo Vegas forum talking about their use of AviSynth for things they cannot get done in Vegas. So I started writing an AviSynth plug-in to create the HDMI format files. This worked but some of it did not work right with MPEG files. And these days most of our videos are in the MPEG format. A week later I learned more about AviSynth and realized I could accomplish the same result, but without the problems, by writing AviSynth scripts rather than plug-ins. So, I got to work, and today, another week later, got finished. I created a file called Pantarheon3D.avsi, which is a collection of AviSynth functions for creating 3D files. It can do things such as: - Create classical, red/cyan, green/magenta, and yellow/blue anaglyphs; - Create full and half-width left/right and cross-eyed files, including yt3d files. - Create full and half-width top/down and down/top files. - Create the aforementioned HDMI v.1.4a 3D files. - Extract the left or the right view from all of the above except the anaglyphs (since they do not have all the necessary information). - Convert from any of the above (except anaglyphs) to any of the above (including anaglyphs). To give you an example, suppose you have a 29.97 fps yt3d video called yt3d.mpg and want to convert it into the HDMI format. Assuming you have an MPEG decoder (and who among us does not), it takes but one line in your AviSynth script: Code:
DirectShowSource("yt3d.mpg", fps=29.97).Yt3DToHDMI Or if you have two videos, left.avi and right.avi, this is what it takes to make a yt3d file: Code:
Yt3D(AviSource("left.avi", "right.avi") I have not written the documentation for it yet, but have uploaded it, along with some sample AVS scripts to Pantarheon.org. This will be the link to the documentation page. Until the docs are there, you can click on msi (on that page) to get the Windows Installer version, or on zip to get it all in a .zip file. Assuming you use the .msi version, it will install Pantarheon3D.avsi into your AviSynths "plugin" directory (assuming it was installed to its default directory). If you download the .zip version instead, just copy the file Pantarheon3D.avsi to the AviSynth plugins directory. And of course you need AviSynth. It only comes in a 32-bit version but it works well. |
Thanks Adam, you are the greatest. Pavel
|
You're very welcome.
|
I have just uploaded the first part of the documentation. I am too tired to work on the rest of it now, hopefully tomorrow. But this should get you started.
|
Quote:
I don't have a 64 bit machine to test anything myself, but people seem to be having success with it. |
Thanks, Robert. I am aware of it and, indeed, have it on my system, but so far it is for people who feel very comfortable tweaking the insides of their computers, so I am not officially recommending it.
Of course, my scripts work with it because all they use are built-in AviSynth functions. But it only works with AVI files, no MPGs (since the necessary plug-ins are not included in the 64-bit version), so its usefulness is quite limited. And the 32-bit version works very nicely, so there is really not much of a point in using the 64-bit version. Now, if it let me open the .avs files directly in Sony Vegas, that would be very nice. But it does not. |
Whew! I'm glad to say I finished the documentation for Pantarheon3D.avsi. Now I can take a break. :-)
|
I have added a few functions that I somehow missed in the initial upload. I have uploaded the updated files as version 1.1.
|
Adam, you are The Great Man! Thank you for your free tools!
Will be cool if youtube can accept *avs script as upload for their internal avc encoder:) |
I downloaded the program but it doesn't even have a user interface in windows. It's fine if you have an undertsanding of computer languages but way above the average video guys head. Even if I worked it out (highly unlikely) I still don't know how you would get this onto a blu-ray disk to show on a 3D TV.
And what about convergence/editing etc? Do you use Tim Daswoods plugin or do you need to buy the extortionate 3D Nero? |
I am curious if the format that is stored on disk is the same as the HDMI 1.4 specification or is that a function of the BD player to create that file format? Since a 3D movie should play in an old BD player my first thought is that the two video streams are separate on the BD but maybe the old player can read the new format file and only use the first video portion. Quite possibly this is a stupid question but it is something that I have not been able to understand with my limited exposure to Blu-ray, HDMI, and 3D.
|
Quote:
|
Quote:
I wrote this script because Pavel was looking for a way of producing the HDMI format and because I did not find a way of incorporating frame size changes in Vegas plug-ins. I would also strongly disagree that AviSynth is above the average video guy's head. Considering it can do things that are difficult to do with any other software, I would say it is something every video guy needs to learn. And most probably have. All you've got to do is write very short and simple scripts, such as: Code:
left = AviSource("left.avi") And version 2.0 of the script will do even more (when I finish it, mind you), such as convert field-sequential files into other 3D formats. Yesterday I watched the field-sequential version of the Spy Kids 3D DVD in the yellow/blue format without needing to buy any 3D player! All I needed was the upcoming version 2.0 of my script, the DVD, and a short script similar to the example above. I then opened Super, dragged my short script on it and it rendered it to an MPEG file for me (though I had to keep my computer running overnight for it). |
Hi Adam, I think I am understanding what you are saying. Not sure if this is any use for me as I am Mac based and have been playing with Tim Dashwoods plugin which is easy to use.
Still not sure how I can make a 3d file which can be burnt and shown in 3D on a 3D blu-ray player. And a blu-ray player will not play 3D files. It has to be a 3D blu-ray player. Panasonic have one out right now which is HDMI 1.4. The PS3 is due an update at any time to show 3D, but it is HDMI 1.3. |
Quote:
|
nokia is giving for free a MVC 3d encoder, you just need to compile it.
Mobile 3D Video | Nokia Research Center |
Quote:
|
Quote:
Someone will come up with a public spec for a different technology accomplishing the same, and then it will be bye-bye bee dee! |
Pavel thanks for the link that was very informative and a surprisingly short read. For some reason your posts won't allow me to quote them but this is relative to the Tom's Hardware link on Blu-ray 3D. I can see where the authoring of a Blu-ray 3D would be quite complex to create that second view data.
|
Hi Steve, you are very welcome. The whole concept is not very hard, but the current standards need to be extended, because somehow they have to pump twice the # of pixels at the same frame rates, which taxes the hardware, and bandwidth of the existend delivery systems. That is why they either lose half the pixels or come with different, more efficient compression schemes, like the MVC, and then there is no inexpensive authoring and delivery systems for those schemes, at least not yet. It will take a while. I don't know why the system doesn't allow quoting me, maybe it is a hint for me to talk less.... :-)
|
I have just added some illustrations to the documentation. This should make it easier to understand what the basic functions do.
|
Thank you Adam,you are the greatest!
|
Quote:
Seriously, I am glad you find it useful. |
Hi Adam,
Thanks for your tool but i couldn't try it. I gave it a go with left, right-eye videos demuxed from some of my 3DBDs since i don't have my own 3D left, right videos for the time being. (i don't have 2 camcorders or any new gen. 3D camcorder to shoot yet.) First i created left avs and right avs. left.avs: DirectShowSource("C:\test\left_v.h264", fps=23.976, audio=false) right.avs: DirectShowSource("C:\test\right_v.h264", fps=23.976, audio=false) And final avs: Import("C:\Program Files\Pantarheon\Pantarheon 3D AviSynth Toolbox\Pantarheon3D.avsi") lv = DirectShowSource("left.avs").ConvertToYUY2 rv = DirectShowSource("right.avs").ConvertToYUY2 HDMI3D(lv, rv) And when i tried to open the final avs with MeGui i got this popup: "Left and right clips must be of the same size!" I checked out and i met: Same duration, Same frame numbers, but right video is always shorter than the left video as file size! Weird. What am i missing? Thanks in advance. EDIT: OK, i've found i have to re-encode right-video before processing. |
Quote:
|
Thanks but not sure since i haven't been able to re-encode the right-eye video as for now.
|
OK, I have received your email and I think you are misinterpreting the "same size" here. It refers to the size of the image. Both have to be the same, that is have to have the same dimensions. So, for example, if the left view is 1920x1080, the right view has to be 1920x1080 as well. But the files do not have to have to have the same number of bytes in them because image compression is highly unlikely to give you that.
|
Thanks for the clarification.
Now i got the right_out.264 file and tried lots of permutations on command line. But i always got 25 fps instead of 23,976. Here is one of them: "C:\H264StereoSource_a2>x264 --level 4.1 --crf 20 --tune film -I 24 --b-pyramid none --sar 1:1 --aud --rc-lookahead 24 -o right_son out.avs avs [info]: 1920x1080p 1:1 @ 25/1 fps (cfr) x264 [info]: using SAR=1/1 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 x264 [info]: profile High, level 4.1 An unintentional loss of pictures occurs! Exitb/s, eta 0:00:12 A gap in frame number is found, try to fill it. RefPicList0[ 2 ] is equal to 'no reference picture' RefPicList0[ 2 ] is equal to 'no reference picture' RefPicList0[ 2 ] is equal to 'no reference picture' RefPicList0[ 2 ] is equal to 'no reference picture' RefPicList0[ 2 ] is equal to 'no reference picture' RefPicList0[ 2 ] is equal to 'no reference picture' " Anyway i converted it to 23.976 back while remuxing with TSMuxer. And tried to open my final avs with MeGui: "Import("C:\Program Files\Pantarheon\Pantarheon 3D AviSynth Toolbox\Pantarheon3D.avsi") lv = DirectShowSource("left.avs").ConvertToYUY2 rv = DirectShowSource("right.avs").ConvertToYUY2 HDMI3D(lv, rv) " And i got the same popup: "Avisynth Script Error: Left and right clips must be of the same size, bla,bla..." This is why MeGui doesn't accept MVC or can i open and re-encode this frame-packed stuff in Premiere CS5 or Sony Vegas? |
Quote:
|
Thanks but most of the hobbyists need a free MVC encoder and i think your tool + avisynth script + free MVC encoder would be great.
I used to uıse Premiere CS2 in the past but i mostly needed to use avisynth and Cineform. |
Yes, such an encoder would be nice. And someday someone will release one. But it is still too new.
|
At least there are some open source codes nowadays and i hope somebody -or a team will implement MVC encoder soon. Thanks for your assist btw.
|
Perhaps the VLC encoder is the step in the right direction.
|
Hi,
I wanted to share my test results. For the time being i sticked with x264's frame-packing capabilities; it puts some flags and you everytime have to select "side-by-side" or "top-bottom" options on player's settings according to the source file. Yesterday i made some trials and i found "TopDown3D"/ "LeftRight3D" is only working with TMT5 in 3D mode. So for now the best solution is to use "-reduced" option. (IMO) Here are some scripts: (Created x264 files with those scripts and packed into m2ts /mkv containers work flawlessly in 3D mode with both TMT 5 and PDVD 10 .) And you can open them with MeGui and re-encode to x264 as frame packed... (you may use any desired preset too...) (Sample avisynth scripts are written for left-right frame packing, you may change "LeftRight3DReduced(lv, rv)" line with "TopDown3DReduced(lv, rv)" ) With DGNVTools of Don.(you need to have a compatible nVidia card and the application of course.): LoadPlugin("C:\DG\DGDecodeNV.dll") lv = DGSource("C:\xxx\left.dgi") rv = DGSource("C:\xxx\right.dgi") LeftRight3DReduced(lv, rv) ConvertToYV12() Or without DGNVTools: either: lv = FFVideoSource("C:\xxx\left.m2ts") rv = FFVideoSource("C:\xxx\right.m2ts") LeftRight3DReduced(lv, rv) ConvertToYV12() or: lv = directshowsource("C:\xxx\left.m2ts") rv = directshowsource("C:\xxx\right.m2ts") LeftRight3DReduced(lv, rv) ConvertToYV12() Thanks Adam really for your great tool. EDIT: btw there are no options here like bold, code, quote, etc. Why? I'm a new boot here; is this the reason? |
You're quite welcome. As for bold and such, just use regular BBCode tags (see https://secure.wikimedia.org/wikipedia/en/wiki/BBCode for details). Those work on most web-based fora, including this one.
|
Thanks Adam.
|
Hi Adam, me again.
I found left video is extracted as 1088p, so i left DGNVTools to crop the left movie and i used this aviscript: Quote:
Code:
C:\blabla>x264 --fps 24000/1001 --level 4.1 --sar 1:1 --aud -o adam.264 adam.avs |
FYI those are working:
Quote:
Quote:
|
Yes, sometimes 1080 decodes as 1088 because certain formats have to be divisible by 16. Nothing I can do about it. You may want to try cropping it after you convert it to YV12.
|
But i have tried with ffVideoSource too; FFVideoSource always perceives it as is; 1080...
Quote:
Should i still crop after converting to YV12? |
All times are GMT -6. The time now is 07:28 AM. |
DV Info Net -- Real Names, Real People, Real Info!
1998-2025 The Digital Video Information Network