diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8774b7366a9715e2588e529b1593960bd67c3a88..4888105319571d5a8b41dc3911877649bfa3834b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -522,7 +522,7 @@ typedef struct AVFormatContext {
      */
     unsigned int max_picture_buffer;
 
-    int nb_chapters;
+    unsigned int nb_chapters;
     AVChapter **chapters;
 } AVFormatContext;