Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#9294 closed Patch - Feature (fixed)

SSA/ASS Subtitle support

Reported by: Shawn King <shawnking@…> Owned by: markk
Priority: minor Milestone: 0.25
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: yes

Description

the attached patches should support basic SSA/ASS support

what isnt supported in this patch(might be more it should have similar support as mplayer w/out using -ass in commandline)

  • it ignores all SSA override codes
  • it ignores underline and strike-through in the subtitle styles
  • it ignores the text wrapping setting and wraps them anyway if needed
  • the code only allows for hex colour codes but after rereading the specs integer based colourcodes can be used too
  • moving previous subtitles up for new ones and clearing subtitles when layer is less then the one being displayed

using libass instead of these patch would probably support everything if you want to do that intead

the 3rd patch is version 6 and hasn't been tested on my main machine yet(adds scalex/y and i think deletes the styles when done previous patches can be found on dev list) i recommend going over this patch carefully for bugs since i am a self taught programmer and it is the first time i have used the QT libary and the mythtv code

you can find a link to the specs + some more info here
http://www.matroska.org/technical/specs/subtitles/ssa.html

Attachments (8)

myth-01-AVFormatFontSupportV3.patch (4.2 KB) - added by anonymous 3 years ago.
adds embedded font support to mythtv
myth-02-AVFormatSubtitleHeaderSupport.patch (1.8 KB) - added by anonymous 3 years ago.
allows access to the new subtitle_header
myth-03-SubtitleScreenSSASubSupportV6.patch (20.1 KB) - added by anonymous 3 years ago.
actually adds SSA/ASS support in subtitlescreen
ffmpeg-FixASSSubs.patch (624 bytes) - added by anonymous 3 years ago.
fixes ffmpegs ASS subtitles(might not be needed if ffmpeg fixes it before the merge)
myth-03-SubtitleScreenSSASubSupportV7.patch (21.0 KB) - added by anonymous 3 years ago.
actually adds SSA/ASS support in subtitlescreen V7
0001-Add-access-to-subtitle_header-in-avformatdecoder.patch (2.3 KB) - added by slackerlinux85@… 3 years ago.
subtitle header code libass version
0002-Add-access-to-font-attachments-in-avformatdecoder.patch (4.7 KB) - added by slackerlinux85@… 3 years ago.
font attachment code libass version
0003-Add-SSA-ASS-subtitle-support-libass.patch (12.2 KB) - added by slackerlinux85@… 3 years ago.
SSa subtitles using libass

Download all attachments as: .zip

Change History (24)

Changed 3 years ago by anonymous

adds embedded font support to mythtv

Changed 3 years ago by anonymous

allows access to the new subtitle_header

Changed 3 years ago by anonymous

actually adds SSA/ASS support in subtitlescreen

Changed 3 years ago by anonymous

fixes ffmpegs ASS subtitles(might not be needed if ffmpeg fixes it before the merge)

comment:1 Changed 3 years ago by kenni

  • Reporter changed from anonymous to Shawn King <shawnking@…>
  • Status changed from new to assigned

Changed 3 years ago by anonymous

actually adds SSA/ASS support in subtitlescreen V7

comment:2 Changed 3 years ago by SlackerLinux85@…

the ffmpeg patch shouldn't be needed nomore it should be fixed in ffmpeg repos

attached is v7 of the 3rd patch it fixes detecting the style version and attempts to support colourcodes other then hex

looking at the header these patches prob wont work with the SRT patch in ffmpeg devel mailing list so there's prob a lil bit more work to be done
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-December/101408.html

Changed 3 years ago by slackerlinux85@…

subtitle header code libass version

Changed 3 years ago by slackerlinux85@…

font attachment code libass version

Changed 3 years ago by slackerlinux85@…

SSa subtitles using libass

comment:3 Changed 3 years ago by slackerlinux85@…

