[FFmpeg-devel] Improved SAMI support

Jehan Pagès jehan.marmottard at gmail.com
Fri Sep 30 01:28:14 EEST 2016


So I posted a patch about SAMI support
(https://trac.ffmpeg.org/ticket/3118), but I was told it would be
ignored on the bug tracker, therefore to use the dev mailing list. So
patch attached, and a small description:

SAMI subtitles can have several languages (as explained in the spec:
https://msdn.microsoft.com/en-us/library/ms971327.aspx). But currently
this is not supported by ffmpeg. What ffmpeg does is simply using
subtitles for all language, and when 2 subtitles uses the same
timestamp (which obviously happen for most text in the file since they
are made for the same video), the one later defined in the file will
override the first definition.

> <SYNC Start=5905>Some text in Korean (for instance)
> […]
> <SYNC Start=5905>The same text but in English.

Result: the Korean text will never be displayed.
Also you can end up with mix of languages (versions of a subtitle in
another lang may have additional timestamps which don't get
overriden). As a consequence, I have to edit nearly every SMI file
which comes into my hand and delete all text from the language I don't
want myself. And that's extremely annoying.

My attached patch is a first step. It will only take into account
subtitles set for the default language (which means, the first defined
in the SAMI file, cf. the spec), or without a language (therefore a
subtitle can be common to all langs). Of course, the perfect version
should extract 1 subtitle track per lang in the file. This first patch
does not (maybe another one later!). But that's still a huge
improvement from the current code since usually all the SMI files I
find, the default language is indeed the one I need (since they were
done for this purpose). I have used this patch for the last 2 days,
and that's already a huge relief for me. :-)

Could this be integrated into ffmpeg?


ZeMarmot open animation film
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-basic-language-support-in-SAMI-subtitles.patch
Type: text/x-patch
Size: 12456 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160930/1f4d3f19/attachment.bin>

More information about the ffmpeg-devel mailing list