Jump to content
enzeder

Aspect Ratio - Using Original Aspect not File Aspect

Recommended Posts

enzeder

Originally posted in Kodi add-on but suggested I log it in server forum.


 


At the moment the EMBY add-in uses the aspect ratio of the video file, so in almost all cases it shows up as 1.78x in KODI.


It would be useful to default or have the option to show the aspect ratio of the original movie, which I would find much more useful - eg 2.35:1 etc


I use metabrowser to collect some of the metadata and this collects the right (original) aspect ratio (from IMDB), and saves it near the top of the NFO at the root level


 


<movie>

  <plot>A DEA agent and an undercover Naval Intelligence officer who have been tasked with investigating one another find they have been set up by the mob -- the very organization the two men believe they have been stealing money from.</plot>

  <outline>Two hardened criminals get into trouble with the US border patrol after meeting with a Mexican drug lord, and then revelations starts to unfold.</outline>

  <lockdata>false</lockdata>

  <type>MKV</type>

  <dateadded>2013-12-18 06:42:03</dateadded>

  <title>2 Guns</title>

  <originaltitle>2 Guns</originaltitle>

  <director>Baltasar Kormákur</director>

  <trailer>plugin://plugin.video.youtube/?action=play_video&videoid=qnWIR2jFklo</trailer>

  <trailer>plugin://plugin.video.youtube/?action=play_video&videoid=v2ba2EXqk9w</trailer>

  <rating>6.8</rating>

  <year>2013</year>

  <sorttitle>2 Guns</sorttitle>

  <mpaa>R</mpaa>

  <mpaadescription>Rated R for violence throughout, language and brief nudity</mpaadescription>

  <aspectratio>2.35:1</aspectratio>

 


However when EMBY refreshes the NFO file a lot of the times it wipes this aspect ratio information (not always, last time it wiped about half of them after I had refecthed them all using metabrowser) and writes an aspect ratio in the Video segment / section of the NFO file - which is correct in that it provides the aspect of the file but as noted above I'd prefer the original aspect ratio to be reported in the Kodi.


 


     <video>

        <codec>h264</codec>

        <micodec>h264</micodec>

        <bitrate>30522229</bitrate>

        <width>1920</width>

        <height>1080</height>

        <aspect>16:9</aspect>

        <aspectratio>16:9</aspectratio>

        <framerate>23.97602</framerate>

        <language>eng</language>

        <scantype>progressive</scantype>

        <default>True</default>

        <forced>False</forced>

        <duration>109</duration>

        <durationinseconds>6560</durationinseconds>

      </video>

 


So it would be nice to have an option to ensure that when passing data to Kodi that it gives the user the choice as to which aspect ratio to use, and does not wipe the original aspect ratio. 


  • Like 2

Share this post


Link to post
Share on other sites
jordy

Isn't it more relevant (and correct) to show what the actual aspect ratio of your file is, rather than that of the original movie?

Share this post


Link to post
Share on other sites
enzeder

In my case I prefer to report the original aspect ratio. Every film in my library is being reported as 16:9 because all the files are produced in 16:9 format.

 

However I find it more useful to know whether with a 16:9 file format whether it is 1.78:1 (ie full screen), 2.35:1 (will have black bars above and below) etc

 

The 2 guns example above is an example of this

 

Of course others may have different views in which case a user option would be really good.

Share this post


Link to post
Share on other sites
jordy

OK fair enough. I see your point.

Share this post


Link to post
Share on other sites
plazma

Problem you have is not all films are just one aspect ratio, imax releases, theatrical, directors etc may be different ratios, every program ive ever used reports what the file is, this includes emby.

 

Then you get the ijots that rip from x format and don't re-adjust to 1:1 pixel ratio (which is mostly what all modern formats use) and then try and fix it by setting it in say the mkv header, programs that read from the stream all get it wrong as they ignore the mkv header.

 

I understand what your saying, but considering everything ive ever seen will report what the file has I think your only way is to set it in the meta after its read the file.

 

Personally I don't use emby for meta and use media centre master, all my media shares are read only to everyone but one smb user as (not blaming emby at all here, ive used many things in the past) ive gone through the heart ache of having to do full collection meta refreshes as something went wrong, I prefer to set mine in stone as it were and be done.

 

None of my meta files have any aspect ratio in them (from media centre master) and emby is populating the file info, when checking my files I can see that for say 2001 space odyssey I have:

 

Resolution1920x864
Aspect ratio20:9

 

Which is correct, if you have a film and it has black bars and in emby shows 16:9 (which is what the file is in reality), im afraid to say someone may have ripped them wrong and encoded the black bars into the file (instead of cropping out like everyone else).

 

If that's the case your outa luck, I would either get another copy that's ripped properly or re-encode with something like hand break (which can crop), which is only going to lose quality and be painfully slow to do a library full.

Share this post


Link to post
Share on other sites
plazma

Don't even get me started on people who cant do colour space corrections properly.. :-) that a long time personal bug bear.

 

As a solution (without a re-encode or re-rip), why not adopt a similar ethos to me, have a holding inbox share that's read write so emby what ever can set the meta, then once right move into a read only share (setting them in stone), may or may not work, as I said none of my files have the aspect or any file based info, emby is saving this info locally.

 

Ultimately your issue is likely someone forgot to crop at time of encode.

Edited by plazma

Share this post


Link to post
Share on other sites
ebr

There is already an Original Aspect Ratio field in our metadata.  It is up to the particular client app to use it however. EMC does show this field in preference to the one derived from the actual video file.

Share this post


Link to post
Share on other sites
enzeder

Wow - I appreciate all the responses, I originally posted this in the Kodi app section and someone suggested I move to server section, and I get instant responses, although now I am beginning to think that it actually belongs back in the Kodi section after-all.

 

Some more background. Kodi is my media player and I was (and still use) metabrowser to maintain the metadata, Kodi was set to read the local NFO. Metabrowser was set to pull information from various sources, including IMDB from where it sourced the original aspect ratio. So all these were loaded in the NFO. I understand the point about different formats but ultimately in my case I keep things simple and rip direct from my disk using eac3to etc - so no croping, no compression, no transoding etc - my poor old core2duo could not cope with doing it any different in any case.

 

So then I read about the EMBY addon for kodi and thought that sounds interesting, good way to keep watched status and metadata consistent across all devices. So tried it and instantly very happy, paid my money the same day and would recommend it to anyone who asks.

 

However I noticed two things. When running the metadata into EMBY all the original aspect info was wiped from NFOs. I know this because the next time I refreshed in metabrowser nearly all of them were showing as missing the aspect ratio so I had to "fetch" them all again. This happens quite frequently although each time the original aspect ratio is not lost on all files - I am down to about half since I last pulled all the missing aspect ratios about a week ago - I have fetched all the missing ones about three times. I only use metabrowser and emby to maintain the NFO files so I can only conclude that it is EMBY that is making that change. I am assuming that metabrowser and emy are consistent in terms of describing / locating the original aspect ratio information

 

Secondly in the case of say 2Guns above, which is one of the NFOs where the original aspect ratio is being retained in the NFO file Kodi (presumably via the EMBY sychronising with the KODI database direct) is showing this as a 16:9 file when it is not. So if I am interpreting this correctly this can only be fixed in the Kodi addon, which appears to be pulling the video aspect ratio and not the original aspect ratio, which goes back to the original request which would be to allow an option in the Kodi add-on (I now realise that this is more approrpriate than emby itself - subject to them not being deleted) to pull the original aspect ratio in - or even do just as EMC and give a preference to the original aspect ratio?

 

If this does belong in the Kodi section then I am happy for a forum administrator to move it back there.

Share this post


Link to post
Share on other sites
Angelblue05

We will check it out. I know the aspect ratio is a bit odd at the moment. We are indeed using the video aspect ratio and not the original aspect ratio (just need to check where it is located in the server api).

 

Edit: In the github wiki, it mentions this. We are using the one MediaStreams property....

This is generally the original aspect ratio that the video was filmed in. The actual aspect ratio of the user's video can be found in the MediaStreams property.

 

Ok I see what Kodi is expecting us to do. This should be corrected next beta. Or as close as a possible fix.