the 3 new patches replace the older ones they use libass to render the subtitles which should support any SSA/ASS file and the new SRT to ASS conversion code in FFMPEG(i haven't tested this though)

only issue i have found sofar is in the opengl renderer the subtitles are displayed on the black bar xv-blit shows them at the correct spot also the code links to the system libass(with no option to disable/enable in configure) so the libass library still needs to be added to myth

comment:4 Changed 3 years ago by slackerlinux85@…

link to new version of the 0003-Add-SSA-ASS-subtitle-support-libass.patch it doesn't change the code it adds libass into mythtv source tree and compiles it as a dll(works for me someone who knows the build code should give it a onceover) atleast on master on the ffmpeg sync branch ./configure wasn't working

you can also now compile without libass support
http://www.mediafire.com/?6nb0arlh5jjk9j3

comment:5 Changed 3 years ago by beirdo

Is this even needed on the ffmpeg-sync branch to use SSA? My intention is to merge the ffmpeg sync into master in the next few weeks.

comment:6 Changed 3 years ago by beirdo

  • Status changed from assigned to infoneeded

Is this still required after the ffmpeg sync? If so, which portions of it?

comment:7 Changed 3 years ago by slackerlinux85@…

all of it

  • 1st patch allows the 3rd patch to access subtitle header code in ffmpeg
  • 2nd patch allows access to ffmpegs font attachments for libass to render
  • 3rd patch uses libass to render the SUBTITLE_ASS subtitle type and removes the code that ignores SSA subtitles last version in the mediafire link also includes libass in the mythtv source tree so no dependancy is added

the patches seem to work i have been running them ever since i made them and the only issue i can see atm is with the opengl renderer the subtitle location is placed on the black bar when they should be on the video. XV renderer is fine. should be a simple problem for someone more familiar with the code i couldn't find the right QRect to use(atm its using m_player->getVideoOutput()->GetOSDBounds())

comment:8 Changed 3 years ago by slackerlinux85@…

should prob point out whats the latest version of each patch

1st patch is 0001-Add-access-to-subtitle_header-in-avformatdecoder.patch

2nd patch is 0002-Add-access-to-font-attachments-in-avformatdecoder.patch

3rd patch is at the mediafire link in comment 4(since it was too big for trac)

comment:9 Changed 3 years ago by markk

  • Milestone changed from unknown to 0.25
  • Owner changed from janne to markk
  • Status changed from infoneeded to assigned

comment:10 Changed 3 years ago by Github

AvFormatDecoder?: Add a GetSubHeader? method.

This is the first of the SSA support patches. Refs #9294

Changeset: 4b48823847eeb2923c563cb98609166a325b84d5

comment:11 Changed 3 years ago by Github

ffmpeg: Add TTF font/attachment support to myth_utils.c

Refs #9294

Changeset: a0b999d2d9e44465ccf03413ba1d2abee02ea079

comment:12 Changed 3 years ago by Github

AvFormatDecoder?: Add support for font attachments.

Refs #9294

Changeset: fa52b41a16060e2c570a2b7d85d12dfe40d24d83

comment:13 Changed 3 years ago by Github

AvFormatDecoder?: SSA subtitles are now handled by ffmpeg.

Refs #9294

Changeset: 6db2c5e1ad77a2a6c33e70883be6eb0f1dca945c

comment:14 Changed 3 years ago by Github

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

Add ASS/SSA subtitle support.

Based on the final patch from Shawn King (thank you) in #9294 with the
following changes:-

  • fixed the display area to line up with the video rect.
  • only initialise libass when required.
  • various additional NULL pointer checks and minor refactors.
  • use SubtitleScreen::m_safeArea in the ass code.

I chose to use a compile time dependency on libass rather than create
another internal library version (and avoid the maintenance that it
would need) or use dynamic linking (extra complexity). As noted in
configure, the libass version (although not actually checked) needs to
be at least 0.9.10 - which is probably still too new for the libass
version packaged with most distros.

Closes #9294

Changeset: bfeabeeb189950411abd09ace0f0d19f1a6e607a

comment:15 Changed 2 years ago by will@…

Any chance of a backport to 0.24-fixes ?

comment:16 Changed 2 years ago by wagnerrp

  • Ticket locked set

Add Comment

Modify Ticket

Action
as closed .
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.