diff --git a/encoder/encoder.c b/encoder/encoder.c
index b1a99e6..648782b 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -483,7 +483,7 @@ static int x264_validate_parameters( x264_t *h, int b_open )
          * and VBV compliance.  Capped at an arbitrary 4 rows per thread. */
         if( h->param.b_sliced_threads )
         {
-            int max_threads = (h->param.i_height+15)/16 / 4;
+            int max_threads = X264_MAX(1, (h->param.i_height+15)/16 / 4);
             h->param.i_threads = X264_MIN( h->param.i_threads, max_threads );
         }
     }
