Opened 2 weeks ago

Last modified 3 days ago

#13548 assigned Bug Report - General

Video aspect ratio wrong with mythfrontend in window

Reported by: Klaas de Waal Owned by: mark-kendall
Priority: minor Milestone: 31.0
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

With today's master, the video aspect ratio is wrong when playing a recording, or live TV, with mythfrontend in a window. The window has 16:9 aspect ratio but the width of the video is less. Screenshot is attached.

This is on my two-monitor development system but it the problem is also present when the second monitor is disconnected and the system is rebooted. Intel graphics only.

The settings in Setup\Appearance\Theme/Screen? Settings\Virtual monitor aspect ratio, available when using two monitors, do not have any influence.

This problem must have been introduced in the last two weeks or so.

The aspect ratio with full screen playback on a TV is correct; this system runs also today's master but has different hardware (nvidia).

Attachments (10)

MythTV Frontend_010.png (811.6 KB) - added by Klaas de Waal 2 weeks ago.
Wrong aspect ratio of video in window
configure_20200106.log (34.4 KB) - added by Klaas de Waal 13 days ago.
Log of the ./configure of the configuration that produces the video aspect ratio issue.
mf-20200106-2220.log (15.8 KB) - added by Klaas de Waal 13 days ago.
Log of mythfrontend playing video fragment first with VAAPI and then with OpenGL High Quality, both showing the video aspect ratio issue.
mf-20200107-2134.log (24.6 KB) - added by Klaas de Waal 12 days ago.
Log of mythfrontend with -v playback. Playing a SD recording in 1280x720 window on 1920x1200 screen.
xrandr_verbose.log (16.1 KB) - added by Klaas de Waal 12 days ago.
Output of xrandr --verbose
card0-HDMI-A-2_edid.bin (256 bytes) - added by Klaas de Waal 12 days ago.
EDID of main monitor, Samsung 1920x1200
card0-HDMI-A-3_edid.bin (256 bytes) - added by Klaas de Waal 12 days ago.
EDID of second monitor, HP 1920x1080
mf-20200107-2153.log (25.7 KB) - added by Klaas de Waal 12 days ago.
Log of mythfrontend with -v playback. Playing a SD recording in 1280x720 window on 1920x1080 screen. Aspect ratio is correct.
card0-HDMI-A-2_edid.2.bin (256 bytes) - added by mark-kendall 11 days ago.
Samsung EDID modified to report a display size of 160x100mm
mf-20200114-2208.log (21.8 KB) - added by Klaas de Waal 5 days ago.
Output of mythfrontend -v playback with today's master, the video aspect ratio now correct.

Download all attachments as: .zip

Change History (28)

Changed 2 weeks ago by Klaas de Waal

Attachment: MythTV Frontend_010.png added

Wrong aspect ratio of video in window

comment:1 Changed 2 weeks ago by jpilk

I had aspect ratio problems too, but c535f96 and b2a0e82 work for me; I'm using my longstanding --geometry overrides, though, which may be thought undesirable.

Changed 13 days ago by Klaas de Waal

Attachment: configure_20200106.log added

Log of the ./configure of the configuration that produces the video aspect ratio issue.

Changed 13 days ago by Klaas de Waal

Attachment: mf-20200106-2220.log added

Log of mythfrontend playing video fragment first with VAAPI and then with OpenGL High Quality, both showing the video aspect ratio issue.

comment:2 Changed 12 days ago by mark-kendall

Status: assignedaccepted

comment:3 Changed 12 days ago by mark-kendall

Status: acceptedinfoneeded

Klaas

Can you confirm a few things:-

  • per the email discussion, are you running wayland?
  • what is the actual aspect ratio of your monitor? 16:9 or 16:10?

Can you also attach

  • the full log using '-v playback' logging.
  • the full output from 'xrandr --verbose'
  • the EDID itself.

For the EDID, I think it should be as easy as:-

cat /sys/class/drm/card0-HDMI-A-2/edid > monitor.edid

Though you may need to check that HDMI-A-2 is the correct device.

comment:4 Changed 12 days ago by mark-kendall

Can you also confirm what is shown in the "Virtual monitor aspect ratio" field of the appearance settings page. Thanks

comment:5 Changed 12 days ago by Klaas de Waal

