Modify

Opened 8 years ago

Closed 8 years ago

#6748 closed patch (fixed)

BluRay Subtitle Support

Reported by: Stephen <stev391@…> Owned by: ijr
Priority: minor Milestone: unknown
Component: MythTV - Video Playback Version: unknown
Severity: medium Keywords: bluray subtitle PGS
Cc: Ticket locked: no

Description

The attached patch should perform nearly everything bar the actual displaying of the subtitle, this is were I need your help. MythTV appears to be processing the returned bitmap, dimensions, timing etc, and states that it has set a subtitle to visible, but it doesn't appear on my screen!?

Also after looking at the code, it appears that MythTV scales the subtitle so it fits on a 720p screen, why is this? My BluRay?'s are all 1080p and scaling the image down then back up again will result in ugly looking images.

Attached to this email you can find my progress to date. The patch performs the following:

  • Modifies mpegts.c to identify the subtitle streams (so now you can select the subtitle when playing)
  • Implements a basic parser for the subtitle packet
  • Decodes the packet and produces a bitmap

Known limitations at the moment:

  • Run Length Encoded subtitles over multiple packets is not supported (I know how to fix this)
  • Cropping of the decoded bitmap (again I know how to fix this, but I haven seen a subtitle with

this yet)

  • Differentiating forced subtitles from normal ones (so you can tell it to only show forced subtitle, any ideas on how to implement this [i know where the flag is in the data])

To enable debugging, uncomment the defines near the top of each file. If you enable the option to save image for each subtitle, you can see that the code is correctly decoding the data and producing a bitmap.

Eventually the FFmpeg sections will be submitted upstream, however as I do not have a full working subtitle support to test with I will hold off for the moment.

Attachments (6)

bluray_subtitles_mythtv_trunk_20972.diff (23.7 KB) - added by Stephen <stev391@…> 8 years ago.
Patch as per original description
bluray_subtitles_mythtv_trunk_21007.diff (18.3 KB) - added by Stephen <stev391@…> 8 years ago.
Updated patch with cleanups suggested by FFmpeg Developers.
bluray_subtitles_mythtv_trunk_21011.diff (19.2 KB) - added by Stephen <stev391@…> 8 years ago.
Subtitles appearing (by overriding scale factor)
bluray_subtitles_mythtv_trunk_21485.diff (19.4 KB) - added by Stephen <stev391@…> 8 years ago.
Updated patch with cleanups suggested by FFmpeg Developers.
mythtv-0.22-ticket6748.patch (20.7 KB) - added by warpme@… 8 years ago.
Patch for 0.22-fixes with fixed DVD support and proper support for !1080 resolutions
t6748_matroska_hdmv_pgs_tag.diff (498 bytes) - added by taylor.ralph@… 8 years ago.
add bluray subtitle support for matroska

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by Stephen <stev391@…>

Patch as per original description

comment:1 Changed 8 years ago by anonymous

It's probably worth submitting your libavcodec/libavformat changes to ffmpeg as well, so it can go in upstream.

Changed 8 years ago by Stephen <stev391@…>

Updated patch with cleanups suggested by FFmpeg Developers.

comment:2 Changed 8 years ago by Stephen <stev391@…>

Just added an updated patch, that is a cleaned up version of previous and against current trunk.

This patch allows MythTV to decode the subtitles, however there is an issue that causes the display of the subtitle not to work correctly. The subtitle appears to be about twice the size it should be and centred off the screen at the top (when it should be down the bottom on the centre). You can only occasionally see the edge of the subtitle for very wide subtitles. So it is not very usable atm.

Changed 8 years ago by Stephen <stev391@…>

Subtitles appearing (by overriding scale factor)

comment:3 Changed 8 years ago by Stephen <stev391@…>

Just added a version of the patch that makes the subtitles appear! They are delayed from when they are supposed to be displayed, but late is better then none.

Since last patch a small tidy up of the code (in response to FFmpeg review comments) and also a small change to the scaling code in MythTV relating to subtitles. Two issues were noted in regards to scaling:

1) The code currently determines a scale factor against a 720x576 screen size, this factor was then used to scale the x,y,w & h variables. However the scaling factor was performing the opposite to intended (in this case it was enlarging the subtitles as they were out of the screen size originally), to fix this multiplication was replaced with division.

2) Once the above was fixed it was evident that this scaling was not needed (subtitles were small and closer to top left corner then they were supposed to be). So I have hard coded the scaling factor to 1.0 at the moment, until I can determine the correct way of achieving the desired outcome.

So enjoy subtitles!

Changed 8 years ago by Stephen <stev391@…>

Updated patch with cleanups suggested by FFmpeg Developers.

comment:4 Changed 8 years ago by Stephen <stev391@…>

The latest patch is just code cleanups as part of the FFmpeg review process, now new functionality introduced, however it is a lot tidier and more efficient.

comment:5 Changed 8 years ago by warpme@…

Steve,

I really enjoy Your work with BluRay? subtitles support. Million thanx for this patch

In my case http://svn.mythtv.org/trac/attachment/ticket/6748/bluray_subtitles_mythtv_trunk_21485.diff gives nice PGS subtitles, but only on screen 1920x1080 resolution. For 1280x1024 they are wrongly placed/sized, and for 1380x768 no visible. Also I have broken subtitles in DVD playback (small and mid-left screen placed)

Here is modified patch which works well for me (0.22-fixes svn23083) for: -bluray with 1920x1080, 1360x768 & 1280x1042 (only above tested) -DVD subtitles (tested on 1920x1080 and 1360x768)

Again - thanx for Your work. It was breakthrough for myth as multimedia player.

All the best

Changed 8 years ago by warpme@…

Patch for 0.22-fixes with fixed DVD support and proper support for !1080 resolutions

Changed 8 years ago by taylor.ralph@…

add bluray subtitle support for matroska

comment:6 Changed 8 years ago by markk

  • Resolution set to fixed
  • Status changed from new to closed

(In [23750]) Add missing PGS subtitle codec description. Closes #6748.

Add Comment

Modify Ticket

Action
as closed The owner will remain ijr.
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.