diff --git a/ffmpeg.c b/ffmpeg.c
index 62a548761cfe302b01b435ea292025325a6ea2bd..bbd30190cbd61d16a7765b5ceed4cecf4a087f88 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1822,9 +1822,12 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
         FFSWAP(AVSubtitle, subtitle,    ist->prev_sub.subtitle);
     }
 
+    if (!*got_output)
+        return ret;
+
     sub2video_update(ist, &subtitle);
 
-    if (!*got_output || !subtitle.num_rects)
+    if (!subtitle.num_rects)
         return ret;
 
     for (i = 0; i < nb_output_streams; i++) {