diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 1d5a883c8e85c945a113d22a62161364a318522d..a63d8cb30ae4ac960be307e526dcb813ed98ffb5 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -83,6 +83,8 @@ static int mmf_write_header(AVFormatContext *s)
     avio_w8(pb, 1); /* code type */
     avio_w8(pb, 0); /* status */
     avio_w8(pb, 0); /* counts */
+    end_tag_be(pb, pos);
+    pos = ff_start_tag(pb, "OPDA");
     avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */
     end_tag_be(pb, pos);
 
diff --git a/tests/ref/lavf/mmf b/tests/ref/lavf/mmf
index 89097842a0b489892a174039da30c86ec5a6e7c6..e94d3a27859c32c87d1e6331db57c83019f3e2fc 100644
--- a/tests/ref/lavf/mmf
+++ b/tests/ref/lavf/mmf
@@ -1,3 +1,3 @@
-1982e25aaa5307068c5e0f0fd54b193a *./tests/data/lavf/lavf.mmf
-22609 ./tests/data/lavf/lavf.mmf
+786815c553a0bd2cb066f27a911f1b1f *./tests/data/lavf/lavf.mmf
+22617 ./tests/data/lavf/lavf.mmf
 ./tests/data/lavf/lavf.mmf CRC=0x03633476
diff --git a/tests/ref/seek/lavf-mmf b/tests/ref/seek/lavf-mmf
index 9324d0de0af9c6f8172e8be84d592fea06d263bf..9c32cab8852b6e601c781c1fbb5340d7b65b610b 100644
--- a/tests/ref/seek/lavf-mmf
+++ b/tests/ref/seek/lavf-mmf
@@ -1,44 +1,44 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     81 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     89 size:  4096
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     81 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     89 size:  4096
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret:-1         st: 0 flags:1  ts:-0.317506
 ret:-1         st:-1 flags:0  ts: 2.576668
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:   8273 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:   8281 size:  4096
 ret:-1         st: 0 flags:1  ts:-0.740839
 ret:-1         st:-1 flags:0  ts: 2.153336
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     81 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     89 size:  4096
 ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos:  12369 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos:  12377 size:  4096
 ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     81 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     89 size:  4096
 ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret:-1         st:-1 flags:0  ts: 1.306672
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:   4177 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:   4185 size:  4096
 ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     81 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     89 size:  4096
 ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret:-1         st:-1 flags:1  ts:-0.222493
 ret:-1         st: 0 flags:0  ts: 2.671678
 ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20561 size:  2048
+ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  20569 size:  2048
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos:  12369 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos:  12377 size:  4096
 ret:-1         st:-1 flags:1  ts:-0.645825