[FFmpeg-devel] [PATCH v2 3/3] avformat/movenc: add support for fragmented TTML muxing

Jan Ekström jeebjp at gmail.com
Fri Sep 15 16:17:00 EEST 2023


From: Jan Ekström <jan.ekstrom at 24i.com>

Attempts to base the fragmentation timing on other streams
as most receivers expect media fragments to be more or less
aligned.

Currently does not support fragmentation on subtitle track
only, as the subtitle packet queue timings would have to be
checked in addition to the current fragmentation timing logic.

Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>
---
 libavformat/movenc.c                        |    9 -
 libavformat/movenc_ttml.c                   |  157 ++-
 tests/fate/mov.mak                          |   21 +
 tests/ref/fate/mov-mp4-fragmented-ttml-dfxp | 1197 +++++++++++++++++++
 tests/ref/fate/mov-mp4-fragmented-ttml-stpp | 1197 +++++++++++++++++++
 5 files changed, 2568 insertions(+), 13 deletions(-)
 create mode 100644 tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
 create mode 100644 tests/ref/fate/mov-mp4-fragmented-ttml-stpp

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ab92263cd7..aac9a588dd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7312,15 +7312,6 @@ static int mov_init(AVFormatContext *s)
                 track->squash_fragment_samples_to_one =
                     ff_is_ttml_stream_paragraph_based(track->par);
 
-                if (mov->flags & FF_MOV_FLAG_FRAGMENT &&
-                    track->squash_fragment_samples_to_one) {
-                    av_log(s, AV_LOG_ERROR,
-                           "Fragmentation is not currently supported for "
-                           "TTML in MP4/ISMV (track synchronization between "
-                           "subtitles and other media is not yet implemented)!\n");
-                    return AVERROR_PATCHWELCOME;
-                }
-
                 if (track->mode != MODE_ISM &&
                     track->par->codec_tag == MOV_ISMV_TTML_TAG &&
                     s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
diff --git a/libavformat/movenc_ttml.c b/libavformat/movenc_ttml.c
index 6deae49657..2aefb0b6c3 100644
--- a/libavformat/movenc_ttml.c
+++ b/libavformat/movenc_ttml.c
@@ -54,6 +54,50 @@ static int mov_init_ttml_writer(MOVTrack *track, AVFormatContext **out_ctx)
     return 0;
 }
 
