Log in

View Full Version : BD3D2MK3D v1.17: Convert 3D BDs or MKV to 3D SBS, T&B or Frame-sequential MKV


Pages : [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

r0lZ
2nd July 2014, 10:15
BD3D2MK3D is a GUI to convert movies from 3D BDs to 3D MKV video files in Full or Half Side by Side, Top & Bottom or Frame sequential format, encoded in h264 with x264, or in h265 with x265, or with any command-line encoder. Since v0.87, BD3D2MK3D can also accept lossless 3D AVC+MVC files created with MakeMKV as input.

I have written it mainly because it was difficult to do all operations necessary to do the conversion manually, and because the documentation about the method to use was poor and spread over a lot of posts in this long and technical thread: Guide to convert BD 3D to 3D Left+Right Stereoscopic and Anaglyph (http://forum.doom9.org/showthread.php?p=1663794).

My first attempt resulted in BD3D2AVS (http://forum.doom9.org/showthread.php?p=1575870#post1575870), and was based on eac3to (http://forum.doom9.org/showthread.php?t=125966), ldecod and ssifsource. Ldecod was used to decode the dependent view of the stereoscopic input streams. It works well, but it is terribly slow, and is was therefore not a good solution. Luckily, the external tools have evolved, and I wrote a second version of the GUI, called BD3D2MK3D (http://forum.doom9.org/showthread.php?p=1663794#post1663794). The original BD3D2MK3D was mainly based on ssifSource and DirectShowMVCSource, but is now also obsolete.

Starting with v0.30, BD3D2MK3D is based on new tools, much more efficient, like the tsMuxeR update for 3D blu-ray (http://forum.doom9.org/showthread.php?t=168539) and the Intel MVC decoder (https://software.intel.com/en-us/articles/intel-media-software-development-kit-intel-media-sdk) to decode the dependent view, with the help of the avisynth plugin DGMVCSource (http://forum.doom9.org/showthread.php?t=170107&highlight=DGMVCSource) by Donald Graft or FRIMSource (forum.doom9.org/showthread.php?t=169651) by videofan3d. The GUI uses also a lot of other tools. See the Help menu for a list of the most important tools.

As you can see in the original thread, the development of the method and the tools necessary to do the conversion was a collective effort. I wish to thank all contributors.

Currently, BD3D2MK3D is mature enough to have its own thread, and it's why I have created this thread. Please post all questions and bug reports related to BD3D2MK3D here, and all questions about the external tools that my GUI uses in their respective threads or in the original guide thread (http://forum.doom9.org/showthread.php?p=1663794). Thanks!

Features of BD3D2MK3D:

Convert any 3D playlist from a properly decoded blu-ray 3D to a standalone 3D Half-side by side (HSBS) or Half-top & bottom (aka Over/Under or HOU), or to Full-SBS or Full-T&B, or even to Frame Sequential 3D MKV file.
Can also accept as input a 3D-MKV file created with MakeMKV (with the option to include the 3D MVC stream).
Can resize the output to 720p
Can output a 3D stream compatible with 3D-Ready DLP projectors (720p Frame Sequential at 59.94fps).
Can convert the subtitle streams to 3D, using the depth stored in the original BD for each individual subtitles. (The subtitles can also be kept in 2D if you wish.)
Can hardcode (or "burn") a subtitle stream (all or forced captions only) over the video with the right depth for each individual subtitles.
The subtitles can be muxed in the original BD SUP format for an excellent quality or in VobSub (IDX/SUB) format for a better compatibility.
It is even possible, with some manual work and the help of the Tools menu of BD3D2MK3D, to use a subtitle stream coming from another source (such as a SRT downloaded from the internet or a SUP stream from the 2D BD of the same movie) and convert it to 3D with (approximately) the right depth values to mux it within the final MKV or hardcode it to the video. See the mini guide here (http://forum.doom9.org/showthread.php?p=1742601#post1742601).
Can extract the regular 5.1 DTS or AC3 cores of the DTS-HD, DTS-HD-MA, E-AC3 and TrueHD audio streams.
Can convert the audio tracks to AC3 or AAC for a better compatibility or a smaller file size.
The chapter points are automatically preserved in the final MKV file.
Can include tags about the movie (movie title, director, producer, actors, summary, comments, etc...)
It is possible to provide your own image for the icon of the MKV file and the display in a media center, or to retrieve it from the original BD.
Can add some seconds of black at the beginning or end of the video so that the user has some time to configure his 3D TV and to turn his active 3D glasses on before the beginning of the movie.
The encoding to h264 is made with x264 (32 or 64-bit) for an excellent image quality, and the user can select the most important encoding settings, such as the encoding mode (CQ, CRF, ABR or 2-pass), the preset, tune, profile and level. It can also specify manually additional options if he wish. Similarly, x265 can be used to encode in h265 with a much better compression, but with a few limitations. The user can even encode with any command line encoder by providing his own command line.
The correct 3D video mode is automatically defined in the h264 video stream (the "frame-packing"), in the header of the MKV video file (the stereoscopy mode), and optionally in the file name, so that most TVs and 3D players can switch automatically to the right 3D mode when the file is played.
The final MKV file is automatically muxed at the end of the encoding, and there is an option to shutdown the computer when everything is finished.
BD3D2MK3D has also some independent tools, notably powerful tools to convert an external subtitle stream to 3D, using the 3D depth values extracted from the original 3DBD, and optionally the subtitle positions cloned from another subtitle file.
And much more...

Download:

The latest version of BD3D2MK3D can always be downloaded here: BD3D2MK3D.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z)
The obsolete BD3D2AVS based on ldecod can still be downloaded here: BD3D2AVS.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2AVS.7z)

Please note that BD3D2AVS is obsolete. It is still available if you want to try the old conversion methods, but it is no longer developed, and it doesn't contain all features and bug fixes of the latest BD3D2MK3D. Use it at your own risk, and don't ask for help!

Installation:

Pre-required and recommended programs:

BD3D2MK3D requires Windows Vista or greater to work properly. Windows XP is not supported (due to incompatibilities in the Intel MVC decoder).
Avisynth+ (https://github.com/pinterf/AviSynthPlus/releases) or the old classic Avisynth v2.6.0 (https://www.videohelp.com/software/Avisynth) (32-bit) must be properly installed on your computer. (It's a complex program, but you don't need to use it directly. Just install it.) Currently, Avisynth+ 64-bit is recommended.
Since BD3D2MK3D doesn't decrypt the commercial 3DBDs, you need a way to decrypt them. You can use a good BD decrypter (http://www.videohelp.com/software/sections/decrypters-bd-hd-dvd) that can create an ISO on hard disc, such as DVDFab HD Decrypter (https://www.dvdfab.cn/hd-decrypter.htm) or Ideal Blu-Ray Copy (http://www.idealdvdcopy.com/bluray-copy.htm). You can also use AnyDVD HD (https://www.redfox.bz/anydvdhd.html), that decrypts the original BD on the fly. It is also possible to decrypt only the title you want and convert it to lossless 3D-MKV with MakeMKV (http://www.makemkv.com/). (MakeMKV is free while in beta if you use the key provided here (http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053).)
To convert the subtitles to 3D or to IDX/SUB format, it is highly recommended to install Java (https://www.java.com/en/download/manual.jsp) (32 or 64-bit). (BDSup2Sub++ is also used, but the Java version is still necessary to avoid some bugs of the ++ version.)
BD3D2MK3D can "burn" (hardcode) the 3D subtitles on the video. It's useful if your 3D TV cannot display the 3D subtitles correctly. For the best result, it is recommended to burn the subtitles in BD SUP format. For this, you need to install Microsoft .NET Framework v4 (https://www.microsoft.com/fr-fr/download/details.aspx?id=17718). If it is not installed, the subtitles in the old VobSub (DVD IDX/SUB) format will be used, and the result will be less good.
It is also recommended to install a good video player that can play BD's M2TS and MPLS files and that let you select any audio or subtitle stream. The player is used only for the preview. The free players PotPlayer (http://potplayer.daum.net/) (recommended) or MPC-HC (http://mpc-hc.org/) do the job well, but there are many other good players. Just avoid the Windows Media Player, that doesn't work well at all.

To install BD3D2MK3D, simply extract the content of the 7Z archive to a directory of your choice. BD3D2MK3D saves its settings in its installation directory, and doesn't use the Windows registry. It is therefore highly recommended to install it in a folder where you have full access rights. Do not install it in Program Files or in Program Files (x86). (If you cannot open the 7Z archive, you need a good archiver program such as 7Zip (http://www.7-zip.org/).)
If you wish, you can create a shortcut to BD3D2MK3D.exe in your Start menu (or Start Screen under Windows 8). Or you can simply open the installation folder in Explorer, and double-click BD3D2MK3D.exe to launch the program.

Download latest version: BD3D2MK3D.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z)

r0lZ
2nd July 2014, 10:22
V0.40 is the first version released in this thread.
For infos about the older versions, please see the original 3D conversion guide thread (http://forum.doom9.org/showthread.php?p=1663794).

Version history (starting from v0.30, the first version based on DGMVCSource or FRIMSource)
The BD3D2MK3D history can be viewed or downloaded here: history.txt (http://download.videohelp.com/r0lZ/BD3D2AVS/history.txt)

Download latest version: BD3D2MK3D.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z)

frank
13th July 2014, 09:31
During generating project (demuxing) the Abort button doesn't work. It should terminate tsmuxer. You only can kill the process.
It's annoying, because demuxing takes a long time.

r0lZ
13th July 2014, 10:02
OK, I'll have a look. Thanks.

mini-moose
18th July 2014, 10:53
When choosing subtitles format as .sup, I get 2d sup, 3d sup and 2d vobsubs.
Is it possible to get also 3d vobsubs with that option or maybe a 3rd option that will create both? I'd like to mux both it (I prefer .sup but I'd like to share some vids with a friend who can't use them).

An aesthetic/consistency/ocd remark regarding files tagging - on this case I got the next files:

00001.track_4501.Eng.2D.idx
00001.track_4501.Eng.2D.sup
00001.track_4501.Eng.sup (maybe that should get tagged 2D too)
00001.track_4501.Eng.3D.sup

r0lZ
18th July 2014, 14:43
I'll have a look, but I can't promise. The subs conversions is already very complicated, because I have to take into account the hardcoded subs as well (that must be 3D SUP anyway, regardless of the user's options).
If I do it, I'll implement probably the option to mux both VobSub and BD SUP. Do you have a preference for the order? I suppose I'll set the VobSub format first, for compatibility reasons. That means also that the VobSub stream will have the "Default" flag (when applicable).

In the meantime, I suggest to leave the SUP option ticked, and to convert manually to SUB/IDX. You can then modify the _MUX_3D_OPTIONS.txt file to add the VobSub streams. (Just copy the VobSub definition, and modify the file name and the title. Also, take in mind that only a single subtitle stream can have the "Default" flag set.

00001.track_4501.Eng.sup (maybe that should get tagged 2D too)
The 00001.track_4501.Eng.sup file is the original stream, extracted from the BD. It is not tagged with "2D" because the 2D or 3D tag is added only when a conversion to 3D or to VobSub is made.

mini-moose
18th July 2014, 15:10
The subs conversions is already very complicated, because I have to take into account the hardcoded subs as well (that must be 3D SUP anyway, regardless of the user's options).
If I do it, I'll implement probably the option to mux both VobSub and BD SUP. Do you have a preference for the order?

Thanks for considering my request.
I really just want to have a 3d vobsub and 3d Sup created the same time. I remembered you said choosing sup generates vobsub too, and I thought it meant 3d, and choosing vobsub only creates a regular 2D sup (maybe it does 3D too in current version? I didn't try).
Maybe a third option is not something of much demand to worthy adding such an option.
I don't have a preference as to which would be first. Personally I use sup so for me that would be better to be first, someone else might prefer vobsub first, so there's really no way to way to make it one size fits all...unless you add a 4th option ! ;)

The 00001.track_4501.Eng.sup file is the original stream, extracted from the BD. It is not tagged with "2D" because the 2D or 3D tag is added only when a conversion to 3D or to VobSub is made.

Ah, that makes sense. Thanks for clarifying.

frank
19th July 2014, 19:02
3D subtitle processing is excellent! AFAIK BD3D2MK3D is the only tool that 3D subs correctly handles. And very flexible. :)

In some cases (sources max 100 min, not too big for high bitrate) I prefer encoding in the MVC 3D format because of more 2D compatibility with traditional players such as VLC or Android. The source analysis and scripts generated by BD3D2MK3D are also very useful to pipe to FRIM or ROVI TotalCode.
Therefore I have to hardcode subs. To do that we need the full 3D subs separately for the left and right view. BD3D2MK3D only can produce half SBS. Full SBS doesn't work at all.
Can you implement an option to the tools menu generating the separated FHD (1920x1080) subs?

Or is there an easy manual modification of the tools to generate the the streams for SupTitle() input?

r0lZ
19th July 2014, 19:23
You want two independent subtitle streams, with the left and right subtitles with no resize? That should be possible, but I need some time. And no it will not be easy to modify the code to do it yourself. The conversion to 2D is made by the program itself, except the extraction of the 3D planes, made with an external exe (by Nico), but it doesn't need to be modified.

Also, I will implement it as a new tool, or an option in the current tool to convrt the subtitles to 3D. I will not integrate that in the main process, since it produces half-SBS or half-T&B anyway.

frank
21st July 2014, 15:48
I see, it's not so easy.
tsMuxeR cannot handle 3D planes if you rebuild a MVC blu-ray with reendcoded streams. The information remains in the orginal MVC stream. Therfore hardcoding subs is the best way out.

For MVC 3D we only need full-sized subtitle streams. They can be easy integrated with Avisynth script. I need to use Avisynth to slightly resize pictures, because I have a 3D (line) polarized Monitor. The more image height the better the picture.(recommended 2.35 ->2.07...)

r0lZ
22nd July 2014, 09:41
During generating project (demuxing) the Abort button doesn't work. It should terminate tsmuxer. You only can kill the process.
It's annoying, because demuxing takes a long time.
Sorry, but I can't reproduce the problem. For me, the Abort button works as expected.

(Note that it is enabled only during the long demux process. When the demuxing is finisged and the subtitle files are converted to 3D or when the audio strerams are converted to AC3, it is not possible to abort. Anyway IMO, if you have waited during the whole demux process, it's not to abort when the job is almost done.)

Could it be that your antivirus or something in your system prevents BD3D2MK3D to kill the tsMuxeR process? (I have to kill it abruptly because afaik there is no way to tell it to abort gracefully. Some antivirus may block the possibility to kill a process from another process running at the user level, because they consider that as potentially undesirable.)

Anyway, before the process gets killed, you should see this dialogue:

Are you sure you want to abort the current process?

(The avisynth file and batch commands will not be created!)
---------------------------
Yes No

Do you see it?

Someone else has that problem?

[EDIT] Got it! I understand why it doesn't work. To use the kill command, I need a package (called Tclx), and that package is installed by default with the Tcl/Tk programming environment, but is not included with the standalone executable files such as BD3D2MK3D.exe. When I run the exe on my system, it finds the package in my Tcl/Tk installation directory, and everything works fine. But it cannot find it on machine where Tcl/Tk is not installed. As a consequence, when you click the Abort button, the dialog quoted above is not displayed, and you can only hear a bell.

I will include the Tclx package in the Toolset directory and everything will work fine.

Thanks again for the bug report!

r0lZ
22nd July 2014, 19:26
This version should do everything requested in this thread so far.

# v0.41 (July 21, 2014)
# - Tools -> Convert Subtitles to 3D (with 3D-plane) can now generate two full-size subtitle streams.
# - It is now possible to include the subtitles in both VobSub (IDX/SUB) and BD SUP formats.
# - Fix: The Abort button during the demux process did not work.

Download: BD3D2MK3D.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z)

r0lZ
23rd July 2014, 07:42
Sorry, I have introduced a bug in v0.41: The conversion of the subtitles to 3D Half-T&B (with 3D planes), from the Tools menu or the normal conversion of a Title, was broken. The subtitles were converted to Half-SBS. Please download the new version (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z).

Thanks to Frank for having reported that bug by PM!

# v0.42 (July 23, 2014)
# - Bug introduced in v0.41: The subtitles that should be converted to Half-T&B were converted to Half-SBS. Thanks Frank!

frank
23rd July 2014, 14:18
Many thanks again. Works perfectly.
You learn something new every day... :D

frank
7th August 2014, 14:29
BD3D2MK3D uses tsMuxeR v2.6.9. (2013)
Latest version is 2.6.12.
Is there any reason to use the older version?

EDIT: Ok, I read the PM, there is a subtitle timcode bug. Is it with SubTitle() too?

r0lZ
7th August 2014, 15:54
Well, I had the intention to describe that bug with all details in the tsMuxeR 3D thread, but in short, v2.6.11 and v2.6.12 have totally wrong subtitle time codes when demuxing some BDs (2D and 3D). The bug happens only (but not always) when there are several parts (M2TS/SSIF files) in the MPLS, and only for the subtitles starting after the end of the first part. With the affected BDs, the time codes of the subsequent subtitles have one hour too much. For example, a subtitle that must appear at 0:10:10.000 has a time code of 1:10:10.000. The versions up to 2.6.9 are not affected by that bug, but the time codes are often slightly wrong (compared to the time codes reported by eac3to). For the example above, the time code could be, for instance, 0:10:10.400. The milliseconds part of the time codes is correct in the two latest versions, but it seems that Roman has introduced a new big bug when he has fixed the ms bug. It is a pity that he doesn't work on tsMuxeR any more. :-(

That bug has been discovered by Nico8583 (http://forum.doom9.org/member.php?u=178136), and he has tested with several 2D and 3D BDs, with similar results. However, many multi-parts BDs (like the Disney BDs) are not affected. I have tested myself with Dragon Gate 3D, and indeed the two latests versions are unusable. Since I can't use eac3to to demux the BD (due to other problems with the subtitles of 3D BDs), and v2.6.11 and v2.6.12 are unusable, I have decided to stick with v2.6.9. AFAIK, the latest versions are not better for the demuxing process. However, if you use tsMuxeR to mux to TS or M2TS, it might be a good idea to use the last version.

BTW, I don't have v2.6.10, and therefore I haven't tested it. Someone has that version?

Is it with SubTitle() too?
Yes, since the demuxed SUP stream is wrong.

frank
7th August 2014, 20:00
Ok, thanks.

The Haali start messages says: This message is shown only once. Wrong, it will display at every program start.

But when does BD3D2MK3D using it? AFAIK directshow is not used.
- Demuxing with tsMuxeR or eac3to - No
After demuxing it works with elementay streams.
- Streaming, piping - No
- MVC decoder DGMVCsource() - No
- Encoding with x264 - No
- Muxing with MKVtoolnix - No.
??

So in every case I can see the progress percentage.
I personally use Haali for years no longer. LAV splitter is the better one (and shark007's DS filter set).
BD3DTOMK3D works on my system (Windows 7 x64) without any splitter very well.

r0lZ
7th August 2014, 22:20
You're right. Haali is not needed any more. I don't know why I haven't removed it. It was used previously in a function that retrieves the number of frames from a specific M2TS. To compute the number of frames, the function created a little avisynth script with DirectShowSource("file.m2ts"). Without the filter, DirectShowSource was unable to return the number of frames. That function was still present in my code, but not used any more. I have just removed it, as well as all references to Haali, and the warning message when it is not installed.
And indeed there was a bug in the warning, that was displayed at every start. Since I have removed that code, I have removed the bug too! ;-)
Thanks!

r0lZ
9th August 2014, 09:51
The main change is the possibility to encode in Full-SBS or Full-T&B. Please note that it is not possible to convert the subtitles to 3D for these Full stereoscopic formats. However, it is possible to hardcode the subtitles in 3D over the video (with the real 3D depth extracted from the 3D-Planes).

# v0.43 (August 9, 2014)
# - Added the possibility to encode in Full-SBS or Full-T&B (without 3D subtitle streams).
# - Tools -> Chapters file converter: Added an option to save a QPFILE for x264 as well.
# - Added a warning to not use tsMuxeR 3D v2.6.11 or v2.6.12 due to the big subtitle timecodes bug.
# - Added more meaningful info in the labels of the streams for MkvMerge.
# - Removed all references to the Haali media splitter DirectShow filter, not needed any more.
# - Added the --disable-track-statistics-tags in the MkvMerge option files because the statistics are wrong and useless.
# - Updated MkvMerge and MkvMerge GUI to the latest version (v7.1.0)

Download: BD3D2MK3D.7z (http://download.videohelp.com/r0lZ/BD3D2AVS/BD3D2MK3D.7z)

Gradius
15th August 2014, 01:33
I'm getting this error:
child process exited abnormally
child process exited abnormally
while executing
"close $fh"
(procedure "Extract3DPlanesMain" line 59)
invoked from within
"Extract3DPlanesMain "[file rootname $mpls].track_4114.mvc" ."
(procedure "GenerateAvs" line 664)
invoked from within
"GenerateAvs"
invoked from within
".nbf5.gf.gen invoke "
invoked from within
".nbf5.gf.gen instate {pressed !disabled} { .nbf5.gf.gen state !pressed; .nbf5.gf.gen invoke } "
(command bound to event)

r0lZ
15th August 2014, 09:46
Hum, strange. I can't see any bug in my code in that section.
What is the 3DBD you are trying to convert? And have you selected at least a subtitle stream to mux or to hardcode?

frank
16th August 2014, 09:08
The error message comes from Extract 3D-planes from MVC.
If the MVC is not original, tsMuxer3D showes zerro planes, and there are subs muxed in. Starting Extract 3D-planes will break and show this error message.

I think the issue comes when you want to extract 3d-planes and there is nothing in the MVC stream.
BD3D2MK3D should handle it.

r0lZ
16th August 2014, 09:38
Yes, that was also my conclusion. BD3D2MK3D uses MVCPlanes.exe (by Nico) to extract the 3D-planes from the MVC, and it checks if it returns a non-zero return code when it is launched, but apparently it fails if the exe writes something to stderr. I should have fixed the problem, but I can't easily verify if everything works as expected after the extraction of the planes. Anyway, I will release a new version soon...

frank
19th August 2014, 15:20
I wrote some special characters (german umlauts ä, ö, ü) in the movie title. Then MBD3D2MK3D built the Avisynth script _ENCODE_3D_MOVIE.avs as UTF-8 and not as ANSI file. This has the result that the encoding process terminates immediately, the UTF-8 script is not readable.

That should be handled, movie title ist only used for file name and for tags in the muxing stage.

edit

r0lZ
19th August 2014, 16:26
Hum, I'm not sure the problem comes from the UTF-8 encoding. BD3D2MK3D saves the AVS script in UTF-8 anyway, regardless of the presence of accented characters, and it has always worked.
Anyway, I will do some tests. Can you give me the exact title you have used?

r0lZ
19th August 2014, 22:15
Just finished my test. I have used this title: "test accentué ä ë ï ö ü", and I've put the same string in the Comment field to test the tags.xml file too. Everything went fine. No crash, the directory and file names are correct, as well as the global title (inside the MKV) and the Comment tag.

I think something else has caused the crash. But what? Have you tried again with the same German characters?

IanD
20th August 2014, 08:50
How easy would it be to modify BD3D2MK3D to output a line interlaced field version instead of OU?

I think maybe LG passive TVs are futzing with conversion of OU frames to its native interlaced presentation and softening the image in the process, so I was hoping to be able to create 2D frames containing top left field and bottom right field (or vice versa) of the 3D source, interlaced together so that they could be presented on the TV as-is in 2D mode but get the 3D effect by wearing the glasses. This would mean the least processing of the original source (ie scaling) and hopefully a sharper picture as it would be mapping the fields directly to their corresponding polarising strips without interference.

I do not know the polarizer strip orientations, so it would require options to select whether left or right was top field.

r0lZ
20th August 2014, 09:02
Hum, that should be possible, but I have to be sure that it works before beginning to implement that option. And since I don't have a passive LG, I can't test myself. I'll try to see what modification of the files generated by BD3D2MK3D are necessary, and I'll let you know. Will you be OK to test them yourself?

Sharc
20th August 2014, 09:45
How easy would it be to modify BD3D2MK3D to output a line interlaced field version instead of OU?

I think maybe LG passive TVs are futzing with conversion of OU frames to its native interlaced presentation and softening the image in the process, so I was hoping to be able to create 2D frames containing top left field and bottom right field (or vice versa) of the 3D source, interlaced together so that they could be presented on the TV as-is in 2D mode but get the 3D effect by wearing the glasses. This would mean the least processing of the original source (ie scaling) and hopefully a sharper picture as it would be mapping the fields directly to their corresponding polarising strips without interference.

I do not know the polarizer strip orientations, so it would require options to select whether left or right was top field.
You may want to run some preliminary tests with Stereoscopic Player (http://www.3dtv.at/Downloads/Index_en.aspx)which can output 3D footage as interlaced. Perhaps there is a trial period, I don't know.
Alternatively you could try the free Bino (http://bino3d.org/) which has similar options.
I don't know however how the output is presented at the HDMI (PC) interface to the TV.

r0lZ
20th August 2014, 10:21
@Shark: My PC doesn't have a 3D graphic card, so I suppose that options cannot be used. But thanks anyway.

@IanD:
I have modified the files of a short clip and I think I have something that should work. Can you test the modifications?
Use a short clip to begin (and, optionally, select the UltraFast x264 preset). Use T&B or SBS, that doesn't matter.
When the demux phase is finished, edit the following files.

_ENCODE_3D_MOVIE.avs:
You should replace the following lines:

left = SelectEven(interleaved)
right = SelectOdd(interleaved)

# Build combined Side-by-Side image
StackVertical(...) (or StackHorizontal)

with this:

left = SelectEven(interleaved).SeparateFields().SelectOdd()
right = SelectOdd(interleaved).SeparateFields().SelectEven()

# Build combined Row-interlaced image
Interleave(left, right).Weave()

The code above is for the left view in the top field. To place the right view in the top field, use this:

left = SelectEven(interleaved).SeparateFields().SelectEven()
right = SelectOdd(interleaved).SeparateFields().SelectOdd()

# Build combined Row-interlaced image
Interleave(right, left).Weave()

That should work, but I'm not sure. If you see inverted fields, experiment with the words in red above.

You should also modify _ENCODE.CMD and replace the option "--frame-packing 4" (or 3 for SBS) with "--frame-packing 2".

You should also edit the "3D Video stream" section of the _MUX_3D_OPTIONS.txt file, like this:

# 3D video stream

--track-name
0:3D Row interlaced (x264 CRF 22, preset ultrafast, level 4.1)
--stereo-mode
0:7
--aspect-ratio
0:16/9
--default-duration
0:24000/1001p
--default-track
0:yes
01000_mpls.264

The stereo mode 7 is for the left field on top. Use 6 for the right field on top.

When the edits are finished, encode normally, and watch the movie on your TV. Perhaps you'll see some flickering effects (especially with thin horizontal lines, or in the end credits). Please let me know if it's the case. It is perhaps possible to improve the image quality and avoid the flickering with a resize instead of the SeparateFields().SelectOdd/Even() code.

Let me know if it works fine. If your tests are conclusive, I may add that option in the next version...

Sharc
20th August 2014, 10:51
@Shark: My PC doesn't have a 3D graphic card, so I suppose that options cannot be used.
.....

Hmmm..., I thought that a 3D card is not even needed as the format is "2D interlaced" with field1 = left view and field 2 = right view. But as I mentioned I don't know how the TV is going to deal with it.
But anyway, you have already proposed a modified script for trying.

r0lZ
20th August 2014, 13:33
You need a graphic card that can synchronize the active glasses, or (but I don't know if that exists) a passive 3D monitor with polarized filters on the scanlines of each field. I don't have that. But it is perhaps possible to use a program that can convert the row interlaced stereoscopic movie to anaglyph. It's perhaps sufficient to verify that the fields are in the correct order. But I don't want to install a program that I don't need just for that, and anyway I will not be sure of the result. After all, IanD has requested that new feature; he can do some tests for me. ;-)

IanD
20th August 2014, 14:41
@IanD:
I have modified the files of a short clip and I think I have something that should work. Can you test the modifications?
Use a short clip to begin (and, optionally, select the UltraFast x264 preset). Use T&B or SBS, that doesn't matter.
When the demux phase is finished, edit the following files.

I was going to attempt to do it myself with Avisynth as the process is quite straightforward, however I would need to manually perform the decode process and then the encode process, so I was hoping your program could do it automatically with a few minor modifications. I see that it may be possible to do it through your program.

Unfortunately I don't have a passive 3D TV, but a relative does, however I don't see them very often.

I was mainly looking for a way to create a simple test file that I could use in the future.

I understand what you are saying about the possibility of flickering, but the whole reason for generating an interlaced frame without scaling was to improve sharpness. The T&B I have seen look quite soft compared to SBS, even as 2D presentations, so I think the scaling in the encodes is introducing softness, let alone what the LG is doing to it. I acknowledge the penalty for a sharper image might be inter-line twitter: then again, perhaps the brain can use the right eye view to fill in the gap.

Your interlaced process seems reasonable and I will test it out when I can, but it will probably not be for a while. Thanks for coming up with a solution so quickly.

Maybe someone will have improved the stability and speed of MVC decoding by then.

IanD
20th August 2014, 14:50
You may want to run some preliminary tests with Stereoscopic Player (http://www.3dtv.at/Downloads/Index_en.aspx)which can output 3D footage as interlaced. Perhaps there is a trial period, I don't know.
Alternatively you could try the free Bino (http://bino3d.org/) which has similar options.
I don't know however how the output is presented at the HDMI (PC) interface to the TV.

That's a definite option as it supports ssif directly and appears to output row interlaced, so no transcoding to mkv first.

However it will be more difficult to test without a passive 3D TV to hand, but thanks for the option.

r0lZ
20th August 2014, 15:02
If I understand correctly, you want to encode in the interlaced format without knowing if it works with your future TV? I can't modify BD3D2MK3D without knowing for sure if the modification will be useful, for you and others.

frank
20th August 2014, 17:47
I'm an experienced user of polarized 3D. There is absolutly no need for interlaced frame storage! Storage and output are different things.
The HDMI 1.4a spec includes 3D HSBS and HTAB standard, left eye on top.
Modern polarized monitors and LG TVs use circular polarization. You can keep your head diagonally - no ghosts!

I have a very good 23" polarized 3D Monitor - AOC d2367Ph. It has two HDMI 1.4a inputs.
I'm using softwareplayers on notebook. (ISOs, BD folders, no Cinavia crap...)

PowerDVD 3D 10 or newer recognizes the stereo tabs from mkv file and puts the decoded 3D stream (HSBS, HTAB) automatically to HDMI 1.4a without any problems. :)
Stereoscopic Player can make a line interlaced output from HTAB. The picture is sharper than from PowerDVD but PowerDVD has better (certified) sound decoders.

r0lZ
20th August 2014, 18:04
I agree that storage and output are different things, but if you can store the data exactly the same way than the output will use them, I guess you can have a better quality, because there will be a 1:1 relationship between the medium and the hardware, without any adaptation procedure needed. I don't know if that will make any visible difference, but for the principle, I think that as long as we use a Half-3D packing method, it is better to store the right half at the right position. Or have I missed something?

frank
20th August 2014, 19:11
If you store the 3D content in another way - then other standard devices cannot play it. (TVs, BD players, Android...).
The 3D content must signal the format to the interface - but HDMI 1.4a is the only 3D standard interface. And HDMI 1.4a doesn't know any interlaced 3D frames, only Frame Packing (movie, games) and SBS/TAB (broadcast).
We don't need new mismatches. Wat is going on if you send such interlaced 3D frames to a 2D device?

Half-Packing was a demand from broadcast because of technical reasons (bandwidth, studio and transmitter devices...)
Hardware decoders work fast and properly, but only for standard content as Frame Packing/SBS/TAB. You don't have to store interlaced 3D frames. In addition interlaced encoding needs more bits, as we know from mpeg (jumping mov vectors.)
The HDMI standard doesn't allow interlaced frame storage. 1080i50 are 50 fields 1920x540 per second, field sequential. If you encode a 3D movie in that way then the player does not signal 3D content! 1080i50 means interlaced footage, standard compliant. NTSC 1080i29 has to apply Pull Down to get the frame rate because movies have 23.976...

Example of non-standard:
Most guys cut off black bars but they have never understood how AVC compression works. Black bars have zero information, not much code needed. But hardware decoders fail at resizing such cuts... Only PCs can play it.

r0lZ
20th August 2014, 19:41
I fully agree with (almost) everything. However, the checkerboard, column interlaced and row interlaced 3D packing methods exist (or have existed). They are perhaps (or probably) obsolete now, but they are still supported. Also, I guess IanD wants to play his movies from a HDD directly connected to the TV, without passing through HDMI, but I'm not sure. (I don't know any TV able to play row interlaced material directly.)

Anyway, I think you're globally right. I will probably not implement the row interlaced packing method, unless someone can prove that it's useful. I have posted the modification to do to the scripts above, and if IanD really wants to encode in row-interlaced, he is free to modify the files manally.

And BTW, thanks for your remark about the black bars. It's exactly for that reasons that I have always refused to add a crop feature to BD3D2MK3D.

frank
20th August 2014, 20:35
Sorry I've made a mistake: ANSI not ASCII

BD3D2MK3D saves the AVS script in UTF-8 anyway, regardless of the presence of accented characters
Sorry, no, it stores normally as ANSI in Windows. Tested with your last beta.
If I open the avs and then select file store as... then the opening windows shows
Codierung: ANSI - code: ANSI
not UTF-8 in the botom line.
The error comes if it is UTF-8 code because Avisynth needs ANSI.

I will repeat the test with special characters.
(The movie was How to Train Your Dragon but I wrote Drachenzähmen)

r0lZ
20th August 2014, 23:52
From my code:
SaveFile "_ENCODE_3D_MOVIE.avs" $avs utf-8 auto
And, when I open the file in PSPad, it is (correctly) identified as using code page UTF-8. Nothing is saved in ANSI in BD3D2MK3D, because MS ANSI is a nightmare.

I've just relaunched the encode of my little test clip, after having forced UTF-8 again with PSPad, and re-saved the AVS script, and Avisynth has accepted it without problem.

(The only little problem I'm aware of is related to the output of MkvMerge in the command prompt window. At the end of the muxing process, it displays the name of the output file, and if it contains foreign characters, they are replaced by strange symbols. Like in this example: "The file 'test accentué ä ë ï ö ü 3D-SBS 1080p (Rol).mkv' has been opened for writing." But the file is written to disc with the correct file name. Obviously, it's a bug of mkvmerge.exe, that outputs UTF-8 characters to the Windows console, that supports only OEM code pages. But it's only a cosmetic problem, since everything is OK.)

Are you sure you use a correct version of Avisynth? I use v2.58, build Dec 22 2008 [08:46:51].

IanD
21st August 2014, 07:59
I have posted the modification to do to the scripts above, and if IanD really wants to encode in row-interlaced, he is free to modify the files manally.

That is the solution I was aiming at: a way to modify BD3D2MKV (or any other similar software) to make it easier to create Half Row Interlaced 3D for my own particular uses, instead of using a whole sequence of independent manual steps. I was not expecting the software to necessarily be changed within itself for everyone: this was just to make my job easier if possible.

The reason for doing this is to test whether it is possible to create a sharper image on a relative's LG passive 3D display than using the usual Half T&B approach, because that does look soft compared to Half SBS, even though theoretically it should not.

This is only a test to see whether a better visual result can be achieved with Half 3D encodes than with the standard methods. I appreciate it then becomes a non-standard method, but if Half 3D mkv is being created anyway, it doesn't matter if the encode method is different.

I have been targeting Half 3D mkv encodes as that is likely to be the format of choice for the relative, especially since the passive 3D can not display full 3D Bluray resolution anyway. I think I have already mentioned that compressibility will be reduced using the row interlaced approach. I acknowledge that the non-standard nature of row interlaced means that it will only work with passive TVs in 2D mode but with 3D glasses, so no adjustment of 3D effect is possible, but I'm willing to accept that if it produces a sharper picture without major artifacts. I also appreciate that this will not be an interlaced format but a standard 2D frame mkv, however the left and right eye views will effectively be fields of their original progressive frames. I apologise if I have confused the issue by mentioning interlaced.

At the end of the day, this will just be a test whether a row interlaced approach can produce a sharper image on a passive display compared to the usual Half T&B approach that is currently being used.

I thank forum members for their interesting suggestions so far and I will test them out when I get an opportunity.

r0lZ
21st August 2014, 08:16
OK, it's clear. Please post the results of your tests here. Thanks in advance.

BTW, for the interlaced thing, it you use the modification of the script I have suggested above, you will probably end up with interlaced frames, because Avisynth will consider the output video as interlaced due to the Weave() command. To avoid that and produce true progressive frames, you may need to add AssumeFrameBased() right after the Weave() command.

frank
21st August 2014, 08:53
Strange. I have tested again - same issue.

1. Standard characters in title -> everything ANSI!! Tested with Editor.
_ENCODE.cmd
_ENCODE_3D_MOVIE
_MUX_3D_OPTIONS.txt
chaptes_3D.qpfile
chapters_3D_delay.ogm

2. With ß in title
UTF-8:
_ENCODE.cmd
_ENCODE_3D_MOVIE
MUX_3D_OPTIONS.txt

But ANSI:
chapters_3D.qpfile, chapters_3D_delay.ogm

Encoding started without error in every case. Maybe the error messages last week came from my editions in scripts or absolute pathes with special characters.

BD3D2MK3D is extracted to the user folder.
Stable Avisynth v2.60 from 13/09/18 has never made problems.

I have a suspicion the cause is the localized Windows version.
I used german Win 7 Ultimate x64 on my Dell XPS.
On another NB is german Win 7 Home Premium x64 - but same issues.
Very strange...

The chapter files must be coded in UTF-8. I changed it manually to UTF-8 to insert german chapter names.

frank
21st August 2014, 09:44
@IanD
The reason for doing this is to test whether it is possible to create a sharper image on a relative's LG passive 3D display than using the usual Half T&B approach, because that does look soft compared to Half SBS, even though theoretically it should not.
HTAB is not the cause. You didn't say what player you used.
If it was PowerDVD than you are right, the picture is softer. They stream their HDCP mess trough the whole system, and it needs some time until decoders are selected and the picture is displayed. Furthermore it seams the Half-TAB picture is resized to full size and THEN every second line is selected!
Maybe other players are not better.

Test Stereoscopic Player with HTAB. It is able to output line interlaced 3D from HTAB content to HDMI. You have to setup the player manually. You'll get pictures with full sharpness! I cannot distinguish it from full 3D Frame Packed BD content on my passive display. Every coded screen line is properly displayed. I hope your LG TV operates with the same HDMI 1.4a procedures.
The only thing: Stereoscopic Player uses about 95 % open source (ffmpeg, dshow, MPC-HC...) - and they want money!

Sharc
21st August 2014, 10:07
@IanD

Test Stereoscopic Player with HTAB. It is able to output line interlaced 3D from HTAB content to HDMI. You have to setup the player manually. You'll get pictures with full sharpness! I cannot distinguish it from full 3D Frame Packed BD content on my passive display. Every coded screen line is properly displayed. I hope your LG TV operates with the same HDMI 1.4a procedures.
The only thing: Stereoscopic Player uses about 95 % open source (ffmpeg, dshow, MPC-HC...) - and they want money!
Out of curiousity: Has anyone tried the free Bino? Does it provide the same output to HDMI as the Stereoscopic Player?
Sterescopic Player uses Open Source plus the licensed 3D decoder from CoreAVC AFAIK. At least it decodes Pacific Rim correctly ;-)

r0lZ
21st August 2014, 10:38
1. Standard characters in title -> everything ANSI!! Tested with Editor.
As you know, I save all files explicitly in UTF-8. I'm not a specialist in character encoding, but I think UTS-8 uses standard (ANSI?) 8-bit encoding when it's possible. It encodes only the foreign characters with 16 bits (in 2 bytes). (It's the difference with UTF-16, that encodes all characters in 16-bit.) Perhaps your editor tells you that the files saved by BD3D2MK3D use ANSI encoding instead of UTF-8 when there are no foreign characters, because it doesn't find characters encoded in 16-bit.

Anyway, I'm (almost) totally sure that the problem doesn't come from the character encoding. My native language is French, and I have often used accented characters in the movie titles of my encodings, and I have never had any problem.

Of course, let me know if you can reproduce the crash...

frank
21st August 2014, 16:48
Perhaps your editor tells you that the files saved by BD3D2MK3D use ANSI encoding instead of UTF-8 when there are no foreign characters, because it doesn't find characters encoded in 16-bit.Maybe, damned Windows :angry:
Until now no errors but I don't use foreign characters in the movie path anymore for my tests.

One problem remains: chapter files.
I wrote the word König (king) as a name in chapters_3D-delay.ogm.
After remuxing with _MUX_3D.cmd it shows only "K".
I forced to save the chapters_3D-delay.ogm as UTF-8 with Editor - then after remuxing the name König was right inserted. :rolleyes:
I have no clue what Windows does. Something is different in the file header what brings the Windows Editor messed up.

r0lZ
21st August 2014, 17:11
What editor do you use? Notepad? (Notepad can save in UTF-8, but I think that there is no way to force it to do so.)

For the Chapters file, I must admit that there might be a problem in _MUX_3D_OPTIONS.txt:

--chapter-language
und
--chapter-charset
ASCII
--chapters
chapters_3D_delay.ogm

As you can see, the language is undefined. (If you define chapter names in German, you should modify the value here, but I don't know if it matters. Perhaps there is the possibility to include several chapter files in different languages, and if it's the case, the player should select the one in your language.)

But, more important, the character encoding is defined by default as ASCII (because ASCII is enough for the numbers and the colon I use in the default chapter names). Of course, if your file is encoded in UTF-8, the player will probably stop as soon as it encounters a special character. I will change the charset argument to UTF-8, since the chapter files saved by BD3D2MK3D is compatible with the UTF-8 encoding. It will be possible to edit the Chapter file without having to modify the _MUX_3D_OPTIONS.txt. Of course, you will have to be sure to save in UTF-8 and not ANSI when there is at least a special character in the file.

I will do a test right now, and if it works, I'll do it in the next version...

[EDIT] OK, test done. I have edited the Chapters file, and for the first time, I saw ANSI as the character encoding in PSPad. However, I have verified my code, and it saves the file in UTF-8 format. That confirms that a file saved in UTF-8 but that does NOT contain special characters is equivalent to ANSI.
For that reason, PSPad has saved my edits in ANSI, and indeed the chapter names were truncated at the first special character encountered. Then I have changed the charset in the mux file to UTF-8 (but without changing the chapter file), and the special characters have been displayed by MPC-HC as Chinese characters (I think.) Normal. ANSI with special chars is not UTF-8. So, I have reloaded the chapter file in PSPad and this time I have forced UTF-8. Now, the chapter names appears as they should in MPC-HC. :-)

I did again a test without special characters in the chapters file but with UTF-8 in the mux file, and everything went fine.

So, I have decided to change the ASCII string in the mux file to UTF-8. That works fine, and I prefer UTF-8, a good and well established standard, over ANSI, that exists in several variants (including "Windows ANSI"). But that means that you MUST use an editor that can force UTF-8 when saving the chapter file. If your editor cannot do that, use PSPad (http://www.pspad.com/) (free).

frank
22nd August 2014, 10:06
Ok :)
I use Windows Editor for such simple work. As I said if you load a file and then use "Save as..." the bottom line shows the format. If it recognizes the source file header as UTF-8 then it saves UTF-8 otherwise you can force it to UTF-8 by selecting the UTF-8 format.