diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index ea269ef4ae7fe3c1f929621ea32cdc53bfd7096a..7f11869a688f76614dc0462e376279a1307cd9d7 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -601,7 +601,7 @@ int MPV_encode_init(AVCodecContext *avctx)
         return -1;
     }
     
-    if(s->max_b_frames && (s->codec_id != CODEC_ID_MPEG4 || s->codec_id != CODEC_ID_MPEG1VIDEO)){
+    if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO){
         fprintf(stderr, "b frames not supporetd by codec\n");
         return -1;
     }