diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 3bb70326fe..c0db10b3c2 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1757,6 +1757,7 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid,
         mxf_write_klv_fill(s);
         start = avio_tell(s->pb);
         mxf_write_primer_pack(s);
+        mxf_write_klv_fill(s);
         mxf_write_header_metadata_sets(s);
         pos = avio_tell(s->pb);
         header_byte_count = pos - start + klv_fill_size(pos);
diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914
index a8f287fafa..06eac9e621 100644
--- a/tests/ref/fate/copy-trac4914
+++ b/tests/ref/fate/copy-trac4914
@@ -1,5 +1,5 @@
-05fdc4a6e28abb2c26e96224682d2684 *tests/data/fate/copy-trac4914.mxf
-560697 tests/data/fate/copy-trac4914.mxf
+9097dd426106c40288262b53cc6fdb83 *tests/data/fate/copy-trac4914.mxf
+561209 tests/data/fate/copy-trac4914.mxf
 #tb 0: 1001/30000
 #media_type 0: video
 #codec_id 0: rawvideo
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index fb9586097a..7350d2c0bf 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@
-dda6c54b642b8794a87d809fdb361f95
+625c69eb3801368737266128efdd0a8c
diff --git a/tests/ref/fate/time_base b/tests/ref/fate/time_base
index 4dd14084d3..75ec4368a4 100644
--- a/tests/ref/fate/time_base
+++ b/tests/ref/fate/time_base
@@ -1 +1 @@
-f97551f884df5ab709c5869c66c7b9bc
+0979b614a34f668eb47278448b254000
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index 7318447ecb..1aff1a0509 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-d4140129463dec64bdb4a7d7ad1b0c82 *./tests/data/lavf/lavf.mxf
-525369 ./tests/data/lavf/lavf.mxf
+47c67e4309c680ce91df5396541ee31e *./tests/data/lavf/lavf.mxf
+525881 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
-a27bb8cd5e185ea13b0a8daa4eb221cd *./tests/data/lavf/lavf.mxf
-560697 ./tests/data/lavf/lavf.mxf
+8e5f8bc13d7c888f4b6320f9869d49d5 *./tests/data/lavf/lavf.mxf
+561209 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
-395bf0047c97ceca96935357166b94c7 *./tests/data/lavf/lavf.mxf
-525369 ./tests/data/lavf/lavf.mxf
+c49f8d4743c8dcc33fa01e6dcb995a38 *./tests/data/lavf/lavf.mxf
+525881 ./tests/data/lavf/lavf.mxf
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10
index 2384d427b0..3af1d7e2d7 100644
--- a/tests/ref/lavf/mxf_d10
+++ b/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-f4694941b0cd5b5e3c91064d84dbd345 *./tests/data/lavf/lavf.mxf_d10
-5330989 ./tests/data/lavf/lavf.mxf_d10
+3c256050ae20973760dd4e72d854d0dc *./tests/data/lavf/lavf.mxf_d10
+5331501 ./tests/data/lavf/lavf.mxf_d10
 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488
diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25
index e836b14240..9d95083393 100644
--- a/tests/ref/lavf/mxf_dv25
+++ b/tests/ref/lavf/mxf_dv25
@@ -1,3 +1,3 @@
-1ca8143bf6cf322fd39f6e856959d502 *./tests/data/lavf/lavf.mxf_dv25
-3833389 ./tests/data/lavf/lavf.mxf_dv25
+aed946d56c81da2f01974b3805d56f87 *./tests/data/lavf/lavf.mxf_dv25
+3833901 ./tests/data/lavf/lavf.mxf_dv25
 ./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52
diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50
index bb3d6b928a..2965be97c3 100644
--- a/tests/ref/lavf/mxf_dvcpro50
+++ b/tests/ref/lavf/mxf_dvcpro50
@@ -1,3 +1,3 @@
-987fd4b2abb36433fba0e35f4092efc6 *./tests/data/lavf/lavf.mxf_dvcpro50
-7430189 ./tests/data/lavf/lavf.mxf_dvcpro50
+e9cecd6f83c7bff8c41195ce23b3d0b2 *./tests/data/lavf/lavf.mxf_dvcpro50
+7430701 ./tests/data/lavf/lavf.mxf_dvcpro50
 ./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4
diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom
index 1cc612e627..6369e91198 100644
--- a/tests/ref/lavf/mxf_opatom
+++ b/tests/ref/lavf/mxf_opatom
@@ -1,3 +1,3 @@
-b8fe60f7457b83709f33357d04c8db0c *./tests/data/lavf/lavf.mxf_opatom
+e8f8bce1c9c92c678f0e9b3350984282 *./tests/data/lavf/lavf.mxf_opatom
 4717113 ./tests/data/lavf/lavf.mxf_opatom
 ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a
diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio
index deed55e526..57c957853a 100644
--- a/tests/ref/lavf/mxf_opatom_audio
+++ b/tests/ref/lavf/mxf_opatom_audio
@@ -1,3 +1,3 @@
-e7da52bd591e6eddb4e1af381a4e5bd4 *./tests/data/lavf/lavf.mxf_opatom_audio
-101945 ./tests/data/lavf/lavf.mxf_opatom_audio
+2fc8da147ec62c5ba98598bbb2737515 *./tests/data/lavf/lavf.mxf_opatom_audio
+102457 ./tests/data/lavf/lavf.mxf_opatom_audio
 ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff
