My ultimate motivation for making this change is so that I can transcode anime (which primarily has SSA subtitles) to be playable on my iPod Touch. Of course my work should be more generally useful for other purposes.
First I will need to add support for subtitles originating from file-inputs: The hb_stream -> hb_title conversion logic in ffmpeg_title_scan [stream.c] must be extended to convert AVStreams of type SUBTITLE to hb_subtitle objects attached to the single output hb_title object.
I don't think the demuxers (or the reader logic) need updating.
Then there are three ways that SSA subtitles can be pushed to the output:
1. Render on the video track, in a way similar to VOB (DVD bitmap) subtitles
- subtitle->fifo_in ---[hb_decssasub*]---> (banded 8-bit YAUV)
subtitle->fifo_raw ---[hb_sync_video*]---> (unchanged)
job->fifo_sync ---[hb_render]--->
job->fifo_render ---[hb_encFOOvideo]--->
job->fifo_mpeg4
- subtitle->fifo_in ---[hb_decssasub*]---> (styled text subtitles, with limited formatting: <b>, <i>, <u>)
subtitle->fifo_raw ---[hb_sync_video*]---> (unchanged)
subtitle->fifo_out
- subtitle->fifo_in ---[hb_decssasub*]---> (unchanged)
subtitle->fifo_raw ---[hb_sync_video*]---> (unchanged)
subtitle->fifo_out
- The MKV muxer (hb_mux_mkv) is easy to update to support SSA subtitles, since it supports MK_SUBTITLE_SSA, MK_SUBTITLE_ASS, and even MK_SUBTITLE_USF subtitle tracks natively.
- The MP4 muxer (hb_mux_mp4) is more tricky. I'm not even sure if the container supports SSA subtitles natively. Further investigation is needed here.
- The other muxers, OGM (hb_mux_ogm) and AVI (hb_mux_avi), do not appear to be supported anymore, judging by their omission from the MacGUI.
Then there exists the matter of updating the CLI and the GUIs.
- Currently the CLI supports the selection of only two subtitle output methods, burned (AKA rendered) or non-burned (AKA passthru), whereas now I've provided three above. I'll probably implement method #1 as the burned method and either #2 or #3 as the passthru method, depending on whether the output container supports SSA subtitles natively.
- The MacGUI also supports the selection of the same subtitle output methods: burned and non-burned. Therefore the output-method-selection logic should be the same.
- I don't have any experience with the other GUIs.
Update: For that last question I just found this: http://trac.handbrake.fr/browser/trunk/AUTHORS