diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 31e7a47b00e4eb70dcf314474a90c522d8a322b3..9691e384f43dd706e863cd25cd94fb2bac6e14c5 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -175,6 +175,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header,
         return -1;
     sub_header->rects = NULL;
     sub_header->num_rects = 0;
+    sub_header->format = 0;
     sub_header->start_display_time = 0;
     sub_header->end_display_time = 0;
 
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index 0274705fb2fef302a7719c2acd998c0831bdfa74..35b00a54b4c489a69f1bcba7c8ec13d492f4c62f 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -51,6 +51,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     int w, h, x, y, rlelen, i;
     GetBitContext gb;
 
+    sub->format = 0;
+
     // check that at least header fits
     if (buf_size < 27 + 7 * 2 + 4 * 3) {
         av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");