diff --git a/ffmpeg.c b/ffmpeg.c
index 9cc722fb00b364568752d4930ddc214c310687f5..7907f97766f8cdb42be0b36587b1115b714fab45 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1407,6 +1407,9 @@ static int check_output_constraints(InputStream *ist, OutputStream *ost)
     if (ost->source_index != ist_index)
         return 0;
 
+    if (ost->finished)
+        return 0;
+
     if (of->start_time != AV_NOPTS_VALUE && ist->pts < of->start_time)
         return 0;