+static void mov_calculate_start_and_end_of_other_tracks(
+    AVFormatContext *s, MOVTrack *track, int64_t *start_pts, int64_t *end_pts)
+{
+    MOVMuxContext *mov = s->priv_data;
+
+    // Initialize at the end of the previous document/fragment, which is NOPTS
+    // until the first fragment is created.
+    int64_t max_track_end_dts = *start_pts = track->end_pts;
+
+    for (unsigned int i = 0; i < s->nb_streams; i++) {
+        MOVTrack *other_track = &mov->tracks[i];
+
+        // Skip our own track, any other track that needs squashing,
+        // or any track which still has its start_dts at NOPTS or
+        // any track that did not yet get any packets.
+        if (track == other_track ||
+            other_track->squash_fragment_samples_to_one ||
+            other_track->start_dts == AV_NOPTS_VALUE ||
+            !other_track->entry) {
+            continue;
+        }
+
+        {
+            int64_t picked_start = av_rescale_q_rnd(other_track->cluster[0].dts + other_track->cluster[0].cts,
+                                                    other_track->st->time_base,
+                                                    track->st->time_base,
+                                                    AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
+            int64_t picked_end   = av_rescale_q_rnd(other_track->end_pts,
+                                                    other_track->st->time_base,
+                                                    track->st->time_base,
+                                                    AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
+
+            if (*start_pts == AV_NOPTS_VALUE)
+                *start_pts = picked_start;
+            else if (picked_start >= track->end_pts)
+                *start_pts = FFMIN(*start_pts, picked_start);
+
+            max_track_end_dts = FFMAX(max_track_end_dts, picked_end);
+        }
+    }
+
+    *end_pts = max_track_end_dts;
+}
+
 static int mov_write_ttml_document_from_queue(AVFormatContext *s,
                                               AVFormatContext *ttml_ctx,
                                               MOVTrack *track,
@@ -65,13 +109,85 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
     int64_t start_ts = track->start_dts == AV_NOPTS_VALUE ?
                        0 : (track->start_dts + track->track_duration);
     int64_t end_ts   = start_ts;
+    unsigned int time_limited = 0;
+    PacketList back_to_queue_list = { 0 };
+
+    if (*out_start_ts != AV_NOPTS_VALUE) {
+        // we have non-nopts values here, thus we have been given a time range
+        time_limited = 1;
+        start_ts = *out_start_ts;
+        end_ts   = *out_start_ts + *out_duration;
+    }
 
     if ((ret = avformat_write_header(ttml_ctx, NULL)) < 0) {
         return ret;
     }
 
     while (!avpriv_packet_list_get(&track->squashed_packet_queue, pkt)) {
-        end_ts = FFMAX(end_ts, pkt->pts + pkt->duration);
+        int64_t pts_before      = pkt->pts;
+        int64_t duration_before = pkt->duration;
+
+        if (time_limited) {
+            // special cases first:
+            if (pkt->pts + pkt->duration < start_ts) {
+                // too late for our fragment, unfortunately
+                // unref and proceed to next packet in queue.
+                av_log(s, AV_LOG_WARNING,
+                       "Very late TTML packet in queue, dropping packet with "
+                       "pts: %"PRId64", duration: %"PRId64"\n",
+                       pkt->pts, pkt->duration);
+                av_packet_unref(pkt);
+                continue;
+            } else if (pkt->pts >= end_ts) {
+                // starts after this fragment, put back to original queue
+                ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+                                             pkt, av_packet_ref,
+                                             FF_PACKETLIST_FLAG_PREPEND);
+                if (ret < 0)
+                    goto cleanup;
+
+                break;
+            }
+
+            // limit packet pts to start_ts
+            if (pkt->pts < start_ts) {
+                pkt->duration -= start_ts - pkt->pts;
+                pkt->pts = start_ts;
+            }
+
+            if (pkt->pts + pkt->duration > end_ts) {
+                // goes over our current fragment, create duplicate and
+                // put it back to list after iteration has finished in
+                // order to handle multiple subtitles at the same time.
+                int64_t offset = end_ts - pkt->pts;
+
+                ret = avpriv_packet_list_put(&back_to_queue_list,
+                                             pkt, av_packet_ref,
+                                             FF_PACKETLIST_FLAG_PREPEND);
+                if (ret < 0)
+                    goto cleanup;
+
+                back_to_queue_list.head->pkt.pts =
+                back_to_queue_list.head->pkt.dts =
+                back_to_queue_list.head->pkt.pts + offset;
+                back_to_queue_list.head->pkt.duration -= offset;
+
+                // and for our normal packet we just set duration to offset
+                pkt->duration = offset;
+            }
+        } else {
+            end_ts = FFMAX(end_ts, pkt->pts + pkt->duration);
+        }
+
+        av_log(s, AV_LOG_TRACE,
+               "TTML packet writeout: pts: %"PRId64" (%"PRId64"), "
+               "duration: %"PRId64"\n",
+               pkt->pts, pkt->pts - start_ts, pkt->duration);
+        if (pkt->pts != pts_before || pkt->duration != duration_before) {
+            av_log(s, AV_LOG_TRACE,
+                   "Adjustments: pts: %"PRId64", duration: %"PRId64"\n",
+                   pkt->pts - pts_before, pkt->duration - duration_before);
+        }
 
         // in case of the 'dfxp' muxing mode, each written document is offset
         // to its containing sample's beginning.
@@ -100,15 +216,30 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s,
     ret = 0;
 
 cleanup:
+    while (!avpriv_packet_list_get(&back_to_queue_list, pkt)) {
+        ret = avpriv_packet_list_put(&track->squashed_packet_queue,
+                                     pkt, av_packet_ref,
+                                     FF_PACKETLIST_FLAG_PREPEND);
+
+        // unrelated to whether we succeed or not, we unref the packet
+        // received from the temporary list.
+        av_packet_unref(pkt);
+
+        if (ret < 0) {
+            avpriv_packet_list_free(&back_to_queue_list);
+            break;
+        }
+    }
     return ret;
 }
 
 int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s,
                                          MOVTrack *track, AVPacket *pkt)
 {
+    MOVMuxContext *mov = s->priv_data;
     AVFormatContext *ttml_ctx = NULL;
     // values for the generated AVPacket
-    int64_t start_ts = 0;
+    int64_t start_ts = AV_NOPTS_VALUE;
     int64_t duration = 0;
 
     int ret = AVERROR_BUG;
@@ -119,12 +250,30 @@ int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s,
         goto cleanup;
     }
 
+    if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
+        int64_t calculated_start = AV_NOPTS_VALUE;
+        int64_t calculated_end = AV_NOPTS_VALUE;
+
+        mov_calculate_start_and_end_of_other_tracks(s, track, &calculated_start, &calculated_end);
+
+        if (calculated_start != AV_NOPTS_VALUE) {
+            start_ts = calculated_start;
+            duration = calculated_end - calculated_start;
+            av_log(s, AV_LOG_VERBOSE,
+                   "Calculated subtitle fragment start: %"PRId64", "
+                   "duration: %"PRId64"\n",
+                   start_ts, duration);
+        }
+    }
+
     if (!track->squashed_packet_queue.head) {
         // empty queue, write minimal empty document with zero duration
         avio_write(ttml_ctx->pb, empty_ttml_document,
                    sizeof(empty_ttml_document) - 1);
-        start_ts = 0;
-        duration = 0;
+        if (start_ts == AV_NOPTS_VALUE) {
+            start_ts = 0;
+            duration = 0;
+        }
         goto generate_packet;
     }
 
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 6cb493ceab..5c44299196 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -143,6 +143,27 @@ FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, TTML SUBRIP, MP4 MOV, SRT_DEMUXER TTML
 fate-mov-mp4-ttml-stpp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml -time_base:s 1:1000" "-map 0 -c copy" "-of json -show_entries packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 fate-mov-mp4-ttml-dfxp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 "-map 0:s -c:s ttml -time_base:s 1:1000 -tag:s dfxp -strict unofficial" "-map 0 -c copy" "-of json -show_entries packet:stream=index,codec_type,codec_tag_string,codec_tag,codec_name,time_base,start_time,duration_ts,duration,nb_frames,nb_read_packets:stream_tags"
 
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, TTML SUBRIP, MP4 MOV, LAVFI_INDEV SMPTEHDBARS_FILTER SRT_DEMUXER MPEG2VIDEO_ENCODER TTML_MUXER RAWVIDEO_MUXER) += fate-mov-mp4-fragmented-ttml-stpp
+fate-mov-mp4-fragmented-ttml-stpp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt mp4 \
+  "-map 1:v -map 0:s \
+   -c:v mpeg2video -b:v 2M -g 48 -sc_threshold 1000000000 \
+   -c:s ttml -time_base:s 1:1000 \
+   -movflags +cmaf" \
+  "-map 0:s -c copy" \
+  "-select_streams s -of csv -show_packets -show_data_hash crc32" \
+  "-f lavfi -i smptehdbars=duration=70:size=320x180:rate=24000/1001,format=yuv420p" \
+  "" "" "rawvideo"
+
+FATE_MOV_FFMPEG_FFPROBE-$(call TRANSCODE, TTML SUBRIP, ISMV MOV, LAVFI_INDEV SMPTEHDBARS_FILTER SRT_DEMUXER MPEG2VIDEO_ENCODER TTML_MUXER RAWVIDEO_MUXER) += fate-mov-mp4-fragmented-ttml-dfxp
+fate-mov-mp4-fragmented-ttml-dfxp: CMD = transcode srt $(TARGET_SAMPLES)/sub/SubRip_capability_tester.srt ismv \
+  "-map 1:v -map 0:s \
+   -c:v mpeg2video -b:v 2M -g 48 -sc_threshold 1000000000 \
+   -c:s ttml -tag:s dfxp -time_base:s 1:1000" \
+  "-map 0:s -c copy" \
+  "-select_streams s -of csv -show_packets -show_data_hash crc32" \
+  "-f lavfi -i smptehdbars=duration=70:size=320x180:rate=24000/1001,format=yuv420p" \
+  "" "" "rawvideo"
+
 # FIXME: Uncomment these two tests once the test files are uploaded to the fate
 # server.
 # avif demuxing - still image with 1 item.
