diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9036588ee4a3445928932c27c1644d8a8a937d18..6e7837ad018c41fe58242608232f4c0280c22442 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -441,6 +441,11 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
         return -1;
     }
 
+    if(s->avctx->thread_count < 1){
+        av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n");
+        return -1;
+    }
+
     if(s->avctx->thread_count > 1)
         s->rtp_mode= 1;