Edited by Angelblue05
  • Like 1

Share this post


Link to post
Share on other sites
AdrianW

I've always had issues with aspect being displayed incorrectly, especially with anamorphic encodes. Even when it shows correctly in the WebUI it can be wrong in EMC.

 

Here's an example of something I've encoded recently - it's ripped from good old non-HD Aussie TV at 720 x 576 but with the display aspect set to 16:9.

 

Here's the video info from Mediainfo:

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L3@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 44mn 48s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Writing library                          : x265 1.6+412-b642b3d8cc1e:[Windows][GCC 4.8.2][64 bit]
Encoding settings                        : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=1 / subme=2 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=250 / min-keyint=25 / scenecut=40 / rc-lookahead=20 / lookahead-slices=0 / bframes=4 / bframe-bias=0 / b-adapt=2 / ref=3 / weightp / no-weightb / aq-mode=1 / aq-strength=1.00 / cbqpoffs=0 / crqpoffs=0 / rd=3 / psy-rd=0.30 / rdoq-level=0 / psy-rdoq=0.00 / signhide / deblock / sao / no-sao-non-deblock / b-pyramid / cutree / rc=crf / crf=19.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / ipratio=1.40 / pbratio=1.30
Default                                  : Yes
Forced                                   : No

Here's what the WebUI displays:

55b60b359abeb_webUI.jpg

 

An here's what EMC shows:

 

55b60b53d3c88_EMC.jpg

 

Metabrowser fills in the AspectRatio element in the XML but not the Original Aspect Ratio. I think AspectRatio is the one that Emby should be using anyway. If, for example, I had a copy of Ben Hur encoded at 1.78:1, then I'd expect to see 1.78:1 (or 16/9) and not the Original Aspect Ratio of 2.66 : 1. 

 

Here's the video/audio section of the metadata built by metabrowser for the anamorphic episode above, note that it has 16:9 in the AspectRatio element:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Item>
...
  <MediaInfo>
    <Video>
      <Codec>V_MPEGH/ISO/HEVC</Codec>
      <FFCodec>hevc</FFCodec>
      <Width>720</Width>
      <Height>576</Height>
      <AspectRatio>16:9</AspectRatio>
      <Duration>45</Duration>
      <DurationSeconds>2688</DurationSeconds>
      <BitRate>0</BitRate>
      <FrameRate>25.000</FrameRate>
      <ScanType>
      </ScanType>
      <Language>
      </Language>
    </Video>
    <Audio>
      <Codec>AAC</Codec>
      <FFCodec>aac</FFCodec>
      <Channels>2</Channels>
      <BitRate>0</BitRate>
      <SamplingRate>48000</SamplingRate>
      <Language>
      </Language>
      <Default>True</Default>
    </Audio>
  </MediaInfo>
</Item>

Not sure how relevant the old version of MBT is, but that shows different info again, getting it totally wrong by displaying 480P:

 

55b60e8282ca5_theatre.jpg

 

Edited by AdrianW

Share this post


Link to post
Share on other sites
plazma

As Angelblue05 said its because the video stream is currently what's inspected. If its in wtv format playing through recorded tv will read the aspect override properly, ideally emby would also look at the header flag and then fall back to the stream. but that said all modern formats have dropped aspect overrides its a legacy of the mpeg era (dvd/dvb sd). Until emby is adjusted I would consider keeping the original and creating a new re-encode copy that's put back into 1:1 pixel ratio, old mpegs thrown into a x264 with a reasonable bitrate will give you something that's close to lossless as a work around.

 

From memory you could re-encode to either:

 

720 x 405

 

or so you preserve any vertical pixels you could do an upscale to 1024 x 576

 

Like I said that's from memory so you would need to double check, its been a long time since ive encoded pal 16:9 mpeg2

Share this post


Link to post
Share on other sites
Angelblue05

There's only one spot I saw the aspect ratio in the api. I don't know what ebr is referring to when he says original aspect ratio. However I found my mistake. It should be corrected in the next version. I've compared the value with Kodi's original way and it matched. Hopefully this is sorted out now, but we'll see once users get to test it.