diff --git a/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp b/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
new file mode 100644
index 0000000000..45da22814a
--- /dev/null
+++ b/tests/ref/fate/mov-mp4-fragmented-ttml-dfxp
@@ -0,0 +1,1197 @@
+14998bfa7c79edf90c4280cd957bf47e *tests/data/fate/mov-mp4-fragmented-ttml-dfxp.ismv
+518859 tests/data/fate/mov-mp4-fragmented-ttml-dfxp.ismv
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.000"><span region="Default">Don't show this text it may be used to insert hidden data</span></p>
+      <p
+        begin="00:00:01.500"
+        end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.496"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+      <p
+        begin="00:00:00.496"
+        end="00:00:00.496"><span region="Default">Hidden</span></p>
+      <p
+        begin="00:00:00.497"
+        end="00:00:02.002"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.494"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+      <p
+        begin="00:00:01.495"
+        end="00:00:02.002"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.490"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+      <p
+        begin="00:00:01.491"
+        end="00:00:02.002"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.486"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+      <p
+        begin="00:00:00.487"
+        end="00:00:02.002"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.484"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+      <p
+        begin="00:00:01.485"
+        end="00:00:02.002"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.480"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+      <p
+        begin="00:00:00.481"
+        end="00:00:01.480"><span region="Default">This text should be in the normal position...</span></p>
+      <p
+        begin="00:00:01.481"
+        end="00:00:02.002"><span region="Default">This text should NOT be in the normal position</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.478"><span region="Default">This text should NOT be in the normal position</span></p>
+      <p
+        begin="00:00:00.479"
+        end="00:00:02.002"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+      <p
+        begin="00:00:00.479"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+      <p
+        begin="00:00:00.479"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.476"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.476"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.476"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+      <p
+        begin="00:00:00.477"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+      <p
+        begin="00:00:00.477"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+      <p
+        begin="00:00:00.477"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.474"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.474"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.474"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+      <p
+        begin="00:00:00.475"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>top and horizontally at the right</span></p>
+      <p
+        begin="00:00:00.475"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>middle and horizontally at the right</span></p>
+      <p
+        begin="00:00:00.475"
+        end="00:00:02.002"><span region="Default">This text should be at the<br/>bottom and horizontally at the right</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.472"><span region="Default">This text should be at the<br/>top and horizontally at the right</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.472"><span region="Default">This text should be at the<br/>middle and horizontally at the right</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.472"><span region="Default">This text should be at the<br/>bottom and horizontally at the right</span></p>
+      <p
+        begin="00:00:00.473"
+        end="00:00:02.002"><span region="Default">This could be the most difficult thing to implement</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.470"><span region="Default">This could be the most difficult thing to implement</span></p>
+      <p
+        begin="00:00:01.471"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:01.468"
+        end="00:00:02.002"><span region="Default">Second, it shouldn't overlap first</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.466"><span region="Default">Second, it shouldn't overlap first</span></p>
+      <p
+        begin="00:00:01.467"
+        end="00:00:02.002"><span region="Default">Third, it should replace second</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.464"><span region="Default">Third, it should replace second</span></p>
+      <p
+        begin="00:00:00.465"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.461"
+        end="00:00:02.002"><span region="Default">Fifth, it should replace third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fifth, it should replace third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:01.456"><span region="Default">Fifth, it should replace third</span></p>
+      <p
+        begin="00:00:01.457"
+        end="00:00:02.002"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.450"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.450"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.450"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+      <p
+        begin="00:00:00.451"
+        end="00:00:02.002"><span region="Default">TEXT 1 (bottom)</span></p>
+      <p
+        begin="00:00:00.451"
+        end="00:00:02.002"><span region="Default">text 2</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.448"><span region="Default">TEXT 1 (bottom)</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.448"><span region="Default">text 2</span></p>
+      <p
+        begin="00:00:00.449"
+        end="00:00:02.002"><span region="Default">Hide these tags:<br/>also hide these tags:<br/>but show this: {normal text}</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.446"><span region="Default">Hide these tags:<br/>also hide these tags:<br/>but show this: {normal text}</span></p>
+      <p
+        begin="00:00:00.447"
+        end="00:00:02.002"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:00.447"
+        end="00:00:02.002"><span region="Default"><br/>\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.444"><span region="Default"><br/>\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)</span></p>
+      <p
+        begin="00:00:00.445"
+        end="00:00:02.002"><span region="Default">\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)<br/>Show this: \TEST and this: \-)</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:02.002"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.442"><span region="Default">\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)<br/>Show this: \TEST and this: \-)</span></p>
+      <p
+        begin="00:00:00.443"
+        end="00:00:02.002"><span region="Default"><br/>A letter followed by 05 hard spaces: A\h\h\h\h\h<br/>A letter followed by normal  spaces: A<br/>A letter followed by no hard spaces: A<br/>05 hard  spaces between letters: A\h\h\h\h\hA<br/>5 normal spaces between letters: A     A<br/><br/>^--Forced line break</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.440"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.440"><span region="Default"><br/>A letter followed by 05 hard spaces: A\h\h\h\h\h<br/>A letter followed by normal  spaces: A<br/>A letter followed by no hard spaces: A<br/>05 hard  spaces between letters: A\h\h\h\h\hA<br/>5 normal spaces between letters: A     A<br/><br/>^--Forced line break</span></p>
+      <p
+        begin="00:00:00.441"
+        end="00:00:02.002"><span region="Default">Both line should be strikethrough,<br/>yes.<br/>Correctly closed tags<br/>should be hidden.</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.438"><span region="Default">Both line should be strikethrough,<br/>yes.<br/>Correctly closed tags<br/>should be hidden.</span></p>
+      <p
+        begin="00:00:00.439"
+        end="00:00:02.002"><span region="Default">It shouldn't be strikethrough,<br/>not opened tag showed as text.<br/>Not opened tag showed as text.</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.436"><span region="Default">It shouldn't be strikethrough,<br/>not opened tag showed as text.<br/>Not opened tag showed as text.</span></p>
+      <p
+        begin="00:00:00.437"
+        end="00:00:02.002"><span region="Default">Three lines should be strikethrough,<br/>yes.<br/>Not closed tags showed as text</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.434"><span region="Default">Three lines should be strikethrough,<br/>yes.<br/>Not closed tags showed as text</span></p>
+      <p
+        begin="00:00:00.435"
+        end="00:00:02.002"><span region="Default">Both line should be strikethrough but<br/>the wrong closing tag should be showed</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.432"><span region="Default">Both line should be strikethrough but<br/>the wrong closing tag should be showed</span></p>
+    </div>
+  </body>
+</tt>
+packet,subtitle,1,0,0.000000,0,0.000000,N/A,N/A,1172,14746,K__,CRC32:bde7afa1
+packet,subtitle,1,20020000,2.002000,20020000,2.002000,N/A,N/A,1015,29540,K__,CRC32:c1cb78f2
+packet,subtitle,1,40040000,4.004000,40040000,4.004000,N/A,N/A,1305,44177,K__,CRC32:267b17fe
+packet,subtitle,1,60060000,6.006000,60060000,6.006000,N/A,N/A,1111,59104,K__,CRC32:d6aaf284
+packet,subtitle,1,80080000,8.008000,80080000,8.008000,N/A,N/A,927,73837,K__,CRC32:0ee24ad7
+packet,subtitle,1,100100000,10.010000,100100000,10.010000,N/A,N/A,1194,88386,K__,CRC32:a9816515
+packet,subtitle,1,120120000,12.012000,120120000,12.012000,N/A,N/A,874,103202,K__,CRC32:c47ebb4e
+packet,subtitle,1,140140000,14.014000,140140000,14.014000,N/A,N/A,1154,117698,K__,CRC32:09b26179
+packet,subtitle,1,160160000,16.016000,160160000,16.016000,N/A,N/A,1240,132474,K__,CRC32:d7e3067e
+packet,subtitle,1,180180000,18.018000,180180000,18.018000,N/A,N/A,960,147336,K__,CRC32:d2d99797
+packet,subtitle,1,200200000,20.020000,200200000,20.020000,N/A,N/A,1251,161918,K__,CRC32:1857892c
+packet,subtitle,1,220220000,22.022000,220220000,22.022000,N/A,N/A,1285,176791,K__,CRC32:76bd9787
+packet,subtitle,1,240240000,24.024000,240240000,24.024000,N/A,N/A,1676,191698,K__,CRC32:1f7cdb75
+packet,subtitle,1,260260000,26.026000,260260000,26.026000,N/A,N/A,1642,206996,K__,CRC32:8fbd701c
+packet,subtitle,1,280280000,28.028000,280280000,28.028000,N/A,N/A,1256,222260,K__,CRC32:2f4ea18e
+packet,subtitle,1,300300000,30.030000,300300000,30.030000,N/A,N/A,868,237138,K__,CRC32:30e6b1f0
+packet,subtitle,1,320320000,32.032000,320320000,32.032000,N/A,N/A,851,251628,K__,CRC32:b806d7ef
+packet,subtitle,1,340340000,34.034000,340340000,34.034000,N/A,N/A,982,266101,K__,CRC32:7f9ea9df
+packet,subtitle,1,360360000,36.036000,360360000,36.036000,N/A,N/A,992,280705,K__,CRC32:024a8bf4
+packet,subtitle,1,380380000,38.038000,380380000,38.038000,N/A,N/A,861,295319,K__,CRC32:d8e3a883
+packet,subtitle,1,400400000,40.040000,400400000,40.040000,N/A,N/A,991,309802,K__,CRC32:cae99334
+packet,subtitle,1,420420000,42.042000,420420000,42.042000,N/A,N/A,991,324415,K__,CRC32:50c2ead7
+packet,subtitle,1,440440000,44.044000,440440000,44.044000,N/A,N/A,1135,339028,K__,CRC32:cc0850dc
+packet,subtitle,1,460460000,46.046000,460460000,46.046000,N/A,N/A,1005,353785,K__,CRC32:807f794c
+packet,subtitle,1,480480000,48.048000,480480000,48.048000,N/A,N/A,1005,368412,K__,CRC32:807f794c
+packet,subtitle,1,500500000,50.050000,500500000,50.050000,N/A,N/A,1226,383039,K__,CRC32:805264b5
+packet,subtitle,1,520520000,52.052000,520520000,52.052000,N/A,N/A,1003,397887,K__,CRC32:79adb2a6
+packet,subtitle,1,540540000,54.054000,540540000,54.054000,N/A,N/A,1381,412512,K__,CRC32:ac83ebab
+packet,subtitle,1,560560000,56.056000,560560000,56.056000,N/A,N/A,1478,427515,K__,CRC32:23a2eb37
+packet,subtitle,1,580580000,58.058000,580580000,58.058000,N/A,N/A,1600,442615,K__,CRC32:4e8548fa
+packet,subtitle,1,600600000,60.060000,600600000,60.060000,N/A,N/A,1519,457837,K__,CRC32:1ee4bd57
+packet,subtitle,1,620620000,62.062000,620620000,62.062000,N/A,N/A,998,472978,K__,CRC32:5cabdc39
+packet,subtitle,1,640640000,64.064000,640640000,64.064000,N/A,N/A,987,487598,K__,CRC32:498ffc7d
+packet,subtitle,1,660660000,66.066000,660660000,66.066000,N/A,N/A,967,502207,K__,CRC32:3c04c24d
+packet,subtitle,1,680680000,68.068000,680680000,68.068000,N/A,N/A,787,516670,K__,CRC32:0896b651
diff --git a/tests/ref/fate/mov-mp4-fragmented-ttml-stpp b/tests/ref/fate/mov-mp4-fragmented-ttml-stpp
new file mode 100644
index 0000000000..08f82851a9
--- /dev/null
+++ b/tests/ref/fate/mov-mp4-fragmented-ttml-stpp
@@ -0,0 +1,1197 @@
+7fe87826c79323c7c97a14021686bd54 *tests/data/fate/mov-mp4-fragmented-ttml-stpp.mp4
+503191 tests/data/fate/mov-mp4-fragmented-ttml-stpp.mp4
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:00.000"
+        end="00:00:00.000"><span region="Default">Don't show this text it may be used to insert hidden data</span></p>
+      <p
+        begin="00:00:01.500"
+        end="00:00:02.002"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:02.002"
+        end="00:00:04.004"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:04.004"
+        end="00:00:04.500"><span region="Default">SubRip subtitles capability tester 1.3o by ale5000<br/>Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others<br/>This text should be blue<br/>This text should be red<br/>This text should be black<br/>If you see this with the normal font, the player don't (fully) support font face</span></p>
+      <p
+        begin="00:00:04.500"
+        end="00:00:04.500"><span region="Default">Hidden</span></p>
+      <p
+        begin="00:00:04.501"
+        end="00:00:06.006"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:06.006"
+        end="00:00:07.500"><span region="Default">This text should be small<br/>This text should be normal<br/>This text should be big</span></p>
+      <p
+        begin="00:00:07.501"
+        end="00:00:08.008"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:08.008"
+        end="00:00:10.010"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:10.010"
+        end="00:00:11.500"><span region="Default">This should be an E with an accent: È<br/>日本語<br/>This text should be bold, italics and underline<br/>This text should be small and green<br/>This text should be small and red<br/>This text should be big and brown</span></p>
+      <p
+        begin="00:00:11.501"
+        end="00:00:12.012"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:12.012"
+        end="00:00:14.014"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:14.014"
+        end="00:00:14.500"><span region="Default">This line should be bold<br/>This line should be italics<br/>This line should be underline<br/>This line should be strikethrough<br/>Both lines<br/>should be underline</span></p>
+      <p
+        begin="00:00:14.501"
+        end="00:00:16.016"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:16.016"
+        end="00:00:17.500"><span region="Default">><br/>It would be a good thing to<br/>hide invalid html tags that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>Show not opened tags<br/><</span></p>
+      <p
+        begin="00:00:17.501"
+        end="00:00:18.018"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:18.018"
+        end="00:00:20.020"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:20.020"
+        end="00:00:20.500"><span region="Default">and also<br/>hide invalid html tags with parameters that are closed and show the text in them<br/>but show un-closed invalid html tags<br/>This text should be showed underlined without problems also: 2<3,5>1,4<6<br/>This shouldn't be underlined</span></p>
+      <p
+        begin="00:00:20.501"
+        end="00:00:21.500"><span region="Default">This text should be in the normal position...</span></p>
+      <p
+        begin="00:00:21.501"
+        end="00:00:22.022"><span region="Default">This text should NOT be in the normal position</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:22.022"
+        end="00:00:22.500"><span region="Default">This text should NOT be in the normal position</span></p>
+      <p
+        begin="00:00:22.501"
+        end="00:00:24.024"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+      <p
+        begin="00:00:22.502"
+        end="00:00:24.024"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+      <p
+        begin="00:00:22.503"
+        end="00:00:24.024"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:24.024"
+        end="00:00:24.500"><span region="Default">Implementation is the same of the ASS tag<br/>This text should be at the<br/>top and horizontally centered</span></p>
+      <p
+        begin="00:00:24.024"
+        end="00:00:24.501"><span region="Default">This text should be at the<br/>middle and horizontally centered</span></p>
+      <p
+        begin="00:00:24.024"
+        end="00:00:24.502"><span region="Default">This text should be at the<br/>bottom and horizontally centered</span></p>
+      <p
+        begin="00:00:24.501"
+        end="00:00:26.026"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+      <p
+        begin="00:00:24.502"
+        end="00:00:26.026"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+      <p
+        begin="00:00:24.503"
+        end="00:00:26.026"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:26.026"
+        end="00:00:26.500"><span region="Default">This text should be at the<br/>top and horizontally at the left</span></p>
+      <p
+        begin="00:00:26.026"
+        end="00:00:26.501"><span region="Default">This text should be at the<br/>middle and horizontally at the left<br/>(The second position must be ignored)</span></p>
+      <p
+        begin="00:00:26.026"
+        end="00:00:26.502"><span region="Default">This text should be at the<br/>bottom and horizontally at the left</span></p>
+      <p
+        begin="00:00:26.501"
+        end="00:00:28.028"><span region="Default">This text should be at the<br/>top and horizontally at the right</span></p>
+      <p
+        begin="00:00:26.502"
+        end="00:00:28.028"><span region="Default">This text should be at the<br/>middle and horizontally at the right</span></p>
+      <p
+        begin="00:00:26.503"
+        end="00:00:28.028"><span region="Default">This text should be at the<br/>bottom and horizontally at the right</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:28.028"
+        end="00:00:28.500"><span region="Default">This text should be at the<br/>top and horizontally at the right</span></p>
+      <p
+        begin="00:00:28.028"
+        end="00:00:28.501"><span region="Default">This text should be at the<br/>middle and horizontally at the right</span></p>
+      <p
+        begin="00:00:28.028"
+        end="00:00:28.502"><span region="Default">This text should be at the<br/>bottom and horizontally at the right</span></p>
+      <p
+        begin="00:00:28.501"
+        end="00:00:30.030"><span region="Default">This could be the most difficult thing to implement</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:30.030"
+        end="00:00:31.500"><span region="Default">This could be the most difficult thing to implement</span></p>
+      <p
+        begin="00:00:31.501"
+        end="00:00:32.032"><span region="Default">First text</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:32.032"
+        end="00:00:34.034"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:33.500"
+        end="00:00:34.034"><span region="Default">Second, it shouldn't overlap first</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:34.034"
+        end="00:00:36.036"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:34.034"
+        end="00:00:35.500"><span region="Default">Second, it shouldn't overlap first</span></p>
+      <p
+        begin="00:00:35.501"
+        end="00:00:36.036"><span region="Default">Third, it should replace second</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:36.036"
+        end="00:00:38.038"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:36.036"
+        end="00:00:37.500"><span region="Default">Third, it should replace second</span></p>
+      <p
+        begin="00:00:36.501"
+        end="00:00:38.038"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:38.038"
+        end="00:00:40.040"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:38.038"
+        end="00:00:40.040"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:40.040"
+        end="00:00:42.042"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:40.040"
+        end="00:00:42.042"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:40.501"
+        end="00:00:42.042"><span region="Default">Fifth, it should replace third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:42.042"
+        end="00:00:44.044"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:42.042"
+        end="00:00:44.044"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:42.042"
+        end="00:00:44.044"><span region="Default">Fifth, it should replace third</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:44.044"
+        end="00:00:46.046"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:44.044"
+        end="00:00:46.046"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:44.044"
+        end="00:00:45.500"><span region="Default">Fifth, it should replace third</span></p>
+      <p
+        begin="00:00:45.501"
+        end="00:00:46.046"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:46.046"
+        end="00:00:48.048"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:46.046"
+        end="00:00:48.048"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:46.046"
+        end="00:00:48.048"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:48.048"
+        end="00:00:50.050"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:48.048"
+        end="00:00:50.050"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:48.048"
+        end="00:00:50.050"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:50.050"
+        end="00:00:50.500"><span region="Default">First text</span></p>
+      <p
+        begin="00:00:50.050"
+        end="00:00:50.500"><span region="Default">Fourth, it shouldn't overlap first and third</span></p>
+      <p
+        begin="00:00:50.050"
+        end="00:00:50.500"><span region="Default">Sixth, it shouldn't be<br/>showed overlapped</span></p>
+      <p
+        begin="00:00:50.501"
+        end="00:00:52.052"><span region="Default">TEXT 1 (bottom)</span></p>
+      <p
+        begin="00:00:50.502"
+        end="00:00:52.052"><span region="Default">text 2</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:52.052"
+        end="00:00:52.500"><span region="Default">TEXT 1 (bottom)</span></p>
+      <p
+        begin="00:00:52.052"
+        end="00:00:52.501"><span region="Default">text 2</span></p>
+      <p
+        begin="00:00:52.501"
+        end="00:00:54.054"><span region="Default">Hide these tags:<br/>also hide these tags:<br/>but show this: {normal text}</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:54.054"
+        end="00:00:54.500"><span region="Default">Hide these tags:<br/>also hide these tags:<br/>but show this: {normal text}</span></p>
+      <p
+        begin="00:00:54.501"
+        end="00:00:56.056"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:54.502"
+        end="00:00:56.056"><span region="Default"><br/>\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:56.056"
+        end="00:00:58.058"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:56.056"
+        end="00:00:56.501"><span region="Default"><br/>\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)</span></p>
+      <p
+        begin="00:00:56.501"
+        end="00:00:58.058"><span region="Default">\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)<br/>Show this: \TEST and this: \-)</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:00:58.058"
+        end="00:01:00.060"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:00:58.058"
+        end="00:00:58.500"><span region="Default">\h\h\h\h\hA (05 hard spaces followed by a letter)<br/>A (Normal  spaces followed by a letter)<br/>A (No hard spaces followed by a letter)<br/>Show this: \TEST and this: \-)</span></p>
+      <p
+        begin="00:00:58.501"
+        end="00:01:00.060"><span region="Default"><br/>A letter followed by 05 hard spaces: A\h\h\h\h\h<br/>A letter followed by normal  spaces: A<br/>A letter followed by no hard spaces: A<br/>05 hard  spaces between letters: A\h\h\h\h\hA<br/>5 normal spaces between letters: A     A<br/><br/>^--Forced line break</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:01:00.060"
+        end="00:01:00.500"><span region="Default"><br/>\ N is a forced line break<br/>\ h is a hard space<br/>Normal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.<br/>The\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D</span></p>
+      <p
+        begin="00:01:00.060"
+        end="00:01:00.500"><span region="Default"><br/>A letter followed by 05 hard spaces: A\h\h\h\h\h<br/>A letter followed by normal  spaces: A<br/>A letter followed by no hard spaces: A<br/>05 hard  spaces between letters: A\h\h\h\h\hA<br/>5 normal spaces between letters: A     A<br/><br/>^--Forced line break</span></p>
+      <p
+        begin="00:01:00.501"
+        end="00:01:02.062"><span region="Default">Both line should be strikethrough,<br/>yes.<br/>Correctly closed tags<br/>should be hidden.</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:01:02.062"
+        end="00:01:02.500"><span region="Default">Both line should be strikethrough,<br/>yes.<br/>Correctly closed tags<br/>should be hidden.</span></p>
+      <p
+        begin="00:01:02.501"
+        end="00:01:04.064"><span region="Default">It shouldn't be strikethrough,<br/>not opened tag showed as text.<br/>Not opened tag showed as text.</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:01:04.064"
+        end="00:01:04.500"><span region="Default">It shouldn't be strikethrough,<br/>not opened tag showed as text.<br/>Not opened tag showed as text.</span></p>
+      <p
+        begin="00:01:04.501"
+        end="00:01:06.066"><span region="Default">Three lines should be strikethrough,<br/>yes.<br/>Not closed tags showed as text</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:01:06.066"
+        end="00:01:06.500"><span region="Default">Three lines should be strikethrough,<br/>yes.<br/>Not closed tags showed as text</span></p>
+      <p
+        begin="00:01:06.501"
+        end="00:01:08.068"><span region="Default">Both line should be strikethrough but<br/>the wrong closing tag should be showed</span></p>
+    </div>
+  </body>
+</tt>
+<?xml version="1.0" encoding="utf-8"?>
+<tt
+  xmlns="http://www.w3.org/ns/ttml"
+  xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
+  xmlns:tts="http://www.w3.org/ns/ttml#styling"
+  xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
+  ttp:cellResolution="384 288"
+  xml:lang="">
+  <head>
+    <layout>
+      <region xml:id="Default"
+        tts:origin="3% 0%"
+        tts:extent="97% 97%"
+        tts:displayAlign="after"
+        tts:textAlign="center"
+        tts:fontSize="16c"
+        tts:fontFamily="Arial"
+        tts:overflow="visible" />
+    </layout>
+  </head>
+  <body>
+    <div>
+      <p
+        begin="00:01:08.068"
+        end="00:01:08.500"><span region="Default">Both line should be strikethrough but<br/>the wrong closing tag should be showed</span></p>
+    </div>
+  </body>
+</tt>
+packet,subtitle,1,0,0.000000,0,0.000000,N/A,N/A,1172,14302,K__,CRC32:bde7afa1
+packet,subtitle,1,2002,2.002000,2002,2.002000,N/A,N/A,1015,28648,K__,CRC32:bd3bd4bc
+packet,subtitle,1,4004,4.004000,4004,4.004000,N/A,N/A,1305,42837,K__,CRC32:c8ff5017
+packet,subtitle,1,6006,6.006000,6006,6.006000,N/A,N/A,1111,57316,K__,CRC32:f0b10da6
+packet,subtitle,1,8008,8.008000,8008,8.008000,N/A,N/A,927,71601,K__,CRC32:55a7bb1b
+packet,subtitle,1,10010,10.010000,10010,10.010000,N/A,N/A,1194,85702,K__,CRC32:03dc4753
+packet,subtitle,1,12012,12.012000,12012,12.012000,N/A,N/A,874,100070,K__,CRC32:c7a092d4
+packet,subtitle,1,14014,14.014000,14014,14.014000,N/A,N/A,1154,114118,K__,CRC32:b476fe9c
+packet,subtitle,1,16016,16.016000,16016,16.016000,N/A,N/A,1240,128446,K__,CRC32:912e694c
+packet,subtitle,1,18018,18.018000,18018,18.018000,N/A,N/A,960,142860,K__,CRC32:bba73912
+packet,subtitle,1,20020,20.020000,20020,20.020000,N/A,N/A,1251,156994,K__,CRC32:4c7b87d8
+packet,subtitle,1,22022,22.022000,22022,22.022000,N/A,N/A,1285,171419,K__,CRC32:c0368927
+packet,subtitle,1,24024,24.024000,24024,24.024000,N/A,N/A,1676,185878,K__,CRC32:9811b98f
+packet,subtitle,1,26026,26.026000,26026,26.026000,N/A,N/A,1642,200728,K__,CRC32:7965715d
+packet,subtitle,1,28028,28.028000,28028,28.028000,N/A,N/A,1256,215544,K__,CRC32:433e322a
+packet,subtitle,1,30030,30.030000,30030,30.030000,N/A,N/A,868,229974,K__,CRC32:20edc13a
+packet,subtitle,1,32032,32.032000,32032,32.032000,N/A,N/A,851,244016,K__,CRC32:a850ce43
+packet,subtitle,1,34034,34.034000,34034,34.034000,N/A,N/A,982,258041,K__,CRC32:ffdc63b7
+packet,subtitle,1,36036,36.036000,36036,36.036000,N/A,N/A,992,272197,K__,CRC32:9189e069
+packet,subtitle,1,38038,38.038000,38038,38.038000,N/A,N/A,861,286363,K__,CRC32:b7df1508
+packet,subtitle,1,40040,40.040000,40040,40.040000,N/A,N/A,991,300398,K__,CRC32:16ace16f
+packet,subtitle,1,42042,42.042000,42042,42.042000,N/A,N/A,991,314563,K__,CRC32:524854ca
+packet,subtitle,1,44044,44.044000,44044,44.044000,N/A,N/A,1135,328728,K__,CRC32:c51f8b6e
+packet,subtitle,1,46046,46.046000,46046,46.046000,N/A,N/A,1005,343037,K__,CRC32:e9b7c12f
+packet,subtitle,1,48048,48.048000,48048,48.048000,N/A,N/A,1005,357216,K__,CRC32:82c319d0
+packet,subtitle,1,50050,50.050000,50050,50.050000,N/A,N/A,1226,371395,K__,CRC32:c73960aa
+packet,subtitle,1,52052,52.052000,52052,52.052000,N/A,N/A,1003,385795,K__,CRC32:e435cc83
+packet,subtitle,1,54054,54.054000,54054,54.054000,N/A,N/A,1381,399972,K__,CRC32:99f63187
+packet,subtitle,1,56056,56.056000,56056,56.056000,N/A,N/A,1478,414527,K__,CRC32:4d110a91
+packet,subtitle,1,58058,58.058000,58058,58.058000,N/A,N/A,1600,429179,K__,CRC32:d3133412
+packet,subtitle,1,60060,60.060000,60060,60.060000,N/A,N/A,1519,443953,K__,CRC32:86713143
+packet,subtitle,1,62062,62.062000,62062,62.062000,N/A,N/A,998,458646,K__,CRC32:0badc63b
+packet,subtitle,1,64064,64.064000,64064,64.064000,N/A,N/A,987,472818,K__,CRC32:1771dfd4
+packet,subtitle,1,66066,66.066000,66066,66.066000,N/A,N/A,967,486979,K__,CRC32:0cb5eddc
+packet,subtitle,1,68068,68.068000,68068,68.068000,N/A,N/A,787,501002,K__,CRC32:2fe77499
-- 
2.41.0



More information about the ffmpeg-devel mailing list