As for your answer to my question, there's some things I don't understand:
But I am curious how in a 3D-plane the different subtitle offsets are "assigned" to the target SUP images. Where I can only make an educated guess that it is done by lead of timings-information.
+ Reply to Thread
Results 451 to 464 of 464
1. The user may want to modify the PNG images, for example to change their contrast or luminosity. Of course, the PNG/XML must be the source of the new conversion, and it is easier for the user if he doesn't need to specify again the 3D-plane to use.
2. But the main reason is that it is easy to edit the depth values in the XML to fix some wrong depth values. And in that case, the 3D-plane cannot be used, or it will overwrite the depths modified by the user. Therefore, the depth values must be stored in the XML.
I agree that it is not obvious that the depths can be modified, as usually, the whole conversion is made in one step, during the preparation of the project. But the XML/PNG stream is not deleted at the end of the conversion, to let the user edit it and convert it again to the final subtitle stream, and remux the final MKV. It's a possibility for a power user, like many other features of BD3D2MK3D. BTW, it's also why there are many comments in the text files of the projects generated by BD3D2MK3D.
My explanation above takes only one 3D-plane into account, but the BD specs specifies that there can be up to 32 3D-planes, for 32 different subtitle streams (although the same 3D-plane can be assigned to several subtitle streams.) And usually, all 32 3D-planes are specified, but most of them are totally undefined, or contain always the same depth value, and are therefore useless.
So, what BD3D2MK3D does is just extract the 3D-planes from the MVC (and concatenate the different parts to obtain complete 3D-planes with as many depth values as there are frames in the whole movie), then it analyses the XML of the subtltle stream to know when each subtitle starts and ends, then it converts that timings to frame numbers, and it retrieves the depth values for that frames. The final depth is then selected among the different depth values corresponding to the subtitle (because, often, the depth of the subtitle changes during its display, for example because there is a cut in the video, possibly with an important change of depth of the whole scene). The final depth value is then written in the XML, and finally, the conversion of the XML/PNG to 3D can really begin!
In the explanation above, I have used the usual term "3D-plane" instead of the correct term "offset sequence". Similarly, "depth" is used instead of "3D offset" or "offset value". But the processing doesn't depend on the terminology!
I need a way to output the left eye and right eye separately then put them back together again. I'm hoping there is something I can modify in the encode_3D script.
What type of frame do you need ? Full-size, or halved for HSBS or HTAB ? And why do you need to save the two views alone ? How would you like to recombine them ? To do what type of 3D video ?
left = SelectEven(interleaved)
right = SelectOdd(interleaved)
left = left.mkv
right = right.mkv
I think I will have to use ffmpeg to recombine them or hopefully I can just use mkvtoolnix.
You can use the two MKV as input, that's right (although the command is not correct) but the problem is that you will need te encode the video three times: the first time to create the two MKV, the second to fix the luminosity, and the third time to join the two parts. That means a significant quality loss! It's because, unfortunately, you cannot use ffmpeg or mkvtoolnix to recombine the two views. They must be re-encoded.
IMO, the best method would be to edit the original avisynth script to add the command necessary to fix the bad eye, and then encode the full movie directly from the BD3D2MK3D project. You will need only one encoding. You should add a command like this in the script:
right = Levels (right, parameters)
(This is just an example. You may need another command, or several commands).
The difficulty with avisynth is that it is not easy to see the result. Luckilly, AvsPmod comes to the rescue. You can load the two views in two tabs, and add the command(s) necessary to fix the problem in the tab with the bad eye. Then, you can modify the parameters of the command freely, and compare the result with the good view by switching from one tab to the other one. When you have a good result, simply copy the command in the avs script in the project, and encode it normally.
Note that to load a MKV in an avisynth script, you will need to install the ffmpegsource avisynth plugin and use this command:
This will create the default stream called "last". If you need to name it differently, use this:
left = FFMpegSource2("path/to/movie.mkv")
There are probably other plugins or commands that can load a MKV, but I know and use only this one.
I agree that learning how to use avisynth is not easy and requires some time, but you will certainly get a much better result than if you re-encode the movie several times. And there is a lot of knowledgeable peoples able to help you in the avisynth dedicated forums here or at doom9.
If I have to do this again I might add extra ffmpeg commands to deal with the audio at the same time, or maybe I will remove the audio first then re-combine later. It would have been nice to be able to use the raw files created by BD3D2MK3D so that when complete it could mux them back together but I can't see any obvious way to do that. Thanks again
Last edited by cdx47; 5th Oct 2023 at 08:00.
If you know already ffmpeg, you can probably use a ffmpeg plugin to insert the ffmpeg command in the avisynth script instead of the Levels () command, like explained in my previous post. That may be easier for you.
And honestly, I don't think that ffmpeg is able to split the two views without re-encoding them, but I may be wrong. It's possible for JPEG images (with some limitations), but MPEG videos are much more complex.
If you want to redo (almost) the same processing without using ffmpeg to split the two views, you can simply edit the avs script in the folder, like this:
interleaved = FRIMSource("mvc", "00009.track_4113.264", "00009.track_4114.mvc", layout = "alt", num_frames = 18668, cache = 2, platform = "") right = SelectEven(interleaved) left = SelectOdd(interleaved) return(left) __END__ (the rest of the script is ignored)
BTW looking at the bit-rates they are definitely lower in the ffmpeg re-encoded movie even though visually it looks pretty much identical on a large screen. But I agree with you about the potential for quality loss. So it occurs to me that if I do need to do anything like this in the future I will try to use the ripped disc as the source with ffmpeg all the way. At least that way I'm starting from the original source.
Last edited by cdx47; 5th Oct 2023 at 08:26.
Edit: I created a test file using the Tweak command in the avs file for the left eye without having to separately export left and right eye files. Seems to work which means everything gets done in one go using a modified version of your script. If you don't hear from me again then it works
Last edited by cdx47; 13th Oct 2023 at 17:25.
I've learned a lot over the last few years looking at your batch and avisynth scripts as well as the json files
Last edited by cdx47; 5th Oct 2023 at 17:49.
A short thanks for your crystal clear explanations. The SEI messaging for each GOP took a lot of clouds away.
I am now reading up on the "h264Offset3D.exe" tool which indeed seems the thing right up my street.
Will keep it short as I don't intend on further pollution of this thread.