About Wayland or X11, my understanding is that I run X11, as indicated by the following:

[klaas@modu mythtv]$ loginctl
SESSION  UID USER  SEAT  TTY 
      6 1000 klaas seat0 tty1

1 sessions listed.
[klaas@modu mythtv]$ loginctl show-session 6 -p Type
Type=x11
[klaas@modu mythtv]$

[klaas@modu mythtv]$ echo $XDG_SESSION_TYPE
x11
[klaas@modu mythtv]$

About monitor aspect ratio. Main monitor is 16:10, second monitor is 16:9. Arranged side-by-side. When only the main monitor (16:10) is connected the problem is the same.

About the "Virtual monitor aspect ratio". The setting is "Auto" but I have also tried "32:10 Side by side" and a few others. This did not make any difference.

Logs are attached.

Changed 12 days ago by Klaas de Waal

Attachment: mf-20200107-2134.log added

Log of mythfrontend with -v playback. Playing a SD recording in 1280x720 window on 1920x1200 screen.

Changed 12 days ago by Klaas de Waal

Attachment: xrandr_verbose.log added

Output of xrandr --verbose

Changed 12 days ago by Klaas de Waal

Attachment: card0-HDMI-A-2_edid.bin added

EDID of main monitor, Samsung 1920x1200

Changed 12 days ago by Klaas de Waal

Attachment: card0-HDMI-A-3_edid.bin added

EDID of second monitor, HP 1920x1080

Changed 12 days ago by Klaas de Waal

Attachment: mf-20200107-2153.log added

Log of mythfrontend with -v playback. Playing a SD recording in 1280x720 window on 1920x1080 screen. Aspect ratio is correct.

comment:6 Changed 12 days ago by Klaas de Waal

Status: infoneededassigned

Rebooted the system with only the HP 16:9 1920x1080 monitor connected. The video aspect ratio is now correct! Log of mythfrontend -v playback is attached. It looks like the problem is the 16:10 form factor of the Samsung monitor.

comment:7 Changed 11 days ago by jpilk

Running 1c97471de5f on my F30 box-with-nVidia I found it difficult to get settings that properly nested the video into the GUI on both the monitor and the TV.

Previously my default 'mythfrontend' setup has been a windowed display 1024x576+64+64 and I have used

'mythfrontend -nw -geometry 1920x1080+1680+0' to put it on the TV

Adding ' -display=HPFed:0.0' to both these command lines does what I want.

The name is as shown in the nVidia X Screen information, which also gives dimensions of 3600x1080, ratio 10:3. Specifying ratios doesn't seem to make an easily understood difference to what I see.

My usual problem with -help screens is knowing what format the writer thought was obvious.

comment:8 Changed 11 days ago by Klaas de Waal

The problem seems to be that the 16:10 monitor is considered to have a size of 160mmx90mm which then leads to an incorrect Display Rect result:

2020-01-07 21:35:15.658760 I  VideoWin: New display properties: 160mmx90mm Aspect 1.3333
...
2020-01-07 21:35:15.658824 I  VideoWin: Display Rect: 1159x720+60+0 Aspect: 1.96296

For the 1920x1080 16:9 monitor the dimensions are correct and the Display Rect is also correct:

2020-01-07 21:54:01.621708 I  VideoWin: New display properties: 480mmx270mm Aspect 1.3333
...
2020-01-07 21:54:01.621731 I  VideoWin: Display Rect: 1280x720+0+0 Aspect: 1.77778

The problem would be solved if the screen dimensions are reported correct. This does depend on correct values in the EDID and especially for older TV's these values might be wrong.

However, as far as I know, all screens with a resolution of full-HD (1920x1080) or higher do have square pixels. Also, it is unlikely to have a screen of 160mmx90mm so if this is reported it should not be taken too serious.

Note that also my 55-inch full-HD TV (Samsung, 2011) is reported to have a size of 160mmx90mm.

It looks to me that the way forward can be:

  • Obtain the correct display dimensions
  • Discard 160mmx90mm results as they indicate that the real values are not available
  • For resolutions of full-HD or higher always use square pixels
  • Add a warning message when the reported dimensions are corrected for square pixels

comment:9 Changed 11 days ago by mark-kendall

It looks to me that the way forward can be:

Obtain the correct display dimensions

