Skip to content

Commit

Permalink
matroska: Mark S_TEXT/UTF-8 as Subrip encoded subtitles.
Browse files Browse the repository at this point in the history
While not explicitly stated in the specs, the original author
has stated that S_TEXT/UTF-8 is expected to be text using Subrip
markup, but without Subrip in-band timing.

So, now that we have a decoder that conforms to this expectation,
let's use it.

Note that this change will impact tools that use libavformat. If
they expect srt subtitles to have CODEC_ID_TEXT, they must be
adjusted to expect CODEC_ID_SUBRIP. The actual content is, obviously,
unchanged.

Signed-off-by: Philip Langdale <philipl@overt.org>
  • Loading branch information
philipl committed Aug 25, 2012
1 parent 0bb37bb commit 2626cc4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ version next:
- ffmpeg -shortest option is now per-output file
- volume measurement filter
- Ut Video encoder
- Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP
instead of AV_CODEC_ID_TEXT


version 0.11:
Expand Down
1 change: 1 addition & 0 deletions libavformat/matroska.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const CodecTags ff_mkv_codec_tags[]={
{"A_VORBIS" , AV_CODEC_ID_VORBIS},
{"A_WAVPACK4" , AV_CODEC_ID_WAVPACK},

{"S_TEXT/UTF8" , AV_CODEC_ID_SUBRIP},
{"S_TEXT/UTF8" , AV_CODEC_ID_TEXT},
{"S_TEXT/UTF8" , AV_CODEC_ID_SRT},
{"S_TEXT/ASCII" , AV_CODEC_ID_TEXT},
Expand Down
2 changes: 1 addition & 1 deletion libavformat/matroskadec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
else
pkt->pts = timecode;
pkt->pos = pos;
if (st->codec->codec_id == AV_CODEC_ID_TEXT)
if (st->codec->codec_id == AV_CODEC_ID_SUBRIP)
pkt->convergence_duration = lace_duration;
else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
pkt->duration = lace_duration;
Expand Down

0 comments on commit 2626cc4

Please sign in to comment.