QuickLookVideo icon indicating copy to clipboard operation
QuickLookVideo copied to clipboard

Feature: Add SSA/ASS rendering

Open MaddTheSane opened this issue 8 months ago • 5 comments

There should be a way to add subtitles for SSA/ Advanced SSA as a codec for CoreVideo. Perian did so, And I was able to rip out the parts that Perian used to create subtitles. However, the code uses old, deprecated, and removed APIs called Apple Type Services. Apple Type Services, commonly abbreviated as ATSUI, is no longer available, but CoreText is meant to replace it. I'm working on the migration over here, but my lack of knowledge is stymied me

An alternative for SSA rendering is to use libASS. But libass relies on FreeType.

MaddTheSane avatar Apr 01 '26 07:04 MaddTheSane

I've considered two approaches:

  1. Burn in subtitles by rendering them into the video frames Advantages: - Can be done without arcane knowledge of AVFoundation internals etc. Disadvantages: - Drags in freetype plus a whole bunch of other dependencies to do the rendering. - No control over whether (or which) subtitles are displayed.

  2. Convert on-the-fly to a format that AVFoundation understands and will render which according to documentation is either mov_text or WebVTT Advantages: - Will give a native-like experience in Quick Look Preview and QuickTime Player. - Don't have to deal with rendering directly. Disadvantages: - Some formatting may be lost. - May require libass to decode, which has a hard dependency on freetype even if we don't need it. - Can't find any useful documentation on providing AVMediaTypeSubtitle or AVMediaTypeClosedCaption tracks.

Option 2 seems preferable if I can get it working.

Marginal avatar Apr 01 '26 12:04 Marginal

Using the Perian method means not importing FreeType.

MaddTheSane avatar Apr 01 '26 20:04 MaddTheSane

I'd like to have this option off by default. Subtitles for QuickLook seem to be an odd idea for me. If a user would like them to be visible, it's ok, but it's not for everyone

eirnym avatar Apr 08 '26 08:04 eirnym

This is more for the Media Extension.

MaddTheSane avatar Apr 08 '26 18:04 MaddTheSane

Looks like my option 2 isn't viable - any attempt to return a Text or Subtitle track from a format reader Media Extension results in AVFoundation refusing to play the file. I've left the WIP code in the subtitles branch in case this changes in the future.

I'm not keen on option 1 (whether using FreeType or the Perian method) since it gives the user no control over the subtitles.

Marginal avatar Apr 09 '26 16:04 Marginal