Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8954 closed defect (Fixed)

Edge letters of subtitles are vertically clipped

Reported by: yianniv Owned by: stuartm
Priority: minor Milestone: 0.24
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Robertm, you were right about 8953, I hadn't paid close attention all the changes.

However, changing the subtitle size to 100 (from 55) showed the problem I described: the edge (left and right) letters are clipped vertically. Unfortunately, I cannot provide you with a screenshot because ksnapshot just produces a blank picture and using the builtin screenshot function produces this:

2010-09-18 01:45:23.526 VDPAU: Added 2 output surfaces (total 4, max 4)
2010-09-18 01:45:27.213 Launching: /usr/bin/mythpreviewgen --size -1x-1 --frame 193 --chanid 0 --starttime 20100918004421 --outfile "/home/yianni/.mythtv/0_20100918004421_193.png"  > /dev/null
2010-09-18 01:45:27.230 PID 13879: launched
Invalid argument to -c/--chanid option
2010-09-18 01:45:27.645 PID 13879: exited: status=64512, result=252
2010-09-18 01:45:29.494 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:31.606 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:33.734 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:35.819 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:37.983 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:40.130 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:42.234 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:44.307 Player(0): Timed out waiting for free video buffers.
2010-09-18 01:45:46.482 Player(0): Timed out waiting for free video buffers.

Attachments (2)

clipped_subs.jpeg (125.3 KB) - added by yianniv 9 years ago.
clipped sub bottom line right
subtitle_stretch.3.diff (7.7 KB) - added by stuartm 9 years ago.
Updated patch.

Download all attachments as: .zip

Change History (25)

comment:1 Changed 9 years ago by robertm

Status: newinfoneeded_new

Yianni,

Have you changed the subtitle font? This sounds like you are using a broken/buggy font, not unlike the ones we replaced in core Myth.

comment:2 Changed 9 years ago by robertm

Also, if you want to take a screenshot, don't use VDPAU.

comment:3 Changed 9 years ago by yianniv

Font is freesans, and with playback using cpu+ I am attaching the screenshot. It shows clipping on the right letter of the bottom line. With VDPAU I could see it on the left side, too.

Changed 9 years ago by yianniv

Attachment: clipped_subs.jpeg added

clipped sub bottom line right

comment:4 Changed 9 years ago by yianniv

I was wrong, both lines are clipped on the right side. The little blue artifact in the centre is ksnapshot starting up.

comment:5 Changed 9 years ago by markk

Milestone: unknown0.24
Owner: changed from Janne Grunau to markk

comment:6 Changed 9 years ago by Jim Stichnoth <stichnot@…>

In case this helps, I observe the same left/right clipping with EIA-608 captions, FreeMono? font included with MythTV, Qt 4.5.3, and primarily with all-uppercase captions. It may be more apparent when using the black background for captions. Interestingly, displaying at 1366x768 resolution shows the clipping but 1280x720 does not.

I couldn't find any obvious problems in the code, so I hacked a workaround by adding 12 to the width computation in SubtitleScreen::DisplayCC608Subtitles() and SubtitleScreen::DisplayRawTextSubtitles?(). This may not be entirely bad since TVs and STBs seem to widen the black background rectangle beyond the text boundary.

comment:7 Changed 9 years ago by markk

Resolution: fixed
Status: infoneeded_newclosed

(In [26423]) Add some additional padding around text based subtitles.

Even when working as expected, the current code has little or no padding around rendered text - which is noticeable at the sides when using a black background and top and bottom with certain fonts. For some reason fonts are also sometimes cropped when the text extends beyond the calculated width.

So add a small amount of padding around each line of rendered text for external text, embedded text, 608 and 708 based subtitles. Teletext subtitles are unchanged as the text does not appear to be cropped and the positioning of text is less flexible.

Closes #8954

comment:8 in reply to:  7 Changed 9 years ago by Johan Moe <johan@…>

I still have vertically clipped subtitles when using vdpau, but not when using xv. I tried changing the PAD_WIDTH without success. Changing

int width = font.width(subtitle) + pad_width * 2;

to

int width = font.width(subtitle) * 2 + pad_width * 2;

solved my problem, but I believe that it's rather font.width(subtitle) that returns an incorrect value. The problem might have to to with me running a rather unusual pixel aspect ration. I have a 16:9 TV with a resolution of 1920x600.

comment:9 Changed 9 years ago by Johan Moe <johan@…>

Resolution: fixed
Status: closednew

comment:10 Changed 9 years ago by Kenni Lund [kenni a kelu dot dk]

Status: newassigned

comment:11 Changed 9 years ago by Johan Moe <johan@…>

I reported the wrong resolution in my last post. I have 1920x576, and not 1920x600.

xdpyinfo | grep -B2 resolution

gives:

screen #0:
  dimensions:    1920x576 pixels (403x225 millimeters)
  resolution:    121x65 dots per inch

comment:12 Changed 9 years ago by stuartm

Owner: changed from markk to stuartm
Status: assignedaccepted

I have a theory about this one.

comment:13 Changed 9 years ago by stuartm

I've attached a patch which may or may not help. Having looked again at the issue described and the code I'm less certain that it will do any good but it's worth a try.

comment:14 in reply to:  13 Changed 9 years ago by Johan Moe <johan@…>

Well, it did remove the clipping, but the character width also changed from being normal to being too narrow.

comment:15 Changed 9 years ago by stuartm

We need to reapply the correct stretch for the video window dimensions and in the case of XV the video stretch. When that happens we might just end up back at square one with the clipping, but at least the code would be 'correct' and should render more correctly with XV.

comment:16 Changed 9 years ago by stuartm

Please try the updated patch I've just attached.

comment:17 in reply to:  16 Changed 9 years ago by Johan Moe <johan@…>

Instead of clipping the subtitles, it now replaces the last characters of every sentence with "...", but the font width is now back to normal.

comment:18 Changed 9 years ago by stuartm

well that's progress of sorts ...

Changed 9 years ago by stuartm

Attachment: subtitle_stretch.3.diff added

Updated patch.

comment:19 Changed 9 years ago by stuartm

Ok, new patch, at the very least this should restore the status quo with clipping but the font should be correctly proportioned on non-square pixel displays. If that happens then it would appear to be a QFontMetrics bug, they've been seen elsewhere in mythui.

comment:20 in reply to:  19 Changed 9 years ago by Johan Moe <johan@…>

It now works correctly with vdpau :) The font did have the right proportions originally as well, it was only the edges that were clipped. Great work!

comment:21 Changed 9 years ago by stuartm

It was only a certain amount of coincidence and luck that the fonts had the correct dimensions previously since those fonts were inheriting a stretch factor from the parent UI when the video display size may be different.

comment:22 Changed 9 years ago by stuartm

Resolution: Fixed
Status: acceptedclosed

(In [26891]) Fix text-based subtitles from being incorrectly stretched and therefore clipped. Fixes #8954

comment:23 Changed 9 years ago by stuartm

(In [26894]) Fix text-based subtitles from being incorrectly stretched and therefore clipped. Backports [26891] to 0.24-fixes. Fixes #8954

Note: See TracTickets for help on using tickets.