gstreamer subtitleoverlay 元素中时间戳文本的 Mime 类型

Mime type for time-stamped text in gstreamer subtitleoverlay element

根据文档,subtitleoverlay 元素支持带时间戳的文本。此元素支持的时间戳文本是否有标准?如果是,mime 类型和预期格式是什么?

我能够使用以下管道在视频顶部渲染从文件读取的原始文本:

gst-launch-0.10 videotestsrc ! \
    subtitleoverlay name=ovl ! \
    autovideosink \
    filesrc location=test.txt ! text/plain !  ovl.

但这只是呈现静态文本,而不是基于时间戳的动态文本。

看起来诀窍是指定字幕文件的 mime 类型。以下是源代码指示支持的一些:

application/x-subtitle
application/x-subtitle-sami
application/x-subtitle-tmplayer
application/x-subtitle-mpl2
application/x-subtitle-dks
application/x-subtitle-qttext
application/x-subtitle-lrc

SRT 字幕文件的管道:

gst-launch-1.0 filesrc location=YOURVIDEO ! decodebin ! videoconvert ! subtitleoverlay name=o ! videoconvert ! autovideosink filesrc location=SUBTITLES.srt ! application/x-subtitle ! o.

SUBTITLES.srt:

1
00:00:00,140 --> 00:00:00,900
Some text from 140 milliseconds in, to 900 milliseconds.

2
00:00:01,000 --> 00:00:02,000
And more text starting at one second in.

Matroska 站点有一些有用的信息:

http://www.matroska.org/technical/specs/subtitles/srt.html

http://www.matroska.org/technical/specs/subtitles/ssa.html

对于 ssa 格式,您似乎需要安装 libass,它是 gst-plugins-bad 的一部分:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-assrender.html

可以在 gst-plugins-base 包中找到源代码。

http://gstreamer.freedesktop.org/modules/gst-plugins-base.html

从这里开始:

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst/playback/gstsubtitleoverlay.c

真正的字幕解析代码似乎在这里:

http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/gst/subparse