diff --git a/avconv.c b/avconv.c
index 972e62ba8da211d7dea706fa4b1bb70c18da71a0..c94e8f83fce9628729897ad1da14053af6e35e60 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1963,7 +1963,9 @@ static int transcode_init(void)
                 av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
                                              "It takes bits/s as argument, not kbits/s\n");
         } else {
-            av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts);
+            ret = av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts);
+            if (ret < 0)
+                return ret;
         }
 
         ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);