Share this post


Link to post
Share on other sites
AdrianW

From memory you could re-encode to either:

 

720 x 405

 

or so you preserve any vertical pixels you could do an upscale to 1024 x 576

 

Those figures look correct, but there's no way I'd do either - the first one throws away resolution, and the seconds adds data for zero benefit. For DVD and SD TV rips, I'd always choose anamorphic encoding..

Share this post


Link to post
Share on other sites
plazma

Depends, if you playing back on a classic crt for 16:9 the guns adjusted (so no information is lost) in modern display systems if you look at the way the video render is working your likely getting one of the above at display time. Which is why most encode back to a 1:1 pixel ratio and do it at encode time.

Edited by plazma

Share this post


Link to post
Share on other sites
ebr

I think AspectRatio is the one that Emby should be using anyway. If, for example, I had a copy of Ben Hur encoded at 1.78:1, then I'd expect to see 1.78:1 (or 16/9) and not the Original Aspect Ratio of 2.66 : 1. 

 

 

 

And that's where you differ from the OP as he wants exactly the opposite.  All of his encodes are straight rips so everything is 16:9 - but he wants to see what the true OAR of the film is.

Share this post


Link to post
Share on other sites
AdrianW

And that's where you differ from the OP as he wants exactly the opposite.  All of his encodes are straight rips so everything is 16:9 - but he wants to see what the true OAR of the film is.

 

I think what he wants is the same as me - it's just the examples are different. He has 16:9 rips with encoded black bars and wants to see 2.35:1 and not 16:9. Where 2.35:1 is held in the metadata - i.e. he wants Emby to use the metadata value not that calculated from the pixel resolution.

 

I have some 4:3 rips that are anamorphic and I want to see 16:9 not 4:3. I have 16:9 held in the metadata, so again I want Emby to display what is in the metadata not what gets calculated from the pixel resolution.

 

Original Aspect Ratio doesn't even come into it, although in most cases it would be the correct value.

Edited by AdrianW

Share this post


Link to post
Share on other sites
ebr

Okay, then I misunderstood what you were asking for.

 

For general usage, the server needs to use the real value of the video file but, for display, it is a little more foggy.  The approach I took with EMC was to use the metadata value for display if it is there and fall back on the media value if it is not.

 

Where it gets a little more fuzzy with EMC is that it uses images so the values have to be interpreted to some degree and fit to an image and each theme does this on their own I think.

Share this post


Link to post
Share on other sites
AdrianW

 

For general usage, the server needs to use the real value of the video file but, for display, it is a little more foggy.  The approach I took with EMC was to use the metadata value for display if it is there and fall back on the media value if it is not.

 

So, with my example (above) I'm not sure why I'm ending up with 4:3 in EMC instead of 16:9 where I have 16:9 in the metadata AND the server is showing 16:9.

Share this post


Link to post
Share on other sites
AdrianW

@@ebr - we've had this conversation before (years ago) on the old mb2 site. I don't think those old threads are available any more - but I did find this post on the metabrowser forums, where I asked fatal to add the AspectRatio tag to TV episodes (which he did do):

 

MediaBrowser definitely does read the AspectRatio tag from episode xml - that's the reason I take the time to edit it into the xml files for my anamorphically encoded DVD rips, if I don't do that then MediaBrowser displays a totally incorrect aspect ratio (at it's most basic it will show 4:3 instead of 16:9) - by adding <AspectRatio>16:9</AspectRatio> to the xml (I usually just add it to the end immediately before the closing </item> tag), then MediaBrowser will correctly display 16:9.

 

ebr implemented this feature about two years ago - read this thread at the MediaBrowser community forum: http://community.mediabrowser.tv/permalinks/r/527/723/aspect-ratio-from-metadata#723


fatal - please consider adding the AspectRatio element to the main Information panel for TV episodes.
Edited by AdrianW

Share this post


Link to post
Share on other sites
ebr

The server is showing the value from media info and in raw text.

 

EMC is looking for the Original Aspect Ratio field (which you don't have) and, failing finding that, is calculating it from the actual height and width of the reported media info - which is why you are ending up with 4:3.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...