diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4b6f2ed47e85247269dd24395f42aea58f4be1f7..918954a43be0a051f19b0d754d5b8e86492ca971 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1841,6 +1841,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
             sub->pts = av_rescale_q(avpkt->pts,
                                     avctx->pkt_timebase, AV_TIME_BASE_Q);
         ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &tmp);
+        sub->format = sub->num_rects && sub->rects[0]->ass;
 
         avctx->pkt = NULL;
         if (did_split) {