Jump to content

All files with the 'Original display aspect ratio' tag play at wrong resolution


afullmark
Go to solution Solved by afullmark,

Recommended Posts

afullmark

This is not a criticism of Emby (I've yet to use it), but I wanted to investigate if Emby on the Nvidia Shield TV would show the same behaviour; see here: https://forums.plex.tv/discussion/222656/not-answered-all-files-with-the-original-display-aspect-ratio-tag-play-at-wrong-resolution/p1

 

This only affects mpeg2 in MKV (direct DVD rips).

 

With the plex app on the Nvidia Shield TV all files direct played with the 'Original display aspect ratio' (https://dl.dropboxusercontent.com/u/13997835/wrong%20width/1.txt) tag play at the wrong resolution; this doesn't occur on a transcode or with Plex Media Player on the Mac. So, 720x576 wrongly playing as 540x576 and 720x480 wrongly playing as 540x480, for example.

Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Original display aspect ratio : 2.40:1

All files that have 'Original display aspect ratio' will then not display at their intended resolution, 720x576 in the above example. In the Plex case, it is an exoplayer issue; exoplayer is choosing the 'original display aspect ratio' over the 'display aspect ratio'.

 

​The easy and reliable way to get correct playback on the nvidia shield tv is to put the files through handbrake (Mac) which gets rid of the 'Original display aspect ratio' issue.

 

So, how would emby handle these annoying files?

Edited by afullmark
Link to comment
Share on other sites

afullmark

If you can get me a sample file I can try and find out. 

 

of course:

Should be 720x576 but direct plays 540x576 instead which cuts off the screen:

https://dl.dropboxusercontent.com/u/13997835/wrong%20width/Daniel%20Barenboim%20-%20Ruhr%20Piano%20Festival%20%282007%29%20%281%29.mkv

https://dl.dropboxusercontent.com/u/13997835/wrong width/984.xml

 

720x480 but Plex on the Nvidia Shield will only direct play it at 540x480

https://dl.dropboxusercontent.com/u/13997835/wrong%20width/Victoria%20Wood%20with%20All%20the%20Trimmings%20%282000%29%20%281%29.mkv

https://dl.dropboxusercontent.com/u/13997835/wrong width/70028.xml

Edited by afullmark
Link to comment
Share on other sites

The samples are like less than a second long so I can't get them up long enough to see :).

 

Maybe they just haven't finished syncing...?

Link to comment
Share on other sites

afullmark

The samples are like less than a second long so I can't get them up long enough to see :).

 

Maybe they just haven't finished syncing...?

 

Daniel Barenboim - Ruhr Piano Festival (2007) (1) is 30 seconds. The other was 7 seconds. They have been up for ages. here is a longer one of the other: https://dl.dropboxusercontent.com/u/13997835/wrong%20width/Victoria%20Wood%20with%20All%20the%20Trimmings%20%282000%29.mkv

Edited by afullmark
Link to comment
Share on other sites

afullmark

Doesn't display correctly. Should be 720x576 but direct plays 540x576 instead which cuts off the screen:

 
IMG_0228.jpg
 
Wrong: 
IMG_0230.jpg
 
When I force transcode, displays correctly:
IMG_0231.jpg
Link to comment
Share on other sites

Is it possible that it's tied to the refresh rate setting or the detected display resolution?

Link to comment
Share on other sites

afullmark

Here's what I get in our app. Looks correct to me...

 

5872ee7bab73a_testaspect.png

 

 

Yes, that looks 720x576 16:9. That test was done on your shield app? So you're not using exoplayer in that test? What player do you use here? You must be using something different from kodi too, as that has the same issue:

 

Not just me: https://www.avforums.com/threads/nvidia-shield-android-tv-owners-thread.1964253/page-38

 
 
>"I've ripped some of my DVD's but when I play them through KODI on the Shield, some of the right hand side of the picture is missing. It seems to do this with aspect movies of 2:40.1 and 2:35.1. I have ripped them with makemkv. They play fine in Kodi on my pc but not on the Shield."
 
>"I've looked through some other movies and it appears the movies I am having problems with have an original display aspect ratio, which seems to send Kodi into a spin: 
 
>Display aspect ratio : 16:9
>Original display aspect ratio : 2.40:1"
 
>"From what I can work out, Kodi is putting a 16:9 border over the 2:40:1 starting from the left and displaying what is in the 16:9 border, hence missing out what is on the right!"
 
>"Fixed it, turned off the hardware decoders and everything is spot one!
>So if anyone else comes across this problem, turn off the hardware decoders in Kodi"
Edited by afullmark
Link to comment
Share on other sites

afullmark

Is it possible that it's tied to the refresh rate setting or the detected display resolution?

Done all manner of tests. Mpeg2 in mkv that doesn't have the 'original display aspect ratio tag' displays correctly.

 

That sample file has: Original display aspect ratio : 2.40:1' which causes players that use exoplayer to output: 540x576 instead. Ignoring the flag: Display aspect ratio : 16:9 in the file.

 

Not sure how I'd frame this problem on the exoplayer GitHub.

 

On a Mac, the only way to fix is to run through handbrake, which gets rid of the original display aspect ratio. I cannot find a way to edit the actual mpeg2 in the mkv to correct matter without reencode. Which is annoying. Mydvdedit didnt work

Edited by afullmark
Link to comment
Share on other sites

Is it possible that it's tied to the refresh rate setting or the detected display resolution?

 

Our app is playing it properly.  His pictures are from Plex I believe.

Link to comment
Share on other sites

 

Yes, that looks 720x576 16:9. That test was done on your shield app? So you're not using exoplayer in that test? What player do you use here? You must be using something different from kodi too, as that has the same issue:

 

That test was actually run on my Nexus Player.  Same app, same player as shield but Android version on NP is 7 vs. Shield at 6.  I'll bring it up on the Shield later today to confirm it is the same.

 

That was in Exo...

Link to comment
Share on other sites

afullmark

That test was actually run on my Nexus Player. Same app, same player as shield but Android version on NP is 7 vs. Shield at 6. I'll bring it up on the Shield later today to confirm it is the same.

 

That was in Exo...

Ah, so probably it was transcoded? I did not think nexus player could direct play mpeg2. My issue is with direct play only.

 

Sorry, just checked. Seems nexus player hw decode for mpeg2 was added a year ago. So, I would be very interested to learn the outcome of your test on the shield. I do appreciate your help in this matter.

Edited by afullmark
Link to comment
Share on other sites

The Shield displays it in a 4:3 box cutting off the right side.  Same app code, same player so it is either related to the hardware or Android version.

Link to comment
Share on other sites

afullmark

The Shield displays it in a 4:3 box cutting off the right side. Same app code, same player so it is either related to the hardware or Android version.

It's good that you can see and reproduce what I posted in those pictures: that 'Original display aspect ratio : 2.40:1' causes players that use exoplayer to output: 540x576 (on the shield).

 

I believe the shield gets android 7 soon; there is no real argument to take to the exoplayer GitHub at this point do you agree?

 

Again, thank you ever so much for your help.

Link to comment
Share on other sites

Yeah, since it seems to be hardware specific, I don't think it is truly an Exoplayer issue.

Link to comment
Share on other sites

  • 2 weeks later...
afullmark

Yeah, since it seems to be hardware specific, I don't think it is truly an Exoplayer issue.

 

I have a 2017 Nvidia Shield (Comes with Android 7.0); and plex still doesn't display correctly. So I'd be interested to hear if your app for the shield displays correctly with Android 7.0 on those files we discussed.

Link to comment
Share on other sites

  • 2 weeks later...
  • Solution
afullmark

Update 22/07/2017

 

Previously – https://forums.plex.tv/discussion/comment/1355491/#Comment_1355491 – I did not advocate a solution to this problem using a program (from 2003) called [Restream](https://www.videohelp.com/software/Restream "Restream"). I have now changed that opinion.

 
The video artefacts I previously attributed to being introduced by Restream, were in fact caused by MKVTOOLNIX; working with Moritz Bunkus, this has now been fixed by him: https://github.com/mbunkus/mkvtoolnix/issues/2045#issuecomment-316393191
 
This problem was isolated to mpeg only; from Bunkus:
 
> The feature was implemented by removing all 0 bytes in before the next
> start code (and all 0 bytes at the end of the buffer). The problem is
> that a slice structure may very well end in 0 bytes. The only way to
> determine the end of the slice structure with confidence is
> implementing a parser for the whole slice structure.
> The result of removing bytes belonging to the slice structure may or
> may not end in visual artifacts upon decoding. Other results include
> error message by the decoder (e.g. ffmpeg which reports errors such as
> "slice mismatch" or "motion vectors not available").
> I lack the time and motivation to implement a proper slice parser. As
> the current behavior is dangerous and just plain wrong, I'm removing
> the feature again. It was introduced in release 5.8.0 response to
> issue [#734](https://github.com/mbunkus/mkvtoolnix/issues/734 "#734"), which will now remain not implemented.
 
So, while waiting for Nvidia to fix the issue, you can, in the meantime fix things yourself by doing the following that amends the MPEG2 elementary stream without re-encode:
 
I'm on a Mac, so I had to use old work junk that's windows to do this:
 
1) You need the elementary MPEG2 so: `ffmpeg -i 'Victoria Wood with All the Trimmings (2000).mkv' -c:v copy victoria.m2v`
2) YOU HAVE TO USE WINDOWS. Open ReStream, found here http://www.videohelp.com/software/Restream (ReStream can only handle elementary MPEG2, VOBs are not implemented).
3) Reflag Sequence Display Extension -> change Horizontal Size: 720. Or you can choose to remove the flag. I REMOVED it.
4) Now MediaInfo reads the .m2v as 16:9 here.
5) Remux the .m2v and the audio and subtitles etc from original back into MKV with MKVToolnix
 
