--- a/libavformat/matroskadec.c	2011-12-31 15:08:09.736914352 +0100
+++ b/libavformat/matroskadec.c	2011-12-31 22:39:58.835210123 +0100
@@ -1058,6 +1058,33 @@
     return -1;
 }
 
+static void matroska_fix_srt_packet(MatroskaDemuxContext *matroska,
+                                    AVPacket *pkt, uint64_t display_duration)
+{
+   char *text = pkt->data, *subtitle;
+   int len = pkt->size + 36 + FF_INPUT_BUFFER_PADDING_SIZE;
+
+   int64_t end_pts = pkt->pts + display_duration;
+   int sc = matroska->time_scale * pkt->pts / 1000000;
+   int ec = matroska->time_scale * end_pts  / 1000000;
+   int sh, sm, ss, eh, em, es;
+   sh = sc/3600000;  sc -= 3600000*sh;
+   sm = sc/  60000;  sc -=   60000*sm;
+   ss = sc/   1000;  sc -=    1000*ss;
+   eh = ec/3600000;  ec -= 3600000*eh;
+   em = ec/  60000;  ec -=   60000*em;
+   es = ec/   1000;  ec -=    1000*es;
+
+   subtitle = av_malloc(len);
+
+   snprintf(subtitle, len, "0\r\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\r\n%s\r\n",
+            sh, sm, ss, sc, eh, em, es, ec, text);
+
+   av_free(pkt->data);
+   pkt->data = subtitle;
+   pkt->size = strlen(subtitle);
+}
+
 static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
                                     AVPacket *pkt, uint64_t display_duration)
 {
@@ -1948,6 +1975,9 @@
                 else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
                     pkt->duration = duration;
 
+                if (st->codec->codec_id == CODEC_ID_SRT)
+                    matroska_fix_srt_packet(matroska, pkt, duration);
+
                 if (st->codec->codec_id == CODEC_ID_SSA)
                     matroska_fix_ass_packet(matroska, pkt, duration);
 
