diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index dd0f7c9..9faf901 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -271,6 +271,65 @@ int OpenDemux( vlc_object_t *p_this )
 
         case CODEC_TYPE_SUBTITLE:
             es_format_Init( &fmt, SPU_ES, fcc );
+            if( strncmp( p_sys->ic->iformat->name, "matroska", 8 ) == 0 &&
+                cc->codec_id == CODEC_ID_DVD_SUBTITLE )
+            {
+                char *pos;
+
+                pos = strstr( (char*)cc->extradata, "size:" );
+                if( pos && sscanf( pos, "size: %dx%d",
+                    &fmt.subs.spu.i_original_frame_width, 
+                    &fmt.subs.spu.i_original_frame_height ) == 2 )
+                {
+                    msg_Dbg( p_demux, "original frame size: %dx%d", 
+                             fmt.subs.spu.i_original_frame_width, 
+                             fmt.subs.spu.i_original_frame_height );
+                }
+                else
+                {
+                    msg_Warn( p_demux, "reading original frame size failed" );
+                }
+
+                pos = strstr( (char*)cc->extradata, "palette:" );
+                if( pos && sscanf( pos,
+                            "palette: %x, %x, %x, %x, %x, %x, %x, %x, "
+                                     "%x, %x, %x, %x, %x, %x, %x, %x",
+                        &fmt.subs.spu.palette[1], 
+                        &fmt.subs.spu.palette[2], &fmt.subs.spu.palette[3],
+                        &fmt.subs.spu.palette[4], &fmt.subs.spu.palette[5], 
+                        &fmt.subs.spu.palette[6], &fmt.subs.spu.palette[7],
+                        &fmt.subs.spu.palette[8], &fmt.subs.spu.palette[9], 
+                        &fmt.subs.spu.palette[10], &fmt.subs.spu.palette[11],
+                        &fmt.subs.spu.palette[12], &fmt.subs.spu.palette[13], 
+                        &fmt.subs.spu.palette[14], &fmt.subs.spu.palette[15],
+                        &fmt.subs.spu.palette[16] ) == 16 )
+                {
+                    int j;
+                    for( j = 1; j < 17; j++ )
+                    {
+                        uint8_t r = 0, g = 0, b = 0;
+                        uint8_t y = 0, u = 0, v = 0;
+                        r = (fmt.subs.spu.palette[j] >> 16) & 0xff;
+                        g = (fmt.subs.spu.palette[j] >> 8) & 0xff;
+                        b = (fmt.subs.spu.palette[j] >> 0) & 0xff;
+                        y = (uint8_t) __MIN(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13, 235);
+                        u = (uint8_t) __MIN(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13, 240);
+                        v = (uint8_t) __MIN(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13, 240);
+                        fmt.subs.spu.palette[j] = 0;
+                        fmt.subs.spu.palette[j] |= (y&0xff)<<16;
+                        fmt.subs.spu.palette[j] |= (u&0xff);
+                        fmt.subs.spu.palette[j] |= (v&0xff)<<8;
+
+                    }
+                    fmt.subs.spu.palette[0] =  0xBeef; 
+                    msg_Dbg( p_demux, "vobsub palette read" );
+                }
+                else
+                {
+                    msg_Warn( p_demux, "reading original palette failed" );
+                }
+            }
+
             psz_type = "subtitle";
             break;
 
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 26d43b4..3ac0462 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1110,6 +1110,52 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                 {
                     msg_Warn( &sys.demuxer, "reading original frame size for vobsub failed" );
                 }
+                p_start = strstr( p_buf, "palette:" );
+                if( p_start && sscanf( p_start,
+                            "palette: %x, %x, %x, %x, %x, %x, %x, %x, "
+                                     "%x, %x, %x, %x, %x, %x, %x, %x",
+                        &tracks[i_track]->fmt.subs.spu.palette[1],
+                        &tracks[i_track]->fmt.subs.spu.palette[2],
+						&tracks[i_track]->fmt.subs.spu.palette[3],
+                        &tracks[i_track]->fmt.subs.spu.palette[4],
+						&tracks[i_track]->fmt.subs.spu.palette[5],
+                        &tracks[i_track]->fmt.subs.spu.palette[6],
+						&tracks[i_track]->fmt.subs.spu.palette[7],
+                        &tracks[i_track]->fmt.subs.spu.palette[8],
+						&tracks[i_track]->fmt.subs.spu.palette[9],
+						
+                        &tracks[i_track]->fmt.subs.spu.palette[10],
+						&tracks[i_track]->fmt.subs.spu.palette[11],
+                        &tracks[i_track]->fmt.subs.spu.palette[12],
+						&tracks[i_track]->fmt.subs.spu.palette[13],
+                        &tracks[i_track]->fmt.subs.spu.palette[14],
+						&tracks[i_track]->fmt.subs.spu.palette[15],
+                        &tracks[i_track]->fmt.subs.spu.palette[16] ) == 16 )
+                {
+                    int j;
+                    for( j = 1; j < 17; j++ )
+                    {
+                        uint8_t r = 0, g = 0, b = 0;
+                        uint8_t y = 0, u = 0, v = 0;
+                        r = (tracks[i_track]->fmt.subs.spu.palette[j] >> 16) & 0xff;
+                        g = (tracks[i_track]->fmt.subs.spu.palette[j] >> 8) & 0xff;
+                        b = (tracks[i_track]->fmt.subs.spu.palette[j] >> 0) & 0xff;
+                        y = (uint8_t) __MIN(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13, 235);
+                        u = (uint8_t) __MIN(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13, 240);
+                        v = (uint8_t) __MIN(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13, 240);
+                        tracks[i_track]->fmt.subs.spu.palette[j] = 0;
+                        tracks[i_track]->fmt.subs.spu.palette[j] |= (y&0xff)<<16;
+                        tracks[i_track]->fmt.subs.spu.palette[j] |= (u&0xff);
+                        tracks[i_track]->fmt.subs.spu.palette[j] |= (v&0xff)<<8;
+
+                    }
+                    tracks[i_track]->fmt.subs.spu.palette[0] =  0xBeef;
+                    msg_Dbg( &sys.demuxer, "vobsub palette read" );
+                }
+                else
+                {
+                    msg_Warn( &sys.demuxer, "reading original palette failed" );
+                }
                 free( p_buf );
             }
         }