If you need ffmpeg on the mac then I suggest home-brew: http://brew.sh
Just put `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`into the command to install. Then 'brew install ffmpeg'
 
And now it'll direct play at the correct resolution

 

Update 16/02

I now do not recommend this solution; running files through restream has resulted in some problems for some films: artefacts introduced that are not in the original and other glitches (restream does NOT transcode so its processing is 'damaging' the files in some way).

My updated solution - because no other solution has been found; it'll need a change in exoplayer or a fiddle from Nvidia - is to turn off direct play, so that files are direct streamed instead. This is a workaround that means files are displayed at their correct resolution: http://forums.plex.tv/discussion/comment/1351200/#Comment_1351200

But obviously I would very much like Exoplayer people to fix this; if Direct Stream works then I hope that Direct Play can be fixed.

 

 

Just for information, I have found a solution that amends the MPEG2 elementary stream without re-encode:

If you can afford to demux/remux (this being the better approach, because here the correct flag is changed):

1) You need the elementary MPEG2 so: ffmpeg -i 'input.mkv' -c:v copy output.m2v

2) YOU HAVE TO USE WINDOWS. Open ReStream, found here http://www.videohelp.com/software/Restream (ReStream can only handle elementary MPEG2, VOBs are not implemented; maybe you can also use MPGPatcher, but I'm not sure.).

3) Reflag Sequence Display Extension -> change Horizontal Size: 720. Or you can choose to remove the flag, like i have. 
4) Now MediaInfo reads the .m2v as 16:9 here.
5) Remux the .m2v and the audio and subtitles etc from original backinto MKV with MKVToolnix

If you need ffmpeg on the mac then I suggest home-brew: http://brew.sh
Just put /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" into the command to install. Then 'brew install ffmpeg'

Edited by afullmark
Link to comment
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...