[FFmpeg-devel] [PATCH 1/5] Metadata attribute passing in ASF

Vadim Belov vadim.belov at gmail.com
Wed Jul 1 13:27:30 CEST 2015


---
 ffmpeg.c                         |   7 ++-
 libavformat/asf.h                |   9 ++-
 libavformat/asfdec.c             |  32 +++++++++-
 libavformat/asfenc.c             |  60 ++++++++++++++++---
 libavformat/cache.c              |   6 +-
 libavformat/dashenc.c            |   6 +-
 libavformat/file.c               |   6 +-
 libavformat/hdsenc.c             |   6 +-
 libavformat/hlsenc.c             |   6 +-
 libavformat/smoothstreamingenc.c |   6 +-
 libavutil/file.c                 |   6 +-
 libavutil/file_open.c            |   6 +-
 libavutil/log.c                  |   6 +-
 libavutil/random_seed.c          |   6 +-
 libavutil/time.c                 |   6 +-
 tests/ref/fate/sub-aqtitle       |  90 ++++++++++++++--------------
 tests/ref/fate/sub-charenc       | 124 +++++++++++++++++++--------------------
 tests/ref/fate/sub-jacosub       |  46 +++++++--------
 tests/ref/fate/sub-microdvd      |  44 +++++++-------
 tests/ref/fate/sub-movtext       |  30 +++++-----
 tests/ref/fate/sub-mpl2          |  32 +++++-----
 tests/ref/fate/sub-mpsub         |  66 ++++++++++-----------
 tests/ref/fate/sub-mpsub-frames  |  28 ++++-----
 tests/ref/fate/sub-pjs           |  30 +++++-----
 tests/ref/fate/sub-realtext      |  34 +++++------
 tests/ref/fate/sub-sami          |  42 ++++++-------
 tests/ref/fate/sub-srt           |  98 +++++++++++++++----------------
 tests/ref/fate/sub-stl           |  58 +++++++++---------
 tests/ref/fate/sub-subripenc     |   4 +-
 tests/ref/fate/sub-subviewer     |  30 +++++-----
 tests/ref/fate/sub-subviewer1    |  44 +++++++-------
 tests/ref/fate/sub-vplayer       |  30 +++++-----
 tests/ref/fate/sub-webvtt        |  54 ++++++++---------
 33 files changed, 569 insertions(+), 489 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a89ae39..a3cca09 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -36,9 +36,6 @@
 #if HAVE_IO_H
 #include <io.h>
 #endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #endif
 
 #include "libavformat/avformat.h"
@@ -75,6 +72,10 @@
 #elif HAVE_GETPROCESSTIMES
 #include <windows.h>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #if HAVE_GETPROCESSMEMORYINFO
 #include <windows.h>
 #include <psapi.h>
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 0c9598a..6dce410 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -26,7 +26,11 @@
 #include "metadata.h"
 #include "riff.h"
 
-#define PACKET_SIZE 3200
+// Packet size according to the size that ACX File Creator writes to its output packets:
+// ASF_PACKET_SIZE is 8192, but in CASFFile::InitAsfPckt it is decremented! Most possibly by 100
+// Bottom line: in the ASF core file the value is 8032 
+#define PACKET_SIZE 8032 
+//#define PACKET_SIZE 3200
 
 typedef struct ASFPayload {
     uint8_t type;
@@ -189,4 +193,7 @@ extern const AVMetadataConv ff_asf_metadata_conv[];
 
 extern AVInputFormat ff_asf_demuxer;
 
+// TODO: move to .c ?
+#define DIRECTION_DICT_KEY "direction"
+
 #endif /* AVFORMAT_ASF_H */
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 359ee8b..bf4ef75 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -39,6 +39,8 @@
 #include "asf.h"
 #include "asfcrypt.h"
 
+#define NO_STREAM_DIRECTION -1
+
 typedef struct ASFContext {
     const AVClass *class;
     int asfid2avid[128];                 ///< conversion table from asf ID 2 AVStream ID
@@ -81,6 +83,10 @@ typedef struct ASFContext {
 
     int no_resync_search;
     int export_xmp;
+   int direction[128];
+   //AVRational direction[128];            ///< pair: num={ 0 = doesn't have direction, 1 = has direction }
+   //                                  ///<       den={ direction value }
+   
 } ASFContext;
 
 static const AVOption options[] = {
@@ -671,7 +677,9 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
             avio_skip(pb, name_len - ret);
         av_log(s, AV_LOG_TRACE, "%d stream %d name_len %2d type %d len %4d <%s>\n",
                 i, stream_num, name_len, value_type, value_len, name);
-
+       
+       asf->direction[stream_num] = NO_STREAM_DIRECTION;
+       
         if (!strcmp(name, "AspectRatioX")){
             int aspect_x = get_value(s->pb, value_type, 16);
             if(stream_num < 128)
@@ -680,7 +688,16 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
             int aspect_y = get_value(s->pb, value_type, 16);
             if(stream_num < 128)
                 asf->dar[stream_num].den = aspect_y;
-        } else {
+        } else if(!strcmp(name, "streamDirection") &&  // V
+                   0 < stream_num){                    // V
+           int direction = get_value(s->pb, value_type, value_len);
+           
+           av_log(s, AV_LOG_INFO, "+++++++++++++++ stream %d Direction is %d\n", // V
+                stream_num, direction);
+           
+           asf->direction[stream_num] = direction;
+           
+        } else {           
             get_tag(s, name, value_type, value_len, 16);
         }
     }
@@ -855,6 +872,17 @@ static int asf_read_header(AVFormatContext *s)
                           &st->sample_aspect_ratio.den,
                           asf->dar[0].num, asf->dar[0].den, INT_MAX);
 
+           
+           if(asf->direction[i] != NO_STREAM_DIRECTION) {
+               char buffer[32];                                
+               sprintf(buffer, "%d %d", i, asf->direction[i]);
+               
+               av_log(s, AV_LOG_INFO, "++++++++++++ setting str direction %s in stream (%d,%d)\n",
+                   buffer, i, stream_num);
+               //av_dict_set(&s->streams[i]->metadata, DIRECTION_DICT_KEY, buffer, 0);
+               av_dict_set(&st->metadata, DIRECTION_DICT_KEY, buffer, 0);
+           }
+                       
             av_log(s, AV_LOG_TRACE, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n",
                     i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den,
                     st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 015c731..59673d2 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -218,7 +218,9 @@ static const AVCodecTag codec_asf_bmp_tags[] = {
     { AV_CODEC_ID_NONE,      0 },
 };
 
-#define PREROLL_TIME 3100
+// V: in order to keep preroll time 0 redefine:
+#define PREROLL_TIME 0
+//#define PREROLL_TIME 3100
 
 static void put_str16(AVIOContext *s, const char *tag)
 {
@@ -350,27 +352,33 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
     AVDictionaryEntry *tags[5];
     int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
     int has_title, has_aspect_ratio = 0;
-    int metadata_count;
+   int has_direction = 0; // V
+   int metadata_count;
     AVCodecContext *enc;
     int64_t header_offset, cur_pos, hpos;
     int bit_rate;
     int64_t duration;
 
     ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
-
+   
+   av_log(s, AV_LOG_ERROR, "============ ASF Streams num is %d\n", s->nb_streams); // V
+   
     tags[0] = av_dict_get(s->metadata, "title", NULL, 0);
     tags[1] = av_dict_get(s->metadata, "author", NULL, 0);
     tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0);
     tags[3] = av_dict_get(s->metadata, "comment", NULL, 0);
     tags[4] = av_dict_get(s->metadata, "rating", NULL, 0);
-
+   
     duration       = asf->duration + PREROLL_TIME * 10000;
     has_title      = tags[0] || tags[1] || tags[2] || tags[3] || tags[4];
     metadata_count = av_dict_count(s->metadata);
 
     bit_rate = 0;
-    for (n = 0; n < s->nb_streams; n++) {
-        enc = s->streams[n]->codec;
+       
+    for (n = 0; n < s->nb_streams; n++) {  
+        AVDictionaryEntry *t = av_dict_get(s->streams[n]->metadata, DIRECTION_DICT_KEY, NULL, 0);              
+           
+       enc = s->streams[n]->codec;
 
         avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
 
@@ -379,7 +387,9 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
             && enc->sample_aspect_ratio.num > 0
             && enc->sample_aspect_ratio.den > 0)
             has_aspect_ratio++;
-    }
+   
+       if (t) has_direction++;     
+    }  
 
     if (asf->is_streamed) {
         put_chunk(s, 0x4824, 0, 0xc00); /* start of stream (length will be patched later) */
@@ -412,7 +422,41 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
     hpos = put_header(pb, &ff_asf_head1_guid);
     ff_put_guid(pb, &ff_asf_head2_guid);
     avio_wl16(pb, 6);
-    if (has_aspect_ratio) {
+   
+   if (has_direction) {
+   
+        int64_t hpos2;
+       
+       avio_wl32(pb, 26 + has_direction * 46);
+        hpos2 = put_header(pb, &ff_asf_metadata_header);
+        avio_wl16(pb, has_direction);
+       
+        for (n = 0; n < s->nb_streams; n++) {
+           AVDictionaryEntry *t = av_dict_get(s->streams[n]->metadata, DIRECTION_DICT_KEY, NULL, 0);               
+           int streamId;
+           int direction;
+           sscanf(t->value,"%d %d",&streamId, &direction);
+           
+           av_log(s, AV_LOG_INFO, "=============== Value from DEC %d: %s\n", // V
+               n, t ? t->value : "NULL");
+
+           av_log(s, AV_LOG_INFO,
+               "============== Writing stream[%d] direction of stream %d, (%d)\n",
+               n+1, streamId, direction); // writes Metadata
+               
+           avio_wl16(pb, 0);       // Reserved
+           avio_wl16(pb, streamId);    // Stream Number
+           avio_wl16(pb, 32);      // Name Length
+           avio_wl16(pb,  5);      // Data Type 
+           avio_wl32(pb,  2);      // Data Length
+           avio_put_str16le(pb, "streamDirection");  // 32
+           avio_wl16(pb, direction);
+        }        
+        end_header(pb, hpos2);
+   
+    } else if (has_aspect_ratio) { // V
+   
+//    if (has_aspect_ratio) {
         int64_t hpos2;
         avio_wl32(pb, 26 + has_aspect_ratio * 84);
         hpos2 = put_header(pb, &ff_asf_metadata_header);
diff --git a/libavformat/cache.c b/libavformat/cache.c
index d3d12bb..b4d2835 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -37,13 +37,13 @@
 #if HAVE_IO_H
 #include <io.h>
 #endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #include <sys/stat.h>
 #include <stdlib.h>
 #include "os_support.h"
 #include "url.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 typedef struct CacheEntry {
     int64_t logical_pos;
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 7a93214..5d4b511 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -20,9 +20,6 @@
  */
 
 #include "config.h"
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
@@ -37,6 +34,9 @@
 #include "isom.h"
 #include "os_support.h"
 #include "url.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 // See ISO/IEC 23009-1:2014 5.3.9.4.4
 typedef enum {
diff --git a/libavformat/file.c b/libavformat/file.c
index 6511328..de6745e 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -27,13 +27,13 @@
 #if HAVE_IO_H
 #include <io.h>
 #endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #include <sys/stat.h>
 #include <stdlib.h>
 #include "os_support.h"
 #include "url.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 /* Some systems may not have S_ISFIFO */
 #ifndef S_ISFIFO
diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index 48810a9..e89be43 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -21,9 +21,6 @@
 
 #include "config.h"
 #include <float.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include "avformat.h"
 #include "internal.h"
@@ -34,6 +31,9 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 typedef struct Fragment {
     char file[1024];
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4d9466c..2b56d4a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -22,9 +22,6 @@
 #include "config.h"
 #include <float.h>
 #include <stdint.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include "libavutil/avassert.h"
 #include "libavutil/mathematics.h"
@@ -36,6 +33,9 @@
 #include "avformat.h"
 #include "internal.h"
 #include "os_support.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 typedef struct HLSSegment {
     char filename[1024];
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 07173a9..1cf58fd 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -21,9 +21,6 @@
 
 #include "config.h"
 #include <float.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include "avformat.h"
 #include "internal.h"
@@ -37,6 +34,9 @@
 #include "libavutil/file.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/intreadwrite.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 typedef struct Fragment {
     char file[1024];
diff --git a/libavutil/file.c b/libavutil/file.c
index 2a06be4..c9625ed 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -23,9 +23,6 @@
 #include "mem.h"
 #include <fcntl.h>
 #include <sys/stat.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #if HAVE_IO_H
 #include <io.h>
 #endif
@@ -33,6 +30,9 @@
 #include <sys/mman.h>
 #elif HAVE_MAPVIEWOFFILE
 #include <windows.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #endif
 
 typedef struct FileLogContext {
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 3f9a67c..4c5e72b 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -22,9 +22,6 @@
 #include <stdarg.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #if HAVE_IO_H
 #include <io.h>
 #endif
@@ -35,6 +32,9 @@
 #undef stat
 #undef fstat
 #include <windows.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <share.h>
 #include <errno.h>
 #include "wchar_filename.h"
diff --git a/libavutil/log.c b/libavutil/log.c
index b2bc65c..9b49eae 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -26,9 +26,6 @@
 
 #include "config.h"
 
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #if HAVE_IO_H
 #include <io.h>
 #endif
@@ -59,6 +56,9 @@ static int flags;
 #define NB_LEVELS 8
 #if defined(_WIN32) && !defined(__MINGW32CE__) && HAVE_SETCONSOLETEXTATTRIBUTE
 #include <windows.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
     [AV_LOG_PANIC  /8] = 12,
     [AV_LOG_FATAL  /8] = 12,
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 8aa8c38..31482a3 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -20,9 +20,6 @@
 
 #include "config.h"
 
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #if HAVE_IO_H
 #include <io.h>
 #endif
@@ -30,6 +27,9 @@
 #include <windows.h>
 #include <wincrypt.h>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <math.h>
 #include <time.h>
diff --git a/libavutil/time.c b/libavutil/time.c
index dbaee02..a337f31 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -26,12 +26,12 @@
 #if HAVE_GETTIMEOFDAY
 #include <sys/time.h>
 #endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #if HAVE_WINDOWS_H
 #include <windows.h>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #include "time.h"
 #include "error.h"
diff --git a/tests/ref/fate/sub-aqtitle b/tests/ref/fate/sub-aqtitle
index 87253c9..417779b 100644
--- a/tests/ref/fate/sub-aqtitle
+++ b/tests/ref/fate/sub-aqtitle
@@ -1,45 +1,45 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:03:29.92,0:03:31.28,Default,,0,0,0,,Dougu?
-Dialogue: 0,0:03:33.36,0:03:35.76,Default,,0,0,0,,Zlato, jseš v pořádku?
-Dialogue: 0,0:03:37.72,0:03:39.12,Default,,0,0,0,,Měl jsi sny.
-Dialogue: 0,0:03:41.44,0:03:43.32,Default,,0,0,0,,Byly o Marsu?
-Dialogue: 0,0:03:48.92,0:03:50.52,Default,,0,0,0,,Je to lepší?
-Dialogue: 0,0:03:53.12,0:03:54.72,Default,,0,0,0,,Chudinko moje.
-Dialogue: 0,0:03:55.76,0:03:58.08,Default,,0,0,0,,Začíná to být\Nposedlost.
-Dialogue: 0,0:04:05.92,0:04:07.16,Default,,0,0,0,,Byla tam i ona?
-Dialogue: 0,0:04:09.12,0:04:10.48,Default,,0,0,0,,Kdo?
-Dialogue: 0,0:04:12.44,0:04:15.16,Default,,0,0,0,,Ta, o které jsi mi vyprávěl.\NTa bruneta.
-Dialogue: 0,0:04:16.32,0:04:17.52,Default,,0,0,0,,Lori.
-Dialogue: 0,0:04:20.32,0:04:23.16,Default,,0,0,0,,Nemůžu uvěřit\Nže žárlíš na sen.
-Dialogue: 0,0:04:23.84,0:04:26.60,Default,,0,0,0,,- Kdo je ona?\N- Nikdo.
-Dialogue: 0,0:04:26.60,0:04:28.80,Default,,0,0,0,,"Nikdo"? Jak se jmenuje?
-Dialogue: 0,0:04:28.80,0:04:30.24,Default,,0,0,0,,Nevím.
-Dialogue: 0,0:04:31.52,0:04:33.20,Default,,0,0,0,,- Pověz!\N- Nevím!
-Dialogue: 0,0:04:33.20,0:04:35.48,Default,,0,0,0,,Radši bys mi to měl říct!
-Dialogue: 0,0:04:35.48,0:04:39.16,Default,,0,0,0,,To není legrace Dougu.\NZdá se ti o ní každou noc.
-Dialogue: 0,0:04:39.16,0:04:41.84,Default,,0,0,0,,Ale vždy se ráno probudím.
-Dialogue: 0,0:04:41.84,0:04:43.28,Default,,0,0,0,,Nech mě být!
-Dialogue: 0,0:04:45.72,0:04:47.76,Default,,0,0,0,,No tak, zlato.
-Dialogue: 0,0:04:47.76,0:04:50.72,Default,,0,0,0,,Ty víš, že jsi dívkou\Nmých snů.
-Dialogue: 0,0:04:50.72,0:04:52.40,Default,,0,0,0,,Myslíš to vážně?
-Dialogue: 0,0:04:53.48,0:04:55.32,Default,,0,0,0,,To víš že ano.
-Dialogue: 0,0:05:04.40,0:05:07.20,Default,,0,0,0,,Dám ti něco\No čem budeš snít.
-Dialogue: 0,0:05:16.76,0:05:16.92,Default,,0,0,0,,Premiér se útoku ubránil\Na řekl, že zbraně založené na vesmírných...
-Dialogue: 0,0:05:16.92,0:05:20.36,Default,,0,0,0,,Premiér se útoku ubránil\Na řekl, že zbraně založené na vesmírných...
-Dialogue: 0,0:05:20.36,0:05:24.36,Default,,0,0,0,,jsou naše jediná obrana proti\Npočetní převaze z jižního bloku.
-Dialogue: 0,0:05:24.36,0:05:26.76,Default,,0,0,0,,A další násilí na Marsu...
-Dialogue: 0,0:05:26.76,1:44:16.00,Default,,0,0,0,,[...]
-Dialogue: 0,1:44:16.00,1:44:17.60,Default,,0,0,0,,Co se děje?
-Dialogue: 0,1:44:17.60,1:44:21.28,Default,,0,0,0,,Měl jsem jenom hroznou představu.\NCo když tohle je jenom sen?
-Dialogue: 0,1:44:22.76,1:44:25.68,Default,,0,0,0,,Tak mi dej ryhcle pusu\Nnež se probudíš.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:03:29.92,0:03:31.28,Default,,0,0,0,,Dougu?
+Dialogue: 0,0:03:33.36,0:03:35.76,Default,,0,0,0,,Zlato, jseš v pořádku?
+Dialogue: 0,0:03:37.72,0:03:39.12,Default,,0,0,0,,Měl jsi sny.
+Dialogue: 0,0:03:41.44,0:03:43.32,Default,,0,0,0,,Byly o Marsu?
+Dialogue: 0,0:03:48.92,0:03:50.52,Default,,0,0,0,,Je to lepší?
+Dialogue: 0,0:03:53.12,0:03:54.72,Default,,0,0,0,,Chudinko moje.
+Dialogue: 0,0:03:55.76,0:03:58.08,Default,,0,0,0,,Začíná to být\Nposedlost.
+Dialogue: 0,0:04:05.92,0:04:07.16,Default,,0,0,0,,Byla tam i ona?
+Dialogue: 0,0:04:09.12,0:04:10.48,Default,,0,0,0,,Kdo?
+Dialogue: 0,0:04:12.44,0:04:15.16,Default,,0,0,0,,Ta, o které jsi mi vyprávěl.\NTa bruneta.
+Dialogue: 0,0:04:16.32,0:04:17.52,Default,,0,0,0,,Lori.
+Dialogue: 0,0:04:20.32,0:04:23.16,Default,,0,0,0,,Nemůžu uvěřit\Nže žárlíš na sen.
+Dialogue: 0,0:04:23.84,0:04:26.60,Default,,0,0,0,,- Kdo je ona?\N- Nikdo.
+Dialogue: 0,0:04:26.60,0:04:28.80,Default,,0,0,0,,"Nikdo"? Jak se jmenuje?
+Dialogue: 0,0:04:28.80,0:04:30.24,Default,,0,0,0,,Nevím.
+Dialogue: 0,0:04:31.52,0:04:33.20,Default,,0,0,0,,- Pověz!\N- Nevím!
+Dialogue: 0,0:04:33.20,0:04:35.48,Default,,0,0,0,,Radši bys mi to měl říct!
+Dialogue: 0,0:04:35.48,0:04:39.16,Default,,0,0,0,,To není legrace Dougu.\NZdá se ti o ní každou noc.
+Dialogue: 0,0:04:39.16,0:04:41.84,Default,,0,0,0,,Ale vždy se ráno probudím.
+Dialogue: 0,0:04:41.84,0:04:43.28,Default,,0,0,0,,Nech mě být!
+Dialogue: 0,0:04:45.72,0:04:47.76,Default,,0,0,0,,No tak, zlato.
+Dialogue: 0,0:04:47.76,0:04:50.72,Default,,0,0,0,,Ty víš, že jsi dívkou\Nmých snů.
+Dialogue: 0,0:04:50.72,0:04:52.40,Default,,0,0,0,,Myslíš to vážně?
+Dialogue: 0,0:04:53.48,0:04:55.32,Default,,0,0,0,,To víš že ano.
+Dialogue: 0,0:05:04.40,0:05:07.20,Default,,0,0,0,,Dám ti něco\No čem budeš snít.
+Dialogue: 0,0:05:16.76,0:05:16.92,Default,,0,0,0,,Premiér se útoku ubránil\Na řekl, že zbraně založené na vesmírných...
+Dialogue: 0,0:05:16.92,0:05:20.36,Default,,0,0,0,,Premiér se útoku ubránil\Na řekl, že zbraně založené na vesmírných...
+Dialogue: 0,0:05:20.36,0:05:24.36,Default,,0,0,0,,jsou naše jediná obrana proti\Npočetní převaze z jižního bloku.
+Dialogue: 0,0:05:24.36,0:05:26.76,Default,,0,0,0,,A další násilí na Marsu...
+Dialogue: 0,0:05:26.76,1:44:16.00,Default,,0,0,0,,[...]
+Dialogue: 0,1:44:16.00,1:44:17.60,Default,,0,0,0,,Co se děje?
+Dialogue: 0,1:44:17.60,1:44:21.28,Default,,0,0,0,,Měl jsem jenom hroznou představu.\NCo když tohle je jenom sen?
+Dialogue: 0,1:44:22.76,1:44:25.68,Default,,0,0,0,,Tak mi dej ryhcle pusu\Nnež se probudíš.
diff --git a/tests/ref/fate/sub-charenc b/tests/ref/fate/sub-charenc
index ed5cdbe..9051e28 100644
--- a/tests/ref/fate/sub-charenc
+++ b/tests/ref/fate/sub-charenc
@@ -1,62 +1,62 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:32.95,0:00:38.25,Default,,0,0,0,,КОЛУМБИА ПИКЧЪРС - АЗИЯ\NСОНИ ПИКЧЪРС и Е.Е. Co.\Nпредставят
-Dialogue: 0,0:00:52.76,0:00:58.60,Default,,0,0,0,,Т И Г Ъ Р   И   Д Р А К О Н
-Dialogue: 0,0:01:22.17,0:01:24.05,Default,,0,0,0,,Учителят Ли е тук.
-Dialogue: 0,0:01:45.48,0:01:47.32,Default,,0,0,0,,Шу Лиен!
-Dialogue: 0,0:01:54.53,0:01:57.24,Default,,0,0,0,,Ли Му Бай е тук.
-Dialogue: 0,0:02:05.83,0:02:09.00,Default,,0,0,0,,- Как вървят нещата?\N- Добре. Моля, влезте!
-Dialogue: 0,0:02:23.48,0:02:26.52,Default,,0,0,0,,Му Бай...\NМина много време.
-Dialogue: 0,0:02:26.73,0:02:28.11,Default,,0,0,0,,Така е.
-Dialogue: 0,0:02:28.57,0:02:31.41,Default,,0,0,0,,- Как върви бизнесът?\N- Добре.
-Dialogue: 0,0:02:31.61,0:02:33.90,Default,,0,0,0,,- А ти как си?\N- Добре.
-Dialogue: 0,0:02:40.16,0:02:42.79,Default,,0,0,0,,Монахът Дзенг каза,\Nче си в планината Удан.
-Dialogue: 0,0:02:43.04,0:02:46.54,Default,,0,0,0,,Каза, че практикуваш\Nдълбока медитация.
-Dialogue: 0,0:02:48.84,0:02:50.68,Default,,0,0,0,,Сигурно в планината\Nе много спокойно.
-Dialogue: 0,0:02:51.25,0:02:53.46,Default,,0,0,0,,Завиждам ти.
-Dialogue: 0,0:02:53.67,0:02:58.34,Default,,0,0,0,,Имам толкова много работа,\Nпочти не ми остава\Nвреме за почивка.
-Dialogue: 0,0:03:00.26,0:03:03.89,Default,,0,0,0,,Оставих обучението рано.
-Dialogue: 0,0:03:05.69,0:03:11.28,Default,,0,0,0,,Защо? Ти си боец на Удан.\NОбучението е всичко.
-Dialogue: 0,0:03:11.90,0:03:14.86,Default,,0,0,0,,По време на медитация…
-Dialogue: 0,0:03:15.07,0:03:18.49,Default,,0,0,0,,стигнах до място,\Nкъдето имаше дълбока тишина...
-Dialogue: 0,0:03:19.87,0:03:22.79,Default,,0,0,0,,бях обграден от светлина...
-Dialogue: 0,0:03:23.41,0:03:28.08,Default,,0,0,0,,времето и пространството изчезнаха.
-Dialogue: 0,0:03:28.71,0:03:34.09,Default,,0,0,0,,Достигнах до състояние, за което\Nучителят не ми беше казвал.
-Dialogue: 0,0:03:37.05,0:03:39.14,Default,,0,0,0,,Постигнал си просветление?
-Dialogue: 0,0:03:39.34,0:03:41.22,Default,,0,0,0,,Не.
-Dialogue: 0,0:03:41.72,0:03:45.81,Default,,0,0,0,,Не почувствах блаженството\Nна просветлението.
-Dialogue: 0,0:03:46.02,0:03:52.86,Default,,0,0,0,,Вместо това... ме обгърна\Nбезкрайна мъка.
-Dialogue: 0,0:03:53.40,0:03:56.57,Default,,0,0,0,,Не можах да издържа.
-Dialogue: 0,0:03:57.49,0:03:59.74,Default,,0,0,0,,Прекъснах медитацията си.
-Dialogue: 0,0:03:59.95,0:04:02.24,Default,,0,0,0,,Не можах да продължа.
-Dialogue: 0,0:04:03.20,0:04:07.79,Default,,0,0,0,,Нещо...\Nме дърпаше назад.
-Dialogue: 0,0:04:09.62,0:04:10.91,Default,,0,0,0,,Какво беше?
-Dialogue: 0,0:04:15.46,0:04:18.00,Default,,0,0,0,,Нещо, от което не\Nмога да се освободя.
-Dialogue: 0,0:04:23.39,0:04:24.68,Default,,0,0,0,,Скоро ли ще тръгваш?
-Dialogue: 0,0:04:26.77,0:04:30.27,Default,,0,0,0,,Подготвяме охрана\Nза една доставка...
-Dialogue: 0,0:04:30.48,0:04:31.94,Default,,0,0,0,,за Пекин.
-Dialogue: 0,0:04:32.56,0:04:34.10,Default,,0,0,0,,Мога ли да те помоля...
-Dialogue: 0,0:04:35.07,0:04:38.82,Default,,0,0,0,,да занесеш нещо на господин Те.
-Dialogue: 0,0:04:44.28,0:04:48.12,Default,,0,0,0,,Зеленият меч на Съдбата!?\NДаваш го на господин Те!?
-Dialogue: 0,0:04:48.37,0:04:52.67,Default,,0,0,0,,Да. Той винаги е бил\Nнашият най-голям покровител.
-Dialogue: 0,0:04:52.88,0:04:56.55,Default,,0,0,0,,Не разбирам.\NКак можеш да се разделиш с него?
-Dialogue: 0,0:04:56.76,0:04:59.93,Default,,0,0,0,,Той винаги е бил с теб.
-Dialogue: 0,0:05:01.18,0:05:05.52,Default,,0,0,0,,Твърде много хора са\Nзагинали от това острие.
-Dialogue: 0,0:05:09.68,0:05:14.52,Default,,0,0,0,,Чисто е единствено защото\Nкръвта се отмива лесно.
-Dialogue: 0,0:05:15.40,0:05:20.61,Default,,0,0,0,,Ти го използваш справедливо.\NДостоен си за него.
-Dialogue: 0,0:05:23.66,0:05:27.37,Default,,0,0,0,,Дойде време\Nда го оставя.
-Dialogue: 0,0:05:27.58,0:05:31.21,Default,,0,0,0,,Е, какво ще правиш\Nот сега нататък?
-Dialogue: 0,0:05:34.71,0:05:37.50,Default,,0,0,0,,Ела с мен в Пекин.
-Dialogue: 0,0:05:37.71,0:05:41.42,Default,,0,0,0,,Лично ще дадеш меча\Nна господин Те.
-Dialogue: 0,0:05:41.68,0:05:44.89,Default,,0,0,0,,Ще бъде както преди.
-Dialogue: 0,0:05:47.01,0:05:51.68,Default,,0,0,0,,Първо трябва да отида\Nна гроба на учителя си.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:32.95,0:00:38.25,Default,,0,0,0,,КОЛУМБИА ПИКЧЪРС - АЗИЯ\NСОНИ ПИКЧЪРС и Е.Е. Co.\Nпредставят
+Dialogue: 0,0:00:52.76,0:00:58.60,Default,,0,0,0,,Т И Г Ъ Р   И   Д Р А К О Н
+Dialogue: 0,0:01:22.17,0:01:24.05,Default,,0,0,0,,Учителят Ли е тук.
+Dialogue: 0,0:01:45.48,0:01:47.32,Default,,0,0,0,,Шу Лиен!
+Dialogue: 0,0:01:54.53,0:01:57.24,Default,,0,0,0,,Ли Му Бай е тук.
+Dialogue: 0,0:02:05.83,0:02:09.00,Default,,0,0,0,,- Как вървят нещата?\N- Добре. Моля, влезте!
+Dialogue: 0,0:02:23.48,0:02:26.52,Default,,0,0,0,,Му Бай...\NМина много време.
+Dialogue: 0,0:02:26.73,0:02:28.11,Default,,0,0,0,,Така е.
+Dialogue: 0,0:02:28.57,0:02:31.41,Default,,0,0,0,,- Как върви бизнесът?\N- Добре.
+Dialogue: 0,0:02:31.61,0:02:33.90,Default,,0,0,0,,- А ти как си?\N- Добре.
+Dialogue: 0,0:02:40.16,0:02:42.79,Default,,0,0,0,,Монахът Дзенг каза,\Nче си в планината Удан.
+Dialogue: 0,0:02:43.04,0:02:46.54,Default,,0,0,0,,Каза, че практикуваш\Nдълбока медитация.
+Dialogue: 0,0:02:48.84,0:02:50.68,Default,,0,0,0,,Сигурно в планината\Nе много спокойно.
+Dialogue: 0,0:02:51.25,0:02:53.46,Default,,0,0,0,,Завиждам ти.
+Dialogue: 0,0:02:53.67,0:02:58.34,Default,,0,0,0,,Имам толкова много работа,\Nпочти не ми остава\Nвреме за почивка.
+Dialogue: 0,0:03:00.26,0:03:03.89,Default,,0,0,0,,Оставих обучението рано.
+Dialogue: 0,0:03:05.69,0:03:11.28,Default,,0,0,0,,Защо? Ти си боец на Удан.\NОбучението е всичко.
+Dialogue: 0,0:03:11.90,0:03:14.86,Default,,0,0,0,,По време на медитация…
+Dialogue: 0,0:03:15.07,0:03:18.49,Default,,0,0,0,,стигнах до място,\Nкъдето имаше дълбока тишина...
+Dialogue: 0,0:03:19.87,0:03:22.79,Default,,0,0,0,,бях обграден от светлина...
+Dialogue: 0,0:03:23.41,0:03:28.08,Default,,0,0,0,,времето и пространството изчезнаха.
+Dialogue: 0,0:03:28.71,0:03:34.09,Default,,0,0,0,,Достигнах до състояние, за което\Nучителят не ми беше казвал.
+Dialogue: 0,0:03:37.05,0:03:39.14,Default,,0,0,0,,Постигнал си просветление?
+Dialogue: 0,0:03:39.34,0:03:41.22,Default,,0,0,0,,Не.
+Dialogue: 0,0:03:41.72,0:03:45.81,Default,,0,0,0,,Не почувствах блаженството\Nна просветлението.
+Dialogue: 0,0:03:46.02,0:03:52.86,Default,,0,0,0,,Вместо това... ме обгърна\Nбезкрайна мъка.
+Dialogue: 0,0:03:53.40,0:03:56.57,Default,,0,0,0,,Не можах да издържа.
+Dialogue: 0,0:03:57.49,0:03:59.74,Default,,0,0,0,,Прекъснах медитацията си.
+Dialogue: 0,0:03:59.95,0:04:02.24,Default,,0,0,0,,Не можах да продължа.
+Dialogue: 0,0:04:03.20,0:04:07.79,Default,,0,0,0,,Нещо...\Nме дърпаше назад.
+Dialogue: 0,0:04:09.62,0:04:10.91,Default,,0,0,0,,Какво беше?
+Dialogue: 0,0:04:15.46,0:04:18.00,Default,,0,0,0,,Нещо, от което не\Nмога да се освободя.
+Dialogue: 0,0:04:23.39,0:04:24.68,Default,,0,0,0,,Скоро ли ще тръгваш?
+Dialogue: 0,0:04:26.77,0:04:30.27,Default,,0,0,0,,Подготвяме охрана\Nза една доставка...
+Dialogue: 0,0:04:30.48,0:04:31.94,Default,,0,0,0,,за Пекин.
+Dialogue: 0,0:04:32.56,0:04:34.10,Default,,0,0,0,,Мога ли да те помоля...
+Dialogue: 0,0:04:35.07,0:04:38.82,Default,,0,0,0,,да занесеш нещо на господин Те.
+Dialogue: 0,0:04:44.28,0:04:48.12,Default,,0,0,0,,Зеленият меч на Съдбата!?\NДаваш го на господин Те!?
+Dialogue: 0,0:04:48.37,0:04:52.67,Default,,0,0,0,,Да. Той винаги е бил\Nнашият най-голям покровител.
+Dialogue: 0,0:04:52.88,0:04:56.55,Default,,0,0,0,,Не разбирам.\NКак можеш да се разделиш с него?
+Dialogue: 0,0:04:56.76,0:04:59.93,Default,,0,0,0,,Той винаги е бил с теб.
+Dialogue: 0,0:05:01.18,0:05:05.52,Default,,0,0,0,,Твърде много хора са\Nзагинали от това острие.
+Dialogue: 0,0:05:09.68,0:05:14.52,Default,,0,0,0,,Чисто е единствено защото\Nкръвта се отмива лесно.
+Dialogue: 0,0:05:15.40,0:05:20.61,Default,,0,0,0,,Ти го използваш справедливо.\NДостоен си за него.
+Dialogue: 0,0:05:23.66,0:05:27.37,Default,,0,0,0,,Дойде време\Nда го оставя.
+Dialogue: 0,0:05:27.58,0:05:31.21,Default,,0,0,0,,Е, какво ще правиш\Nот сега нататък?
+Dialogue: 0,0:05:34.71,0:05:37.50,Default,,0,0,0,,Ела с мен в Пекин.
+Dialogue: 0,0:05:37.71,0:05:41.42,Default,,0,0,0,,Лично ще дадеш меча\Nна господин Те.
+Dialogue: 0,0:05:41.68,0:05:44.89,Default,,0,0,0,,Ще бъде както преди.
+Dialogue: 0,0:05:47.01,0:05:51.68,Default,,0,0,0,,Първо трябва да отида\Nна гроба на учителя си.
diff --git a/tests/ref/fate/sub-jacosub b/tests/ref/fate/sub-jacosub
index a30fe4a..4bdc5e6 100644
--- a/tests/ref/fate/sub-jacosub
+++ b/tests/ref/fate/sub-jacosub
@@ -1,23 +1,23 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.12,0:00:04.36,Default,,0,0,0,,{\an5}JACOsub\N\NThis script demonstrates some of the capabilities of JACOsub.
-Dialogue: 0,0:00:04.12,0:00:14.86,Default,,0,0,0,,{\an8}Text may be positioned at the top,
-Dialogue: 0,0:00:05.12,0:00:17.46,Default,,0,0,0,,{\an5}middle,
-Dialogue: 0,0:00:06.12,0:00:20.06,Default,,0,0,0,,{\an2}or bottom of the screen.
-Dialogue: 0,0:00:08.12,0:00:27.36,Default,,0,0,0,,{\an5}{this is a comment} (And, you just saw, {another comment} timing ranges for different lines of text.
-Dialogue: 0,0:00:11.12,0:00:35.86,Default,,0,0,0,,{\an1}Within margin constraints\Nthat you set, text may be\Nleft justified,
-Dialogue: 0,0:00:13.62,0:00:42.11,Default,,0,0,0,,{\an2}{the JC is redundant - it's the default}center\Njustified,
-Dialogue: 0,0:00:14.87,0:00:45.86,Default,,0,0,0,,{\an3}and also\Nright justified.
-Dialogue: 0,0:00:22.42,0:01:12.76,Default,,0,0,0,,Text may appear in different styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,{\an5}\N\NAt that time, you may press any key to return to the Editor.
-Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,OK, this script will be finished when the screen goes blank.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.12,0:00:04.36,Default,,0,0,0,,{\an5}JACOsub\N\NThis script demonstrates some of the capabilities of JACOsub.
+Dialogue: 0,0:00:04.12,0:00:14.86,Default,,0,0,0,,{\an8}Text may be positioned at the top,
+Dialogue: 0,0:00:05.12,0:00:17.46,Default,,0,0,0,,{\an5}middle,
+Dialogue: 0,0:00:06.12,0:00:20.06,Default,,0,0,0,,{\an2}or bottom of the screen.
+Dialogue: 0,0:00:08.12,0:00:27.36,Default,,0,0,0,,{\an5}{this is a comment} (And, you just saw, {another comment} timing ranges for different lines of text.
+Dialogue: 0,0:00:11.12,0:00:35.86,Default,,0,0,0,,{\an1}Within margin constraints\Nthat you set, text may be\Nleft justified,
+Dialogue: 0,0:00:13.62,0:00:42.11,Default,,0,0,0,,{\an2}{the JC is redundant - it's the default}center\Njustified,
+Dialogue: 0,0:00:14.87,0:00:45.86,Default,,0,0,0,,{\an3}and also\Nright justified.
+Dialogue: 0,0:00:22.42,0:01:12.76,Default,,0,0,0,,Text may appear in different styles\N(Normal, {\b1}Bold{\r}, {\i1}Italic{\r})
+Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,{\an5}\N\NAt that time, you may press any key to return to the Editor.
+Dialogue: 0,0:01:16.12,0:03:53.36,Default,,0,0,0,,OK, this script will be finished when the screen goes blank.
diff --git a/tests/ref/fate/sub-microdvd b/tests/ref/fate/sub-microdvd
index d2170bc..0332da9 100644
--- a/tests/ref/fate/sub-microdvd
+++ b/tests/ref/fate/sub-microdvd
@@ -1,22 +1,22 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Comic Sans MS,30,&H123456,&H123456,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:40.00,0:00:52.00,Default,,0,0,0,,{\c&H345678&}foo{\c}\N{\c&HABCDEF&}bar{\c}\Nbla
-Dialogue: 0,0:00:52.00,0:00:56.00,Default,,0,0,0,,{\u1}{\s1}{\i1}{\b1}italic bold underline strike{\s0}{\u0}\Nitalic bold no-underline no-strike
-Dialogue: 0,0:00:56.00,0:01:00.00,Default,,0,0,0,,back to
-Dialogue: 0,0:01:00.00,0:01:04.00,Default,,0,0,0,,the future
-Dialogue: 0,0:01:20.00,0:01:24.92,Default,,0,0,0,,{\pos(10,20)}Some more crazy stuff
-Dialogue: 0,0:02:14.00,0:02:15.60,Default,,0,0,0,,this subtitle...
-Dialogue: 0,0:02:15.60,0:02:40.00,Default,,0,0,0,,...continues up to...
-Dialogue: 0,0:02:40.00,0:03:00.00,Default,,0,0,0,,this one.
-Dialogue: 0,0:03:04.00,0:03:12.00,Default,,0,0,0,,and now...
-Dialogue: 0,0:03:12.00,9:59:59.99,Default,,0,0,0,,...to the end of the presentation
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Comic Sans MS,30,&H123456,&H123456,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:40.00,0:00:52.00,Default,,0,0,0,,{\c&H345678&}foo{\c}\N{\c&HABCDEF&}bar{\c}\Nbla
+Dialogue: 0,0:00:52.00,0:00:56.00,Default,,0,0,0,,{\u1}{\s1}{\i1}{\b1}italic bold underline strike{\s0}{\u0}\Nitalic bold no-underline no-strike
+Dialogue: 0,0:00:56.00,0:01:00.00,Default,,0,0,0,,back to
+Dialogue: 0,0:01:00.00,0:01:04.00,Default,,0,0,0,,the future
+Dialogue: 0,0:01:20.00,0:01:24.92,Default,,0,0,0,,{\pos(10,20)}Some more crazy stuff
+Dialogue: 0,0:02:14.00,0:02:15.60,Default,,0,0,0,,this subtitle...
+Dialogue: 0,0:02:15.60,0:02:40.00,Default,,0,0,0,,...continues up to...
+Dialogue: 0,0:02:40.00,0:03:00.00,Default,,0,0,0,,this one.
+Dialogue: 0,0:03:04.00,0:03:12.00,Default,,0,0,0,,and now...
+Dialogue: 0,0:03:12.00,9:59:59.99,Default,,0,0,0,,...to the end of the presentation
diff --git a/tests/ref/fate/sub-movtext b/tests/ref/fate/sub-movtext
index 6a90e96..8b46501 100644
--- a/tests/ref/fate/sub-movtext
+++ b/tests/ref/fate/sub-movtext
@@ -1,15 +1,15 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.97,0:00:02.54,Default,,0,0,0,,- Test 1.\N- Test 2.
-Dialogue: 0,0:00:03.05,0:00:04.74,Default,,0,0,0,,Test 3.
-Dialogue: 0,0:00:05.85,0:00:08.14,Default,,0,0,0,,- Test 4.\N- Test 5.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.97,0:00:02.54,Default,,0,0,0,,- Test 1.\N- Test 2.
+Dialogue: 0,0:00:03.05,0:00:04.74,Default,,0,0,0,,Test 3.
+Dialogue: 0,0:00:05.85,0:00:08.14,Default,,0,0,0,,- Test 4.\N- Test 5.
diff --git a/tests/ref/fate/sub-mpl2 b/tests/ref/fate/sub-mpl2
index 72fc0fc..a985760 100644
--- a/tests/ref/fate/sub-mpl2
+++ b/tests/ref/fate/sub-mpl2
@@ -1,16 +1,16 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.00,0:00:01.20,Default,,0,0,0,,Foo\Nbar\Nbla
-Dialogue: 0,0:00:04.10,0:00:05.30,Default,,0,0,0,,{\i1}italic{\r}\N{\b1}bold{\r}\N{\b1}{\i1}italicbold
-Dialogue: 0,0:00:05.30,0:00:07.20,Default,,0,0,0,,{\u1}underline{\r}\Nnormal
-Dialogue: 0,0:00:08.40,0:00:12.80,Default,,0,0,0,,hello
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.00,0:00:01.20,Default,,0,0,0,,Foo\Nbar\Nbla
+Dialogue: 0,0:00:04.10,0:00:05.30,Default,,0,0,0,,{\i1}italic{\r}\N{\b1}bold{\r}\N{\b1}{\i1}italicbold
+Dialogue: 0,0:00:05.30,0:00:07.20,Default,,0,0,0,,{\u1}underline{\r}\Nnormal
+Dialogue: 0,0:00:08.40,0:00:12.80,Default,,0,0,0,,hello
diff --git a/tests/ref/fate/sub-mpsub b/tests/ref/fate/sub-mpsub
index 890ceb0..9fc2267 100644
--- a/tests/ref/fate/sub-mpsub
+++ b/tests/ref/fate/sub-mpsub
@@ -1,33 +1,33 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:15.00,0:00:18.00,Default,,0,0,0,,A long, long time ago...
-Dialogue: 0,0:00:18.00,0:00:21.00,Default,,0,0,0,,in a galaxy far away...
-Dialogue: 0,0:00:21.00,0:00:24.00,Default,,0,0,0,,Naboo was under an attack.
-Dialogue: 0,0:00:25.00,0:00:27.50,Default,,0,0,0,,And I thought me and\NQui-Gon Jinn could
-Dialogue: 0,0:00:27.50,0:00:30.00,Default,,0,0,0,,talk the Federation into
-Dialogue: 0,0:00:30.00,0:00:34.00,Default,,0,0,0,,...maybe cutting them a\Nlittle slack.
-Dialogue: 0,0:00:36.00,0:00:39.00,Default,,0,0,0,,But their response, it\Ndidn't thrill us,
-Dialogue: 0,0:00:39.00,0:00:42.00,Default,,0,0,0,,They locked the doors,\Nand tried to kill us.
-Dialogue: 0,0:00:42.00,0:00:44.50,Default,,0,0,0,,We escaped from that gas,
-Dialogue: 0,0:00:44.50,0:00:48.00,Default,,0,0,0,,then met Jar-jar and\NBoss-Nass.
-Dialogue: 0,0:00:49.00,0:00:55.00,Default,,0,0,0,,We took a bongo from the\Nscene and we went to\NTheed to see the Queen.
-Dialogue: 0,0:00:55.00,0:01:00.00,Default,,0,0,0,,We all wound' up on\NTatooine.
-Dialogue: 0,0:01:00.00,0:01:06.00,Default,,0,0,0,,That's where, we've found\Nthis boy.
-Dialogue: 0,0:01:06.00,0:01:10.00,Default,,0,0,0,,Oh my, my this here\NAnakin guy,
-Dialogue: 0,0:01:10.00,0:01:15.00,Default,,0,0,0,,maybe Vader someday\Nlater now he's just\Na small fry.
-Dialogue: 0,0:01:15.00,0:01:19.00,Default,,0,0,0,,And he left his home and\Nkissed his mommy goodbye,
-Dialogue: 0,0:01:19.00,0:01:24.00,Default,,0,0,0,,singing "Soon I'm gonna be\Na Jedi!"
-Dialogue: 0,0:01:30.00,0:01:36.00,Default,,0,0,0,,Did you know this junkyard\Nslave isn't even old enough\Nto shave,
-Dialogue: 0,0:01:36.00,0:01:39.00,Default,,0,0,0,,but he can use the Force,\Nthey say.
-Dialogue: 0,0:01:40.00,0:01:46.00,Default,,0,0,0,,Ahh, do you see him hitting\Non the queen though he's\Njust nine and she's fourteen
-Dialogue: 0,0:01:46.00,0:01:52.00,Default,,0,0,0,,yeah, he's probably gonna\Nmarry her, someday!
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:15.00,0:00:18.00,Default,,0,0,0,,A long, long time ago...
+Dialogue: 0,0:00:18.00,0:00:21.00,Default,,0,0,0,,in a galaxy far away...
+Dialogue: 0,0:00:21.00,0:00:24.00,Default,,0,0,0,,Naboo was under an attack.
+Dialogue: 0,0:00:25.00,0:00:27.50,Default,,0,0,0,,And I thought me and\NQui-Gon Jinn could
+Dialogue: 0,0:00:27.50,0:00:30.00,Default,,0,0,0,,talk the Federation into
+Dialogue: 0,0:00:30.00,0:00:34.00,Default,,0,0,0,,...maybe cutting them a\Nlittle slack.
+Dialogue: 0,0:00:36.00,0:00:39.00,Default,,0,0,0,,But their response, it\Ndidn't thrill us,
+Dialogue: 0,0:00:39.00,0:00:42.00,Default,,0,0,0,,They locked the doors,\Nand tried to kill us.
+Dialogue: 0,0:00:42.00,0:00:44.50,Default,,0,0,0,,We escaped from that gas,
+Dialogue: 0,0:00:44.50,0:00:48.00,Default,,0,0,0,,then met Jar-jar and\NBoss-Nass.
+Dialogue: 0,0:00:49.00,0:00:55.00,Default,,0,0,0,,We took a bongo from the\Nscene and we went to\NTheed to see the Queen.
+Dialogue: 0,0:00:55.00,0:01:00.00,Default,,0,0,0,,We all wound' up on\NTatooine.
+Dialogue: 0,0:01:00.00,0:01:06.00,Default,,0,0,0,,That's where, we've found\Nthis boy.
+Dialogue: 0,0:01:06.00,0:01:10.00,Default,,0,0,0,,Oh my, my this here\NAnakin guy,
+Dialogue: 0,0:01:10.00,0:01:15.00,Default,,0,0,0,,maybe Vader someday\Nlater now he's just\Na small fry.
+Dialogue: 0,0:01:15.00,0:01:19.00,Default,,0,0,0,,And he left his home and\Nkissed his mommy goodbye,
+Dialogue: 0,0:01:19.00,0:01:24.00,Default,,0,0,0,,singing "Soon I'm gonna be\Na Jedi!"
+Dialogue: 0,0:01:30.00,0:01:36.00,Default,,0,0,0,,Did you know this junkyard\Nslave isn't even old enough\Nto shave,
+Dialogue: 0,0:01:36.00,0:01:39.00,Default,,0,0,0,,but he can use the Force,\Nthey say.
+Dialogue: 0,0:01:40.00,0:01:46.00,Default,,0,0,0,,Ahh, do you see him hitting\Non the queen though he's\Njust nine and she's fourteen
+Dialogue: 0,0:01:46.00,0:01:52.00,Default,,0,0,0,,yeah, he's probably gonna\Nmarry her, someday!
diff --git a/tests/ref/fate/sub-mpsub-frames b/tests/ref/fate/sub-mpsub-frames
index 64528ec..613037b 100644
--- a/tests/ref/fate/sub-mpsub-frames
+++ b/tests/ref/fate/sub-mpsub-frames
@@ -1,14 +1,14 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:01.00,0:00:02.48,Default,,0,0,0,,Start at 1sec,\Nlast 1.5 seconds
-Dialogue: 0,0:00:02.52,0:00:11.52,Default,,0,0,0,,One frame later,\Nduring 9 seconds
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:01.00,0:00:02.48,Default,,0,0,0,,Start at 1sec,\Nlast 1.5 seconds
+Dialogue: 0,0:00:02.52,0:00:11.52,Default,,0,0,0,,One frame later,\Nduring 9 seconds
diff --git a/tests/ref/fate/sub-pjs b/tests/ref/fate/sub-pjs
index 799c62b..6ece423 100644
--- a/tests/ref/fate/sub-pjs
+++ b/tests/ref/fate/sub-pjs
@@ -1,15 +1,15 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:04:04.70,0:04:11.30,Default,,0,0,0,,You should come to the Drama Club, too.
-Dialogue: 0,0:04:11.30,0:04:19.40,Default,,0,0,0,,Yeah. The Drama Club is worried\Nthat you haven't been coming.
-Dialogue: 0,0:04:20.30,0:04:27.50,Default,,0,0,0,,I see. Sorry, I'll drop by next time.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:04:04.70,0:04:11.30,Default,,0,0,0,,You should come to the Drama Club, too.
+Dialogue: 0,0:04:11.30,0:04:19.40,Default,,0,0,0,,Yeah. The Drama Club is worried\Nthat you haven't been coming.
+Dialogue: 0,0:04:20.30,0:04:27.50,Default,,0,0,0,,I see. Sorry, I'll drop by next time.
diff --git a/tests/ref/fate/sub-realtext b/tests/ref/fate/sub-realtext
index cd9aa5a..e37b200 100644
--- a/tests/ref/fate/sub-realtext
+++ b/tests/ref/fate/sub-realtext
@@ -1,17 +1,17 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,Mary had a little lamb, \N
-Dialogue: 0,0:00:03.00,0:00:18.00,Default,,0,0,0,,little lamb, \N
-Dialogue: 0,0:00:06.99,0:00:21.99,Default,,0,0,0,,little lamb, \N
-Dialogue: 0,0:00:09.00,0:00:23.00,Default,,0,0,0,,Mary had a little lamb \N
-Dialogue: 0,0:00:12.34,0:00:27.34,Default,,0,0,0,,whose fleece was white as snow. 
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,Mary had a little lamb, \N
+Dialogue: 0,0:00:03.00,0:00:18.00,Default,,0,0,0,,little lamb, \N
+Dialogue: 0,0:00:06.99,0:00:21.99,Default,,0,0,0,,little lamb, \N
+Dialogue: 0,0:00:09.00,0:00:23.00,Default,,0,0,0,,Mary had a little lamb \N
+Dialogue: 0,0:00:12.34,0:00:27.34,Default,,0,0,0,,whose fleece was white as snow. 
diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami
index caa85a2..b97db46 100644
--- a/tests/ref/fate/sub-sami
+++ b/tests/ref/fate/sub-sami
@@ -1,21 +1,21 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N
-Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch 
-Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, 
-Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness 
-Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always 
-Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. 
-Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, 
-Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. 
-Dialogue: 0,0:01:13.00,9:59:59.99,Default,,0,0,0,,{\i1}End of: {\i0}\NPresident John F. Kennedy Speech 
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.00,0:00:00.01,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\N
+Dialogue: 0,0:00:00.01,0:00:08.80,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet the word go forth, from this time and place to friend and foe alike that the torch 
+Dialogue: 0,0:00:08.80,0:00:19.50,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nhas been passed to a new generation of Americans, born in this century, tempered by war, 
+Dialogue: 0,0:00:19.50,0:00:28.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Ndisciplined by a hard and bitter peace, proud of our ancient heritage, and unwilling to witness 
+Dialogue: 0,0:00:28.00,0:00:38.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nor permit the slow undoing of those human rights to which this nation has always 
+Dialogue: 0,0:00:38.00,0:00:46.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nbeen committed and to which we are committed today at home and around the world. 
+Dialogue: 0,0:00:46.00,0:01:01.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\NLet every nation know, whether it wishes us well or ill, that we shall pay any price, bear any burden, 
+Dialogue: 0,0:01:01.00,0:01:13.00,Default,,0,0,0,,{\i1}Pres. John F. Kennedy {\i0}\Nmeet any hardship, support any friend, oppose any foe, to ensure the survival and success of liberty. 
+Dialogue: 0,0:01:13.00,9:59:59.99,Default,,0,0,0,,{\i1}End of: {\i0}\NPresident John F. Kennedy Speech 
diff --git a/tests/ref/fate/sub-srt b/tests/ref/fate/sub-srt
index 40b20cd..4801372 100644
--- a/tests/ref/fate/sub-srt
+++ b/tests/ref/fate/sub-srt
@@ -1,49 +1,49 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,Don't show this text it may be used to insert hidden data
-Dialogue: 0,0:00:01.50,0:00:04.50,Default,,0,0,0,,SubRip subtitles capability tester 1.3o by ale5000\N{\b1}{\i1}Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others{\i0}{\b0}\N{\c&HFF0000&}This text should be blue{\c}\N{\c&HFF&}This text should be red{\c}\N{\c&H0&}This text should be black{\c}\N{\fnWebdings}If you see this with the normal font, the player don't (fully) support font face{\fn}
-Dialogue: 0,0:00:04.50,0:00:04.50,Default,,0,0,0,,Hidden
-Dialogue: 0,0:00:04.50,0:00:07.50,Default,,0,0,0,,{\fs8}This text should be small{\fs}\NThis text should be normal\N{\fs35}This text should be big{\fs}
-Dialogue: 0,0:00:07.50,0:00:11.50,Default,,0,0,0,,This should be an E with an accent: È\N日本語\N{\fs30}{\b1}{\i1}{\u1}This text should be bold, italics and underline{\u0}{\i0}{\b0}{\fs}\N{\fs9}{\c&HFF00&}This text should be small and green{\c}{\fs}\N{\fs9}{\c&HFF&}This text should be small and red{\c}{\fs}\N{\fs24}{\c&H2A2AA5&}This text should be big and brown{\c}{\fs}
-Dialogue: 0,0:00:11.50,0:00:14.50,Default,,0,0,0,,{\b1}This line should be bold{\b0}\N{\i1}This line should be italics{\i0}\N{\u1}This line should be underline{\u0}\N{\s1}This line should be strikethrough{\s0}\N{\u1}Both lines\Nshould be underline{\u0}
-Dialogue: 0,0:00:14.50,0:00:17.50,Default,,0,0,0,,>\NIt would be a good thing to\Nhide invalid html tags that are closed and show the text in them\N<invalid_tag_unclosed>but show un-closed invalid html tags\NShow not opened tags</invalid_tag_not_opened>\N<
-Dialogue: 0,0:00:17.50,0:00:20.50,Default,,0,0,0,,and also\Nhide invalid html tags with parameters that are closed and show the text in them\N<invalid_tag_uc par=5>but show un-closed invalid html tags\N{\u1}This text should be showed underlined without problems also: 2<3,5>1,4<6{\u0}\NThis shouldn't be underlined
-Dialogue: 0,0:00:20.50,0:00:21.50,Default,,0,0,0,,This text should be in the normal position...
-Dialogue: 0,0:00:21.50,0:00:22.50,Default,,0,0,0,,{\an5}{\pos(0,45)}This text should NOT be in the normal position
-Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,Implementation is the same of the ASS tag\N{\an8}This text should be at the\Ntop and horizontally centered
-Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an5}This text should be at the\Nmiddle and horizontally centered
-Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an2}This text should be at the\Nbottom and horizontally centered
-Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,This text should be at the\Ntop and horizontally at the left{\an7}
-Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,{\an4}This text should be at the\Nmiddle and horizontally at the left\N(The second position must be ignored)
-Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,{\an1}This text should be at the\Nbottom and horizontally at the left
-Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an9}This text should be at the\Ntop and horizontally at the right
-Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an6}This text should be at the\Nmiddle and horizontally at the right
-Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an3}This text should be at the\Nbottom and horizontally at the right
-Dialogue: 0,0:00:28.50,0:00:31.50,Default,,0,0,0,,{\fs6}{\c&HFF00&}This could be the {\fs35}m{\c&H0&}o{\c&HFF00&}st{\fs6} difficult thing to implement{\c}{\fs}
-Dialogue: 0,0:00:31.50,0:00:50.50,Default,,0,0,0,,First text
-Dialogue: 0,0:00:33.50,0:00:35.50,Default,,0,0,0,,Second, it shouldn't overlap first
-Dialogue: 0,0:00:35.50,0:00:37.50,Default,,0,0,0,,Third, it should replace second
-Dialogue: 0,0:00:36.50,0:00:50.50,Default,,0,0,0,,Fourth, it shouldn't overlap first and third
-Dialogue: 0,0:00:40.50,0:00:45.50,Default,,0,0,0,,Fifth, it should replace third
-Dialogue: 0,0:00:45.50,0:00:50.50,Default,,0,0,0,,Sixth, it shouldn't be\Nshowed overlapped
-Dialogue: 0,0:00:50.50,0:00:52.50,Default,,0,0,0,,TEXT 1 (bottom)
-Dialogue: 0,0:00:50.50,0:00:52.50,Default,,0,0,0,,text 2
-Dialogue: 0,0:00:52.50,0:00:54.50,Default,,0,0,0,,Hide these tags:\Nalso hide these tags:\Nbut show this: {normal text}
-Dialogue: 0,0:00:54.50,0:01:00.50,Default,,0,0,0,,{\an8}\N\ N is a forced line break\N\ h is a hard space\NNormal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.\NThe\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D
-Dialogue: 0,0:00:54.50,0:00:56.50,Default,,0,0,0,,{\an1}\N\h\h\h\h\hA (05 hard spaces followed by a letter)\NA (Normal  spaces followed by a letter)\NA (No hard spaces followed by a letter)
-Dialogue: 0,0:00:56.50,0:00:58.50,Default,,0,0,0,,\h\h\h\h\hA (05 hard spaces followed by a letter)\NA (Normal  spaces followed by a letter)\NA (No hard spaces followed by a letter)\NShow this: \TEST and this: \-)
-Dialogue: 0,0:00:58.50,0:01:00.50,Default,,0,0,0,,{\an3}\NA letter followed by 05 hard spaces: A\h\h\h\h\h\NA letter followed by normal  spaces: A\NA letter followed by no hard spaces: A\N05 hard  spaces between letters: A\h\h\h\h\hA\N5 normal spaces between letters: A     A\N\N^--Forced line break
-Dialogue: 0,0:01:00.50,0:01:02.50,Default,,0,0,0,,{\s1}Both line should be strikethrough,\Nyes.{\s0}\NCorrectly closed tags\Nshould be hidden.
-Dialogue: 0,0:01:02.50,0:01:04.50,Default,,0,0,0,,It shouldn't be strikethrough,\Nnot opened tag showed as text.</s>\NNot opened tag showed as text.</xxxxx>
-Dialogue: 0,0:01:04.50,0:01:06.50,Default,,0,0,0,,{\s1}Three lines should be strikethrough,\Nyes.\N<yyyy>Not closed tags showed as text
-Dialogue: 0,0:01:06.50,0:01:08.50,Default,,0,0,0,,{\s1}Both line should be strikethrough but\Nthe wrong closing tag should be showed</b>
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,,Don't show this text it may be used to insert hidden data
+Dialogue: 0,0:00:01.50,0:00:04.50,Default,,0,0,0,,SubRip subtitles capability tester 1.3o by ale5000\N{\b1}{\i1}Use VLC 1.1 or higher as reference for most things and MPC Home Cinema for others{\i0}{\b0}\N{\c&HFF0000&}This text should be blue{\c}\N{\c&HFF&}This text should be red{\c}\N{\c&H0&}This text should be black{\c}\N{\fnWebdings}If you see this with the normal font, the player don't (fully) support font face{\fn}
+Dialogue: 0,0:00:04.50,0:00:04.50,Default,,0,0,0,,Hidden
+Dialogue: 0,0:00:04.50,0:00:07.50,Default,,0,0,0,,{\fs8}This text should be small{\fs}\NThis text should be normal\N{\fs35}This text should be big{\fs}
+Dialogue: 0,0:00:07.50,0:00:11.50,Default,,0,0,0,,This should be an E with an accent: È\N日本語\N{\fs30}{\b1}{\i1}{\u1}This text should be bold, italics and underline{\u0}{\i0}{\b0}{\fs}\N{\fs9}{\c&HFF00&}This text should be small and green{\c}{\fs}\N{\fs9}{\c&HFF&}This text should be small and red{\c}{\fs}\N{\fs24}{\c&H2A2AA5&}This text should be big and brown{\c}{\fs}
+Dialogue: 0,0:00:11.50,0:00:14.50,Default,,0,0,0,,{\b1}This line should be bold{\b0}\N{\i1}This line should be italics{\i0}\N{\u1}This line should be underline{\u0}\N{\s1}This line should be strikethrough{\s0}\N{\u1}Both lines\Nshould be underline{\u0}
+Dialogue: 0,0:00:14.50,0:00:17.50,Default,,0,0,0,,>\NIt would be a good thing to\Nhide invalid html tags that are closed and show the text in them\N<invalid_tag_unclosed>but show un-closed invalid html tags\NShow not opened tags</invalid_tag_not_opened>\N<
+Dialogue: 0,0:00:17.50,0:00:20.50,Default,,0,0,0,,and also\Nhide invalid html tags with parameters that are closed and show the text in them\N<invalid_tag_uc par=5>but show un-closed invalid html tags\N{\u1}This text should be showed underlined without problems also: 2<3,5>1,4<6{\u0}\NThis shouldn't be underlined
+Dialogue: 0,0:00:20.50,0:00:21.50,Default,,0,0,0,,This text should be in the normal position...
+Dialogue: 0,0:00:21.50,0:00:22.50,Default,,0,0,0,,{\an5}{\pos(0,45)}This text should NOT be in the normal position
+Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,Implementation is the same of the ASS tag\N{\an8}This text should be at the\Ntop and horizontally centered
+Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an5}This text should be at the\Nmiddle and horizontally centered
+Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an2}This text should be at the\Nbottom and horizontally centered
+Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,This text should be at the\Ntop and horizontally at the left{\an7}
+Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,{\an4}This text should be at the\Nmiddle and horizontally at the left\N(The second position must be ignored)
+Dialogue: 0,0:00:24.50,0:00:26.50,Default,,0,0,0,,{\an1}This text should be at the\Nbottom and horizontally at the left
+Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an9}This text should be at the\Ntop and horizontally at the right
+Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an6}This text should be at the\Nmiddle and horizontally at the right
+Dialogue: 0,0:00:26.50,0:00:28.50,Default,,0,0,0,,{\an3}This text should be at the\Nbottom and horizontally at the right
+Dialogue: 0,0:00:28.50,0:00:31.50,Default,,0,0,0,,{\fs6}{\c&HFF00&}This could be the {\fs35}m{\c&H0&}o{\c&HFF00&}st{\fs6} difficult thing to implement{\c}{\fs}
+Dialogue: 0,0:00:31.50,0:00:50.50,Default,,0,0,0,,First text
+Dialogue: 0,0:00:33.50,0:00:35.50,Default,,0,0,0,,Second, it shouldn't overlap first
+Dialogue: 0,0:00:35.50,0:00:37.50,Default,,0,0,0,,Third, it should replace second
+Dialogue: 0,0:00:36.50,0:00:50.50,Default,,0,0,0,,Fourth, it shouldn't overlap first and third
+Dialogue: 0,0:00:40.50,0:00:45.50,Default,,0,0,0,,Fifth, it should replace third
+Dialogue: 0,0:00:45.50,0:00:50.50,Default,,0,0,0,,Sixth, it shouldn't be\Nshowed overlapped
+Dialogue: 0,0:00:50.50,0:00:52.50,Default,,0,0,0,,TEXT 1 (bottom)
+Dialogue: 0,0:00:50.50,0:00:52.50,Default,,0,0,0,,text 2
+Dialogue: 0,0:00:52.50,0:00:54.50,Default,,0,0,0,,Hide these tags:\Nalso hide these tags:\Nbut show this: {normal text}
+Dialogue: 0,0:00:54.50,0:01:00.50,Default,,0,0,0,,{\an8}\N\ N is a forced line break\N\ h is a hard space\NNormal spaces at the start and at the end of the line are trimmed while hard spaces are not trimmed.\NThe\hline\hwill\hnever\hbreak\hautomatically\hright\hbefore\hor\hafter\ha\hhard\hspace.\h:-D
+Dialogue: 0,0:00:54.50,0:00:56.50,Default,,0,0,0,,{\an1}\N\h\h\h\h\hA (05 hard spaces followed by a letter)\NA (Normal  spaces followed by a letter)\NA (No hard spaces followed by a letter)
+Dialogue: 0,0:00:56.50,0:00:58.50,Default,,0,0,0,,\h\h\h\h\hA (05 hard spaces followed by a letter)\NA (Normal  spaces followed by a letter)\NA (No hard spaces followed by a letter)\NShow this: \TEST and this: \-)
+Dialogue: 0,0:00:58.50,0:01:00.50,Default,,0,0,0,,{\an3}\NA letter followed by 05 hard spaces: A\h\h\h\h\h\NA letter followed by normal  spaces: A\NA letter followed by no hard spaces: A\N05 hard  spaces between letters: A\h\h\h\h\hA\N5 normal spaces between letters: A     A\N\N^--Forced line break
+Dialogue: 0,0:01:00.50,0:01:02.50,Default,,0,0,0,,{\s1}Both line should be strikethrough,\Nyes.{\s0}\NCorrectly closed tags\Nshould be hidden.
+Dialogue: 0,0:01:02.50,0:01:04.50,Default,,0,0,0,,It shouldn't be strikethrough,\Nnot opened tag showed as text.</s>\NNot opened tag showed as text.</xxxxx>
+Dialogue: 0,0:01:04.50,0:01:06.50,Default,,0,0,0,,{\s1}Three lines should be strikethrough,\Nyes.\N<yyyy>Not closed tags showed as text
+Dialogue: 0,0:01:06.50,0:01:08.50,Default,,0,0,0,,{\s1}Both line should be strikethrough but\Nthe wrong closing tag should be showed</b>
diff --git a/tests/ref/fate/sub-stl b/tests/ref/fate/sub-stl
index cde33cd..5c74850 100644
--- a/tests/ref/fate/sub-stl
+++ b/tests/ref/fate/sub-stl
@@ -1,29 +1,29 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:31.02,0:00:33.00,Default,,0,0,0,,Hello, my name is Axel Kornmesser.
-Dialogue: 0,0:00:45.02,0:00:49.13,Default,,0,0,0,,It is always a pleasure to work with ESA astronomers.
-Dialogue: 0,0:00:49.13,0:00:52.03,Default,,0,0,0,,The "Eyes on The Skies" documentary
-Dialogue: 0,0:00:52.03,0:00:55.09,Default,,0,0,0,,was our second collaboration
-Dialogue: 0,0:00:55.09,0:00:58.07,Default,,0,0,0,,after a great \Nexperience in 2005,
-Dialogue: 0,0:00:58.07,0:00:59.20,Default,,0,0,0,,when \Nwe did the story about the
-Dialogue: 0,0:00:59.20,0:01:04.01,Default,,0,0,0,,Hubble Telescope "15 Years of Discovery".
-Dialogue: 0,0:01:04.16,0:01:07.04,Default,,0,0,0,,It was a lot of fun again.
-Dialogue: 0,0:01:15.04,0:01:18.16,Default,,0,0,0,,We usually \N don't get the final film \Nbefore we start composing
-Dialogue: 0,0:01:18.21,0:01:22.02,Default,,0,0,0,,We had a script and many details about the story,
-Dialogue: 0,0:01:22.10,0:01:26.08,Default,,0,0,0,,and so we worked\N in parallel \Nin the movie production
-Dialogue: 0,0:01:27.04,0:01:30.17,Default,,0,0,0,,The largest part of \N the soundtrack \Nwas done without seeing a movie
-Dialogue: 0,0:01:30.17,0:01:36.06,Default,,0,0,0,,It was no problem, but very inspiring \Nand a free working process.
-Dialogue: 0,0:02:08.13,0:02:10.23,Default,,0,0,0,,Galileo's theme is one of my favourites.
-Dialogue: 0,0:02:10.23,0:02:14.10,Default,,0,0,0,,We did a lot of different versions \Nabout the central theme.
-Dialogue: 0,0:02:14.10,0:02:18.02,Default,,0,0,0,,For the 17th century \N we used a nice harpsichord
-Dialogue: 0,0:02:19.05,0:02:22.09,Default,,0,0,0,,and so we landed directly into Galileo's time.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:31.02,0:00:33.00,Default,,0,0,0,,Hello, my name is Axel Kornmesser.
+Dialogue: 0,0:00:45.02,0:00:49.13,Default,,0,0,0,,It is always a pleasure to work with ESA astronomers.
+Dialogue: 0,0:00:49.13,0:00:52.03,Default,,0,0,0,,The "Eyes on The Skies" documentary
+Dialogue: 0,0:00:52.03,0:00:55.09,Default,,0,0,0,,was our second collaboration
+Dialogue: 0,0:00:55.09,0:00:58.07,Default,,0,0,0,,after a great \Nexperience in 2005,
+Dialogue: 0,0:00:58.07,0:00:59.20,Default,,0,0,0,,when \Nwe did the story about the
+Dialogue: 0,0:00:59.20,0:01:04.01,Default,,0,0,0,,Hubble Telescope "15 Years of Discovery".
+Dialogue: 0,0:01:04.16,0:01:07.04,Default,,0,0,0,,It was a lot of fun again.
+Dialogue: 0,0:01:15.04,0:01:18.16,Default,,0,0,0,,We usually \N don't get the final film \Nbefore we start composing
+Dialogue: 0,0:01:18.21,0:01:22.02,Default,,0,0,0,,We had a script and many details about the story,
+Dialogue: 0,0:01:22.10,0:01:26.08,Default,,0,0,0,,and so we worked\N in parallel \Nin the movie production
+Dialogue: 0,0:01:27.04,0:01:30.17,Default,,0,0,0,,The largest part of \N the soundtrack \Nwas done without seeing a movie
+Dialogue: 0,0:01:30.17,0:01:36.06,Default,,0,0,0,,It was no problem, but very inspiring \Nand a free working process.
+Dialogue: 0,0:02:08.13,0:02:10.23,Default,,0,0,0,,Galileo's theme is one of my favourites.
+Dialogue: 0,0:02:10.23,0:02:14.10,Default,,0,0,0,,We did a lot of different versions \Nabout the central theme.
+Dialogue: 0,0:02:14.10,0:02:18.02,Default,,0,0,0,,For the 17th century \N we used a nice harpsichord
+Dialogue: 0,0:02:19.05,0:02:22.09,Default,,0,0,0,,and so we landed directly into Galileo's time.
diff --git a/tests/ref/fate/sub-subripenc b/tests/ref/fate/sub-subripenc
index 1f1e031..937e198 100644
--- a/tests/ref/fate/sub-subripenc
+++ b/tests/ref/fate/sub-subripenc
@@ -1,6 +1,6 @@
 1
 00:00:00,970 --> 00:00:02,540
