Anamorphic DVD - aspect ratio
#16
(2020-05-31, 10:45)mlaggner Wrote: sorry, but according to your examples, I cannot imagine how I should write code off it:

Post #1:
Quote:Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
we should use the display aspect ratio (this is what myron implemented)

Post #14:
Quote:Width                                    : 1 920 pixels
Height                                   : 802 pixels
Original height                          : 1 080 pixels
Display aspect ratio                     : 16:9 
we should NOT take the display ratio, BUT calculate it from original height/ width?
Quote:Width                                    : 672 pixels
Height                                   : 448 pixels
Display aspect ratio                     : 16:9
we could calculate from width/height OR take display aspect ratio?
Quote:Width                                    : 672 pixels
Original width                           : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
we should calculate with original width/height and NOT take display aspect ratio?

would be helpful if we get mediainfo XMLs for all these examples - according to these examples I cannot imagine how I should turn that into code

Use this formula:

Display aspect ratio * (Width / Height) / (Original width / Original height)

That should account for all scenarios.
#17
but all of my local tests did not have a original width/original height...
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#18
(2020-05-31, 19:16)mlaggner Wrote: but all of my local tests did not have a original width/original height...

In that case you just use width in place of original width, or height in place of original height.

Width                                    : 1 920 pixels
Height                                   : 802 pixels
Original height                          : 1 080 pixels
Display aspect ratio                     : 16:9 

16/9 * (1920/802)/(1920/1080) = 2.39
Quote:Width                                    : 672 pixels
Original width                           : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9

16/9 * (672/480)/(720/480) = 1.66
#19
I still not have any example files to continue my research..
I've looked at a dozen of different video files and never seen that original width / original height fields
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#20
(2020-07-18, 08:12)mlaggner Wrote: I still not have any example files to continue my research..
I've looked at a dozen of different video files and never seen that original width / original height fields

What specifically do you want me to provide? Some sort of export file from MediaInfo? I've shared the relevant fields but if there's something else that would help I'm happy to provide it. Note that this field exists for the MKV container and can be edited with MKVToolNix (as Video crop left/top/right/bottom); not sure if there's an equivalent for MP4 or other containers.
#21
just load some of your files into mediainfo and choose "view - XML".. paste those results to paste.kodi.tv please so I can put the exact values into my unit tests and develop the logic according to it

btw: I've tried to find a solution for a DVD image where mediainfo reports 4:3 but the content is in 16:9 but I've failed to find a logic how to detect this
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#22
(2020-07-18, 10:03)mlaggner Wrote: just load some of your files into mediainfo and choose "view - XML".. paste those results to paste.kodi.tv please so I can put the exact values into my unit tests and develop the logic according to it

btw: I've tried to find a solution for a DVD image where mediainfo reports 4:3 but the content is in 16:9 but I've failed to find a logic how to detect this

Sorry, been a bit busy lately.

Here's an example where the aspect ratio is 1.85:1 but the image is uncropped 16x9.

https://paste.kodi.tv/qalutawiye

And an example of a file with dimensions of 720x572 pixels but aspect ratio of 16x9.

https://paste.kodi.tv/waqodoqofi

Here's one with an unusual display aspect ratio flag, so the actual aspect ratio is 1.6:1:

https://paste.kodi.tv/asoviqozil

And one with both a display aspect ratio flag and a crop flag (correct aspect ratio is 1.66:1):

https://paste.kodi.tv/eqosidavic
#23
Hi,

I have a similar problem with "Aspect Ratio" detection.
I did a lot of testing and found out that in case of mkv files sourced from Blu-Ray and UHD Blu-Ray where "DisplayAspectRatio" basically always is defined as 16:9 there is only one method to identify the aspect ratio of the cropped movie (mostly 2.4:1) for undistorted and hasslefree playback.
It would be possible to change DisplayWidth/DisplayHeight in the mkv metadata which leads to the correct DisplayAspectRatio in the mkv metadata but this would result in distorted playback in some video players unless you can force the video decoder to use the aspect ratio of the stream. So this is quite a bad solution.
In my opinion it is advisable to set the crop flags in the mkv metadata. This could be done with a simple tool that detects the cropped aspect ratio and sets the crop flags in the mkv metadata accordingly.
In the next step, TinyMediaManager should calculate the Aspect Ratio according to this suggested formula:
Quote:Use this formula:

