diff --git a/doc/APIchanges b/doc/APIchanges
index 7b267a79ac..4731e14cb1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,12 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2021-10-13 - xxxxxxxxxx - lavf 59.7.100 - avio.h
+  Deprecate AVIOContext.written. Originally added as a private entry in
+  commit 3f75e5116b900f1428aa13041fc7d6301bf1988a, its grouping with
+  the comment noting its private state was missed during merging of the field
+  from Libav (most likely due to an already existing field in between).
+
 2021-09-21 - xxxxxxxxxx - lavu 57.7.100 - pixfmt.h
   Add AV_PIX_FMT_X2BGR10.
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index a7b56ab667..5e60c2e35c 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -290,7 +290,13 @@ typedef struct AVIOContext {
      */
     int ignore_boundary_point;
 
+#if FF_API_AVIOCONTEXT_WRITTEN
+    /**
+     * @deprecated field utilized privately by libavformat.
+     */
+    attribute_deprecated
     int64_t written;
+#endif
 
     /**
      * Maximum reached position before a backward seek in the write buffer,
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index b18a56ef19..f21f1c89df 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -22,6 +22,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/crc.h"
 #include "libavutil/dict.h"
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
@@ -124,7 +125,11 @@ void ffio_init_context(FFIOContext *ctx,
     ctx->current_type        = AVIO_DATA_MARKER_UNKNOWN;
     ctx->last_time           = AV_NOPTS_VALUE;
     ctx->short_seek_get      = NULL;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
     s->written               = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 AVIOContext *avio_alloc_context(
@@ -166,7 +171,11 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
         } else {
             if (s->pos + len > ctx->written_output_size) {
                 ctx->written_output_size = s->pos + len;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
                 s->written = ctx->written_output_size;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
             }
         }
     }
diff --git a/libavformat/version.h b/libavformat/version.h
index d5dd22059b..de780124c7 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   6
+#define LIBAVFORMAT_VERSION_MINOR   7
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -61,6 +61,9 @@
 #ifndef FF_API_COMPUTE_PKT_FIELDS2
 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_AVIOCONTEXT_WRITTEN
+#define FF_API_AVIOCONTEXT_WRITTEN      (LIBAVFORMAT_VERSION_MAJOR < 60)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE