diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8eff5b8eaa..c93f9d65a6 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1175,18 +1175,6 @@ typedef struct AVStream {
     uint8_t dts_ordered;
     uint8_t dts_misordered;
 
-    /**
-     * Internal data to inject global side data
-     */
-    int inject_global_side_data;
-
-    /**
-     * display aspect ratio (0 if unknown)
-     * - encoding: unused
-     * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
-     */
-    AVRational display_aspect_ratio;
-
     /**
      * An opaque field for libavformat internal usage.
      * Must not be accessed in any way by callers.
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 30b4df9181..09bab4796d 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -224,6 +224,18 @@ struct AVStreamInternal {
         int     fps_last_dts_idx;
 
     } *info;
+
+    /**
+     * Internal data to inject global side data
+     */
+    int inject_global_side_data;
+
+    /**
+     * display aspect ratio (0 if unknown)
+     * - encoding: unused
+     * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
+     */
+    AVRational display_aspect_ratio;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4f64e96bc0..82fd1d74f6 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1767,8 +1767,8 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                     return 0;
                 den *= 2;
             case 1:
-                c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.num = num;
-                c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.den = den;
+                c->fc->streams[c->fc->nb_streams-1]->internal->display_aspect_ratio.num = num;
+                c->fc->streams[c->fc->nb_streams-1]->internal->display_aspect_ratio.den = den;
             default:
                 return 0;
             }
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d16a7af0df..1f79f3d3cd 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2586,7 +2586,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
                 av_dict_set_int(&st->metadata, "source_track_origin", source_track->sequence->origin, 0);
             }
             if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)
-                st->display_aspect_ratio = descriptor->aspect_ratio;
+                st->internal->display_aspect_ratio = descriptor->aspect_ratio;
             st->codecpar->color_range     = mxf_get_color_range(mxf, descriptor);
             st->codecpar->color_primaries = mxf_get_codec_ul(ff_mxf_color_primaries_uls, &descriptor->color_primaries_ul)->id;
             st->codecpar->color_trc       = mxf_get_codec_ul(ff_mxf_color_trc_uls, &descriptor->color_trc_ul)->id;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a13f31dccf..625d8d69f3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -153,7 +153,7 @@ void av_format_inject_global_side_data(AVFormatContext *s)
     s->internal->inject_global_side_data = 1;
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
-        st->inject_global_side_data = 1;
+        st->internal->inject_global_side_data = 1;
     }
 }
 
@@ -1659,7 +1659,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             st->skip_samples = 0;
         }
 
-        if (st->inject_global_side_data) {
+        if (st->internal->inject_global_side_data) {
             for (i = 0; i < st->nb_side_data; i++) {
                 AVPacketSideData *src_sd = &st->side_data[i];
                 uint8_t *dst_data;
@@ -1675,7 +1675,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
                 memcpy(dst_data, src_sd->data, src_sd->size);
             }
-            st->inject_global_side_data = 0;
+            st->internal->inject_global_side_data = 0;
         }
     }
 
@@ -1888,7 +1888,7 @@ void ff_read_frame_flush(AVFormatContext *s)
             st->pts_buffer[j] = AV_NOPTS_VALUE;
 
         if (s->internal->inject_global_side_data)
-            st->inject_global_side_data = 1;
+            st->internal->inject_global_side_data = 1;
 
         st->skip_samples = 0;
     }
@@ -4007,9 +4007,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
                     st->r_frame_rate.den = st->time_base.num;
                 }
             }
-            if (st->display_aspect_ratio.num && st->display_aspect_ratio.den) {
+            if (st->internal->display_aspect_ratio.num && st->internal->display_aspect_ratio.den) {
                 AVRational hw_ratio = { avctx->height, avctx->width };
-                st->sample_aspect_ratio = av_mul_q(st->display_aspect_ratio,
+                st->sample_aspect_ratio = av_mul_q(st->internal->display_aspect_ratio,
                                                    hw_ratio);
             }
         } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -4535,7 +4535,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     st->internal->info->fps_first_dts = AV_NOPTS_VALUE;
     st->internal->info->fps_last_dts  = AV_NOPTS_VALUE;
 
-    st->inject_global_side_data = s->internal->inject_global_side_data;
+    st->internal->inject_global_side_data = s->internal->inject_global_side_data;
 
     st->internal->need_context_update = 1;
 