-- Test 1.
+- Test 1.
 - Test 2.
 
 2
@@ -9,6 +9,6 @@ Test 3.
 
 3
 00:00:05,850 --> 00:00:08,140
-- Test 4.
+- Test 4.
 - Test 5.
 
diff --git a/tests/ref/fate/sub-subviewer b/tests/ref/fate/sub-subviewer
index 19944f6..363b2e3 100644
--- a/tests/ref/fate/sub-subviewer
+++ b/tests/ref/fate/sub-subviewer
@@ -1,15 +1,15 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:01:00.10,0:02:00.20,Default,,0,0,0,,Hello.\NWorld!
-Dialogue: 0,0:02:00.30,0:03:00.40,Default,,0,0,0,,\Nfoo\Nbar\Nbla\Nmixed with br
-Dialogue: 0,0:03:04.12,0:03:10.20,Default,,0,0,0,,Another event.
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:01:00.10,0:02:00.20,Default,,0,0,0,,Hello.\NWorld!
+Dialogue: 0,0:02:00.30,0:03:00.40,Default,,0,0,0,,\Nfoo\Nbar\Nbla\Nmixed with br
+Dialogue: 0,0:03:04.12,0:03:10.20,Default,,0,0,0,,Another event.
diff --git a/tests/ref/fate/sub-subviewer1 b/tests/ref/fate/sub-subviewer1
index a75406b..d510ce4 100644
--- a/tests/ref/fate/sub-subviewer1
+++ b/tests/ref/fate/sub-subviewer1
@@ -1,22 +1,22 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:03:45.00,0:03:48.00,Default,,0,0,0,,- ToIerábiIis?\N- Azt jeIenti: tűrhető.
-Dialogue: 0,0:03:48.00,0:03:51.00,Default,,0,0,0,,Tudom, mit jeIent. Megnézhetem?
-Dialogue: 0,0:03:52.00,0:03:54.00,Default,,0,0,0,,TiszteIt bírónő.
-Dialogue: 0,0:03:57.00,0:04:00.00,Default,,0,0,0,,KépzeIje magát\Na környékbeIi gyermekek heIyébe.
-Dialogue: 0,0:04:01.00,0:04:05.00,Default,,0,0,0,,Naphosszat monoton, döngöIő zaj\Nszaggatja a dobhártyájukat.
-Dialogue: 0,0:04:05.00,0:04:10.00,Default,,0,0,0,,Ahogy egyre föIébük tornyosuI,\Nrájuk veti sötét árnyékát.
-Dialogue: 0,0:04:10.00,0:04:15.00,Default,,0,0,0,,Ez a feIhőkarcoIó, az emberi\Nmohóság újabb emIékműve.
-Dialogue: 0,1:50:38.00,1:50:41.00,Default,,0,0,0,,készen áIIok.
-Dialogue: 0,1:51:00.00,1:51:03.00,Default,,0,0,0,,Joe ... Miguel keres.
-Dialogue: 0,2:00:18.00,9:59:59.99,Default,,0,0,0,,Magyar szöveg: Nikowvitz Oszkár
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:03:45.00,0:03:48.00,Default,,0,0,0,,- ToIerábiIis?\N- Azt jeIenti: tűrhető.
+Dialogue: 0,0:03:48.00,0:03:51.00,Default,,0,0,0,,Tudom, mit jeIent. Megnézhetem?
+Dialogue: 0,0:03:52.00,0:03:54.00,Default,,0,0,0,,TiszteIt bírónő.
+Dialogue: 0,0:03:57.00,0:04:00.00,Default,,0,0,0,,KépzeIje magát\Na környékbeIi gyermekek heIyébe.
+Dialogue: 0,0:04:01.00,0:04:05.00,Default,,0,0,0,,Naphosszat monoton, döngöIő zaj\Nszaggatja a dobhártyájukat.
+Dialogue: 0,0:04:05.00,0:04:10.00,Default,,0,0,0,,Ahogy egyre föIébük tornyosuI,\Nrájuk veti sötét árnyékát.
+Dialogue: 0,0:04:10.00,0:04:15.00,Default,,0,0,0,,Ez a feIhőkarcoIó, az emberi\Nmohóság újabb emIékműve.
+Dialogue: 0,1:50:38.00,1:50:41.00,Default,,0,0,0,,készen áIIok.
+Dialogue: 0,1:51:00.00,1:51:03.00,Default,,0,0,0,,Joe ... Miguel keres.
+Dialogue: 0,2:00:18.00,9:59:59.99,Default,,0,0,0,,Magyar szöveg: Nikowvitz Oszkár
diff --git a/tests/ref/fate/sub-vplayer b/tests/ref/fate/sub-vplayer
index 6e804f6..7bdbe6b 100644
--- a/tests/ref/fate/sub-vplayer
+++ b/tests/ref/fate/sub-vplayer
@@ -1,15 +1,15 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:00.12,0:00:23.51,Default,,0,0,0,,Hello
-Dialogue: 0,0:00:23.51,0:01:02.05,Default,,0,0,0,,World
-Dialogue: 0,0:01:02.05,9:59:59.99,Default,,0,0,0,,!\Nnewline
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.12,0:00:23.51,Default,,0,0,0,,Hello
+Dialogue: 0,0:00:23.51,0:01:02.05,Default,,0,0,0,,World
+Dialogue: 0,0:01:02.05,9:59:59.99,Default,,0,0,0,,!\Nnewline
diff --git a/tests/ref/fate/sub-webvtt b/tests/ref/fate/sub-webvtt
index 8c63a90..97222ec 100644
--- a/tests/ref/fate/sub-webvtt
+++ b/tests/ref/fate/sub-webvtt
@@ -1,27 +1,27 @@
-[Script Info]
-; Script generated by FFmpeg/Lavc
-ScriptType: v4.00+
-PlayResX: 384
-PlayResY: 288
-
-[V4+ Styles]
-Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
-Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
-
-[Events]
-Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:11.00,0:00:13.00,Default,,0,0,0,,We are in New York City\NRandom line added
-Dialogue: 0,0:00:13.00,0:00:16.00,Default,,0,0,0,,We're actually at the Lucern Hotel, just down the street
-Dialogue: 0,0:00:16.00,0:00:18.00,Default,,0,0,0,,from the American Museum of Natural History
-Dialogue: 0,0:00:18.00,0:00:20.00,Default,,0,0,0,,And with me is Neil deGrasse Tyson
-Dialogue: 0,0:00:20.00,0:00:22.00,Default,,0,0,0,,Astrophysicist, Director of the Hayden Planetarium
-Dialogue: 0,0:00:22.00,0:00:24.00,Default,,0,0,0,,at the AMNH.
-Dialogue: 0,0:00:24.00,0:00:26.00,Default,,0,0,0,,Thank you for walking down here.
-Dialogue: 0,0:00:27.00,0:00:30.00,Default,,0,0,0,,And I want to do a follow-up on the last conversation we did.\Nmultiple lines\Nagain
-Dialogue: 0,0:00:30.00,0:00:31.50,Default,,0,0,0,,When we e-mailed—
-Dialogue: 0,0:00:30.50,0:00:32.50,Default,,0,0,0,,Didn't we {\b1}talk {\i1}about\N{\i0} enough{\b0} in that conversation? \{I'm not an ASS comment\}
-Dialogue: 0,0:00:32.00,0:00:35.50,Default,,0,0,0,,No! No no no no; 'cos 'cos obviously 'cos
-Dialogue: 0,0:00:32.50,0:00:33.50,Default,,0,0,0,,{\i1}Laughs{\i0}
-Dialogue: 0,0:00:35.50,0:00:38.00,Default,,0,0,0,,You know I'm so excited my glasses are falling off here.
-Dialogue: 0,0:00:50.00,0:00:51.13,Default,,0,0,0,,This event and the following\None have CLRF
-Dialogue: 0,0:59:00.12,1:23:45.68,Default,,0,0,0,,Obiwan Kenobi
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:11.00,0:00:13.00,Default,,0,0,0,,We are in New York City\NRandom line added
+Dialogue: 0,0:00:13.00,0:00:16.00,Default,,0,0,0,,We're actually at the Lucern Hotel, just down the street
+Dialogue: 0,0:00:16.00,0:00:18.00,Default,,0,0,0,,from the American Museum of Natural History
+Dialogue: 0,0:00:18.00,0:00:20.00,Default,,0,0,0,,And with me is Neil deGrasse Tyson
+Dialogue: 0,0:00:20.00,0:00:22.00,Default,,0,0,0,,Astrophysicist, Director of the Hayden Planetarium
+Dialogue: 0,0:00:22.00,0:00:24.00,Default,,0,0,0,,at the AMNH.
+Dialogue: 0,0:00:24.00,0:00:26.00,Default,,0,0,0,,Thank you for walking down here.
+Dialogue: 0,0:00:27.00,0:00:30.00,Default,,0,0,0,,And I want to do a follow-up on the last conversation we did.\Nmultiple lines\Nagain
+Dialogue: 0,0:00:30.00,0:00:31.50,Default,,0,0,0,,When we e-mailed—
+Dialogue: 0,0:00:30.50,0:00:32.50,Default,,0,0,0,,Didn't we {\b1}talk {\i1}about\N{\i0} enough{\b0} in that conversation? \{I'm not an ASS comment\}
+Dialogue: 0,0:00:32.00,0:00:35.50,Default,,0,0,0,,No! No no no no; 'cos 'cos obviously 'cos
+Dialogue: 0,0:00:32.50,0:00:33.50,Default,,0,0,0,,{\i1}Laughs{\i0}
+Dialogue: 0,0:00:35.50,0:00:38.00,Default,,0,0,0,,You know I'm so excited my glasses are falling off here.
+Dialogue: 0,0:00:50.00,0:00:51.13,Default,,0,0,0,,This event and the following\None have CLRF
+Dialogue: 0,0:59:00.12,1:23:45.68,Default,,0,0,0,,Obiwan Kenobi
-- 
1.9.5.msysgit.1



More information about the ffmpeg-devel mailing list