Display aspect ratio * (Width / Height) / (Original width / Original height)

That should account for all scenarios.
Width and Height from MediaInfo already take the crop flags into account wheras Original width/height refer to the uncropped dimensions. If there are no crop flags set there are also no Original width/height flags set because in this case the original uncropped dimensions are specified by Width and Height and in the above formula you just replace Original width/height with Width/Height.

Also should the calculated AR be preferred instead of the DisplayAspectRatio from MediaInfo which for Blu-Rays always would be 16:9. At least it would be great to globally select the preferred AR, calculated or MediaInfo AR.
With this method also the resulting .nfo file stays unchanged when played in Kodi or MPC for example.


This case:
Quote:btw: I've tried to find a solution for a DVD image where mediainfo reports 4:3 but the content is in 16:9 but I've failed to find a logic how to detect this
is nothing different to a 16:9 encoded Blu-Ray with eg 2.4:1 (cropped) content. you need the crop flags set accordingly in the mkv metadata to calculate the cropped content AR with above suggested formula. in this case you already know? that the cropped content's AR is 16:9 (so no need for black bar detection algo) hence you could set the crop flags in the mkv metadata directly.
#24
IIRC, we changed that already for v4.0.5

Going back to our simple self detection formula... by taking only the StorageAR (w/h) and the PixelAR into account.
When cropped flags have been set, MediaInfo correctly detects them, and we might get a more accurate AR of a mkv/BR/DVD.
Since we want to know how the movie is stored, and not how it should be displayed Wink

The use cases from the post above you should be now all working flawlessly.
(.ISO files are special and would probably not work that new "old" way)
tinyMediaManager - THE media manager of your choice :)
Wanna help translate TMM ?
Image
#25
(2020-11-30, 21:06)myron Wrote: IIRC, we changed that already for v4.0.5

Going back to our simple self detection formula... by taking only the StorageAR (w/h) and the PixelAR into account.
When cropped flags have been set, MediaInfo correctly detects them, and we might get a more accurate AR of a mkv/BR/DVD.
Since we want to know how the movie is stored, and not how it should be displayed Wink

The use cases from the post above you should be now all working flawlessly.
(.ISO files are special and would probably not work that new "old" way)

Thank you for the information. I haven't tried version 4 so far. But in this case i will test it asap. Will this functionality also find its way to version 3, especially the preferation of the calculated AR over the Mediainfo AR?
#26
Sure.
Have backported all the mediaInfo changes we did for v4 to v3.
Aspect ratio, mediainfo.xml parsing, DVD/BD/HDDVD/ISO support, and other minor changes...

Should be in nightly-v3 to test...
tinyMediaManager - THE media manager of your choice :)
Wanna help translate TMM ?
Image
#27
(2020-12-01, 22:37)myron Wrote: Sure.
Have backported all the mediaInfo changes we did for v4 to v3.
Aspect ratio, mediainfo.xml parsing, DVD/BD/HDDVD/ISO support, and other minor changes...

Should be in nightly-v3 to test...

Perfect, thank you. I see it in the v3 branch on gitlab now. In the meantime i compiled a custom version with the functionality myself but i'm looking forward to the 3.1.12 update.
#28
In connection with the now working calculation of the content's aspect ratio I found a small bug with the AR icons not being displayed for all common ARs. In tmm v3 there is a problem in "MediaInformationLogosPanel.java" with URL generation for icon files of ARs with trailing zeros in the file name. (e.g. 2.40)

It is working by changing line 139 from

String ratio = String.valueOf(aspectRatio);

to

String ratio = String.format((Locale) null, "%.2f", aspectRatio);



Maybe you could have a look at this for the upcoming version 3.1.12

Logout Mark Read Team Forum Stats Members Help
Anamorphic DVD - aspect ratio0