If the EDID is wrong, there is no other way of automatically detecting the actual screen size. That is what the EDID is for.

Discard 160mmx90mm results as they indicate that the real values are not available

As mentioned previously, 160x90 is a common and useful result - it tells us all we need to know (i.e. the aspect ratio). We don't actually care about the size.

For resolutions of full-HD or higher always use square pixels

I'd personally guarantee that this won't be accurate in a number of scenarios.

The real issue here is whether this was working as expected before?

All it really needs is for the aspect ratio override setting to be respected - I think in refactoring I assumed it was only needed/used for 'Xinerama' (i.e. multi-screen) setups.

The other potential solution is to override the EDID for that display. I'll attach a modified EDID that indicates 160x100 which can then be used with something like:-

https://unix.stackexchange.com/questions/295784/how-to-tell-intel-graphics-to-use-my-custom-edid-file

Changed 11 days ago by mark-kendall

Attachment: card0-HDMI-A-2_edid.2.bin added

Samsung EDID modified to report a display size of 160x100mm

comment:10 Changed 11 days ago by mark-kendall

Milestone: needs_triage31.0
Version: UnspecifiedMaster Head

comment:11 Changed 11 days ago by Klaas de Waal

Thanks for the EDID. Using a custom EDID will solve it for me and there are probably not that many 16:10 screens with an incorrect EDID.

About your question:

The real issue here is whether this was working as expected before?

Yes, it has always worked as expected except for a short period as described in ticket #13400.

For me the current behavior is a regression as it is not correct anymore for a display with square pixels and wrong dimensions in the EDID. I do however agree it is an improvement for screens with non-square pixels and a correct EDID.

comment:12 Changed 11 days ago by mark-kendall

Having thought it through - I'm pretty sure the old code got it 'correct' by accident in your case. I noticed recently that the calls in MythXDisplay::GetDisplayDimensions? do not return the correct values when multiple dislays are connected - which is why they are not used anymore (we now use XRANDR - which will only be using the EDID anyway).

Anyway, I've started re-visiting the display aspect ratio settings - which should clear things up a little. Just trying to work out the cleanest approach.

So in your case, you should just be able to override the aspect ratio to 16:10 (rather than auto) (or override the EDID).

comment:13 Changed 11 days ago by jpilk

I just updated the old laptop, ubuntu bionic, to current master 627c03d. No extra screens, default display in a window was slightly narrower than the frame.

'mythbackend.real -v playback -display=LDVS1' appears to give a good fit.

comment:14 Changed 11 days ago by Klaas de Waal

A setting like the "Virtual monitor aspect ratio" (which could then become the "Monitor aspect ratio") would be perfect. In my case I have two monitors with different aspect ratio's (although both with square pixels...) so I think it should be possible to override each monitor individually.

comment:15 in reply to:  13 Changed 10 days ago by mark-kendall

Replying to jpilk:

I just updated the old laptop, ubuntu bionic, to current master 627c03d. No extra screens, default display in a window was slightly narrower than the frame.

'mythbackend.real -v playback -display=LDVS1' appears to give a good fit.

John - if you have a problem, please open another ticket and clearly explain what behaviour you are seeing, steps to reproduce and the behaviour you expect to see - along with relevant logs etc. These comments are not helpful.

comment:16 Changed 5 days ago by mark-kendall

Klaas - can you test with latest master.

This should be working properly now - by which I mean you should override the display aspect ratio in Setup->Appearance->Theme/Screen? Settings->Screen aspect ratio

You can of course still override the EDID.

see a4aad255a7d

comment:17 Changed 5 days ago by Klaas de Waal

Problem solved!! The display is correct, the video does now once again exactly fills the window. Note that this is with the "Screen aspect ratio" to "Auto" and without a user-defined EDID.

FIY, the output of "mythfrontend -v playback" is attached.

Thanks!

Changed 5 days ago by Klaas de Waal

Attachment: mf-20200114-2208.log added

Output of mythfrontend -v playback with today's master, the video aspect ratio now correct.

comment:18 Changed 3 days ago by Mark Kendall <mark.kendall@…>

In aeb97c5d2e/mythtv:

MythVideoOutput?: Fix a regression with windowed aspect ratio

Refs #13548
Refs #13560

Note: See TracTickets for help on using tickets.