diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index cabc6864e7e63115f85cf3171b763480a1c586d7..ade8df6abc54e7c45561a24fadd626a3f3ac74f2 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3120,7 +3120,7 @@ static void set_encoder_id(OutputFile *of, OutputStream *ost)
     uint8_t *encoder_string;
     int encoder_string_len;
     int format_flags = 0;
-    int codec_flags = 0;
+    int codec_flags = ost->enc_ctx->flags;
 
     if (av_dict_get(ost->st->metadata, "encoder",  NULL, 0))
         return;