diff --git a/ffmpeg.c b/ffmpeg.c
index aac071e747a8d8e3160511034d3c06f9bb56e3f2..341afe59409d9981bb97ef6b1198d9334c56308d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -967,7 +967,7 @@ static void do_video_out(AVFormatContext *s,
             ret = avcodec_encode_video(enc,
                                        bit_buffer, bit_buffer_size,
                                        &big_picture);
-            if (ret == -1) {
+            if (ret < 0) {
                 fprintf(stderr, "Video encoding failed\n");
                 av_exit(1);
             }