<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 31, 2014 at 3:45 PM, faginbagin <span dir="ltr">&lt;<a href="mailto:mythtv@hbuus.com" target="_blank">mythtv@hbuus.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;d like to improve the appearance and legibility of 608/708 captions in fixes/0.27. Some of the problems I see are:<br></blockquote><div><br></div><div>Cool, it&#39;s nice to have more people looking at this.</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- Default font size is smaller than should be necessary to fit 15 lines in a 90% safe area. I estimate the default FontMono pixel size could be increased from 32 to 38 for a 1280x720 display and I think I have a relatively simple algorithm to compute a good font pixel size for a variety of algorithms.<br>
</blockquote><div><br></div><div>This is something you can set in osd_subtitle.xml, right?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- I suspect support for subtitle zoom was added because of the first problem. Maybe it can be eliminated at some point?<br></blockquote><div><br></div><div>Subtitle zoom is there purely for readability and user preference.  The best value depends on TV size, viewing distance, the viewer&#39;s eyesight, and other factors.  This is perhaps the most important factor to make or break usability of subtitles, which is why it&#39;s one of the few settings available to the user instead of being baked into the theme.  I&#39;m not really interested in removing it. :)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- I suspect fudge factors like LINE_SPACING and PAD_HEIGHT were added for the same reason there&#39;s subtitle zoom and to work around problems created by subtitle zoom. Same goes for word wrap.<br></blockquote><div><br>
</div><div>There are several tricky issues here.  The PAD_WIDTH and PAD_HEIGHT fudge factors are there because Qt font definitions lie about sizes.  When text is drawn on the screen, the code has to specify a rectangle to draw the text on top of, and any pixels outside of the rectangle are clipped.  For the vast majority of cases, the fudge factors keep that unsightly clipping from happening.  This also doubles as the extra space to add to the black (or whatever) rectangle drawn behind the text if specified.</div>
<div><br></div><div>The other issue is design consistency between the 3 subtitle types - cc608, cc708, and srt.  The goal is that with all things being equal, the text should look consistent across the 3 subtitle types.  The most important factor here is font pixel size.  Since we allow up to 17 cc608 lines (I think that number is historical in MythTV) and up to 20 cc708 lines, we set the pixel size based on 20 cc708 lines, and just add extra line spacing for cc608.  And to confuse matters further, there is code that keeps lines from overlapping when the pixel size is too large (such as using a high zoom level) and from falling outside the safe area.  The consistency result is that if you flip between cc608 and cc708 subtitles on the same program, barring font differences, it will be very difficult tell the two apart.  And if you run mythccextractor and install one of the resulting .srt files, it should also look almost identical to the original.</div>
<div><br></div><div>Word wrapping is only done for srt subtitles, and that logic has been there for a very long time.  This is motivated by subtitles translated into a different language.  Translations are almost always longer than the original, causing frequent clipping in the absence of word wrapping.  The cc708 spec has a provision for word wrap, but it is not implemented in MythTV and I have never seen it in the wild.  (This is not surprising since pretty much all cc708 subtitle streams are automatic conversions from cc608, the most imaginative difference being a sans serif font.)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- Captions are shifted too far to the left. As a result, it is hard to tell who is speaking when two people are on screen. I believe they should be positioned to center 32 characters per line when the video is 4:3 aspect and 42 characters per line when the video is 16:9, based on what I&#39;ve gleaned about the 708 standard.<br>
</blockquote><div><br></div><div>I do think this is a problem in the cc708 stream from the broadcaster.  But if MythTV is interpreting the data wrong, I would definitely like to know.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
I&#39;ve tinkered with osd_subtitle.xml and I don&#39;t see how I can fix these problems just by tweaking the theme file. I see that the code involved has diverged in master, so I have backported a number of files in my development environment in the hopes that my work might eventually be considered for inclusion in master. I&#39;m sure I can improve the display of 608/708 captions while simplifying the code at the same time, and I believe I know how to test support for SRT subtitles and make sure I don&#39;t break DVD subtitles (I&#39;ve got both NTSC and PAL DVDs). I am worried that I could break teletext subtitles unless I know more about them and/or have test samples.<br>
</blockquote><div><br></div><div>I&#39;d be very happy to see your code changes.  SRT files are generally very easy to test -- for file foo.mpg, just drop a foo.srt file next to it.  If you get your .srt file from mythccextractor, you&#39;ll have to rename it to follow the pattern.  This layout code is entirely for text subtitles, whereas DVD subtitles are bitmaps, so there&#39;s almost no chance of breaking that.  Text-based teletext subtitles (as opposed to the bitmap DVB subtitles) are currently in a completely different part of the code - teletextscreen.cpp instead of subtitlescreen.cpp.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
My questions are:<br>
<br>
- Am I off base w.r.t zoom, fudge factors and word wrap? If so, please educate me.<br></blockquote><div><br></div><div>I hope the above clarified it a bit.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
- Would there be interest in any work I do to improve the display of 608/708 captions?<br></blockquote><div><br></div><div>Definitely!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
- If so, can someone direct me to some test videos for teletext, and perhaps advise me on unit test cases I should pay special attention to or haven&#39;t mentioned above?<br></blockquote><div><br></div><div>No need to worry about teletext since the code is separate.  Be sure to consider that the theme might explicitly set the font pixel size.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks in advance,<br>
Helen</blockquote></div></div></div>