diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c
index 04155dde76..0b69dad1b9 100644
--- a/libavformat/tests/movenc.c
+++ b/libavformat/tests/movenc.c
@@ -37,7 +37,7 @@
 #define HASH_SIZE 16
 
 static const uint8_t h264_extradata[] = {
-    0x01, 0x4d, 0x40, 0x1e, 0xff, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
+    0x01, 0x4d, 0x40, 0x1e, 0xfe, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
 };
 static const uint8_t aac_extradata[] = {
     0x12, 0x10
@@ -249,10 +249,13 @@ static void mux_frames(int n, int c)
 {
     int end_frames = frames + n;
     while (1) {
-        uint8_t pktdata[8] = { 0 };
+        uint8_t   idr_data[8] = { 0x00, 0x00, 0x05, 0x65 };
+        uint8_t slice_data[8] = { 0x00, 0x00, 0x05, 0x61 };
+        uint8_t audio_data[8] = { 0 };
         av_packet_unref(pkt);
 
         if (av_compare_ts(audio_dts, audio_st->time_base, video_dts, video_st->time_base) < 0) {
+            pkt->data = audio_data;
             pkt->dts = pkt->pts = audio_dts;
             pkt->stream_index = 1;
             pkt->duration = audio_duration;
@@ -265,10 +268,12 @@ static void mux_frames(int n, int c)
             pkt->duration = duration;
             if ((frames % gop_size) == 0) {
                 pkt->flags |= AV_PKT_FLAG_KEY;
+                pkt->data = idr_data;
                 last_picture = AV_PICTURE_TYPE_I;
                 pkt->pts = pkt->dts + duration;
                 video_dts = pkt->pts;
             } else {
+                pkt->data = slice_data;
                 if (last_picture == AV_PICTURE_TYPE_P) {
                     last_picture = AV_PICTURE_TYPE_B;
                     pkt->pts = pkt->dts;
@@ -293,8 +298,7 @@ static void mux_frames(int n, int c)
 
         if (clear_duration)
             pkt->duration = 0;
-        AV_WB32(pktdata + 4, pkt->pts);
-        pkt->data = pktdata;
+        AV_WB32(pkt->data + 4, pkt->pts);
         pkt->size = 8;
         if (skip_write)
             continue;
diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc
index 81ea75f372..9a1da67ff5 100644
--- a/tests/ref/fate/movenc
+++ b/tests/ref/fate/movenc
@@ -2,17 +2,17 @@ write_data len 36, time nopts, type header atom ftyp
 write_data len 2429, time nopts, type header atom -
 write_data len 788, time 1000000, type sync atom moof
 write_data len 110, time nopts, type trailer atom -
-6f06e338c71468d56580df40ff265066 3363 non-empty-moov
+ef1fffd7c446dd90e7300dc32e8ebdc2 3363 non-empty-moov
 write_data len 36, time nopts, type header atom ftyp
 write_data len 2761, time nopts, type header atom -
 write_data len 908, time 966667, type sync atom moof
 write_data len 110, time nopts, type trailer atom -
-caf0876986b5f033efc0958c338289cc 3815 non-empty-moov-elst
+3734af62e2a0f5f677bdceacc64b01c1 3815 non-empty-moov-elst
 write_data len 36, time nopts, type header atom ftyp
 write_data len 2669, time nopts, type header atom -
 write_data len 908, time 1000000, type sync atom moof
 write_data len 110, time nopts, type trailer atom -
-e106084014ed245ed7c4a30f1d11a3ac 3723 non-empty-moov-no-elst
+fb65eb84d856ce161b4a327ca5605e82 3723 non-empty-moov-no-elst
 write_data len 24, time nopts, type header atom ftyp
 write_data len 1171, time nopts, type header atom -
 write_data len 728, time 0, type sync atom moof
@@ -20,109 +20,109 @@ write_data len 828, time nopts, type unknown atom -
 write_data len 728, time 999999, type sync atom moof
 write_data len 812, time nopts, type unknown atom -
 write_data len 148, time nopts, type trailer atom -
-92ce825ff40505ec8676191705adb7e7 4439 ismv
+2c98886c0522d2f53cbd9956844474a5 4439 ismv
 write_data len 36, time nopts, type header atom ftyp
 write_data len 1123, time nopts, type header atom -
 write_data len 796, time 0, type sync atom moof
 write_data len 788, time 1000000, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-08f4b3ad3a3ea224b2ee731476b9056b 2891 empty-moov
+6e7fa51b8236ae5efb82e5aafb89303d 2891 empty-moov
 write_data len 36, time nopts, type header atom ftyp
 write_data len 1123, time nopts, type header atom -
 write_data len 1068, time 0, type sync atom moof
 write_data len 908, time 1000000, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-d7a2dcb43eb0f95f92669f55fc7adeba 3283 empty-moov-no-elst
+d2ad81feda9bc654610996d9bbdbec53 3283 empty-moov-no-elst
 write_data len 36, time nopts, type header atom ftyp
 write_data len 1123, time nopts, type header atom -
 write_data len 900, time -33333, type sync atom moof
 write_data len 908, time 966667, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-ea70ca697306976879be408431c27aee 3115 empty-moov-no-elst-no-adjust
+7e6a81ef39ebc536e5b56100cdf6b252 3115 empty-moov-no-elst-no-adjust
 write_data len 1159, time nopts, type header atom ftyp
 write_data len 796, time 0, type sync atom moof
 write_data len 788, time 1000000, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-08f4b3ad3a3ea224b2ee731476b9056b 2891 delay-moov
+6e7fa51b8236ae5efb82e5aafb89303d 2891 delay-moov
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 916, time -33333, type sync atom moof
 write_data len 908, time 966667, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-314cc3b6296f4ee583b328a34be50b2f 3203 delay-moov-elst
+131880377ee6222006e0ca04020b2c8e 3203 delay-moov-elst
 write_data len 1195, time nopts, type header atom ftyp
 write_data len 836, time 0, type sync atom moof
 write_data len 67, time nopts, type trailer atom -
-95d6f59a7354b0cfe7ce49927baada4e 2098 delay-moov-empty-track
+9de4334a9e2509dc4ac51098e9b73da5 2098 delay-moov-empty-track
 write_data len 1195, time nopts, type header atom ftyp
 write_data len 360, time 0, type sync atom moof
 write_data len 360, time 1000000, type sync atom moof
 write_data len 86, time nopts, type trailer atom -
-8805d72a27b340ea229c16edde78f974 2001 delay-moov-empty-track-flush
+5162f99181c5e59d1340cdaae07c7d24 2001 delay-moov-empty-track-flush
 write_data len 36, time nopts, type header atom ftyp
 write_data len 1123, time nopts, type header atom -
-351ae2c8b6d35d98b4848c309cce6704 1159 empty-moov-header
+8985952a838caa36c228cc890d7cc943 1159 empty-moov-header
 write_data len 796, time 0, type sync atom moof
 write_data len 788, time 1000000, type sync atom moof
-289ee982188d66988a374a462b0b5376 1584 empty-moov-content
+4ee68a46f6c9d9c946bde60320dbd22a 1584 empty-moov-content
 write_data len 148, time nopts, type trailer atom -
 write_data len 1159, time nopts, type header atom ftyp
-351ae2c8b6d35d98b4848c309cce6704 1159 delay-moov-header
+8985952a838caa36c228cc890d7cc943 1159 delay-moov-header
 write_data len 796, time 0, type sync atom moof
 write_data len 788, time 1000000, type sync atom moof
-289ee982188d66988a374a462b0b5376 1584 delay-moov-content
+4ee68a46f6c9d9c946bde60320dbd22a 1584 delay-moov-content
 write_data len 148, time nopts, type trailer atom -
 write_data len 28, time nopts, type header atom -
 write_data len 1123, time nopts, type header atom -
 write_data len 884, time 0, type sync atom sidx
 write_data len 876, time 1000000, type sync atom sidx
-c0307f99a2a362205b7e3d65b1066f86 876 empty-moov-second-frag
+9088f7d32a1c72519e1dd25c86d6444a 876 empty-moov-second-frag
 write_data len 148, time nopts, type trailer atom -
 write_data len 28, time nopts, type header atom -
 write_data len 1123, time nopts, type header atom -
 write_data len 876, time 1000000, type sync atom sidx
-c0307f99a2a362205b7e3d65b1066f86 876 empty-moov-second-frag-discont
+9088f7d32a1c72519e1dd25c86d6444a 876 empty-moov-second-frag-discont
 write_data len 110, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom -
 write_data len 876, time 1000000, type sync atom sidx
-c0307f99a2a362205b7e3d65b1066f86 876 delay-moov-second-frag-discont
+9088f7d32a1c72519e1dd25c86d6444a 876 delay-moov-second-frag-discont
 write_data len 110, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom ftyp
-b3811928793ed0749927eb2f7958421c 1223 delay-moov-elst-init
+8d72431e55013ae14b85598b07bf0745 1223 delay-moov-elst-init
 write_data len 988, time -33333, type sync atom sidx
 write_data len 996, time 966667, type sync atom sidx
-0df125407c7e81978ce722e0ae4f6f84 996 delay-moov-elst-second-frag
+e7791a3a51bde1f3b235468ed0c80acd 996 delay-moov-elst-second-frag
 write_data len 148, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom ftyp
-b3811928793ed0749927eb2f7958421c 1223 delay-moov-elst-init-discont
+8d72431e55013ae14b85598b07bf0745 1223 delay-moov-elst-init-discont
 write_data len 996, time 966667, type sync atom sidx
-0df125407c7e81978ce722e0ae4f6f84 996 delay-moov-elst-second-frag-discont
+e7791a3a51bde1f3b235468ed0c80acd 996 delay-moov-elst-second-frag-discont
 write_data len 110, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom ftyp
-041ac8efc35a0d023c26d05eedb20403 1223 delay-moov-elst-signal-init
+0e57f12a619ed2b3d9906c7f0e8ddc0b 1223 delay-moov-elst-signal-init
 write_data len 1004, time -33333, type sync atom sidx
 write_data len 996, time 966667, type sync atom sidx
-5a583d89318827d2569eecbeaa18c238 996 delay-moov-elst-signal-second-frag
+fc25112079e6bf9008ab228458d96adb 996 delay-moov-elst-signal-second-frag
 write_data len 148, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom ftyp
-041ac8efc35a0d023c26d05eedb20403 1223 delay-moov-elst-signal-init-discont
+0e57f12a619ed2b3d9906c7f0e8ddc0b 1223 delay-moov-elst-signal-init-discont
 write_data len 996, time 966667, type sync atom sidx
-5a583d89318827d2569eecbeaa18c238 996 delay-moov-elst-signal-second-frag-discont
+fc25112079e6bf9008ab228458d96adb 996 delay-moov-elst-signal-second-frag-discont
 write_data len 110, time nopts, type trailer atom -
 write_data len 1247, time nopts, type header atom ftyp
-80511a51d1ac9cde62337eed7176ae03 1247 delay-moov-elst-signal-init-discont-largets
+0d848b85b1d63cd403330302bad1112a 1247 delay-moov-elst-signal-init-discont-largets
 write_data len 996, time 279621233333, type sync atom sidx
-dc695d65e8a0cdafee28acd8a5ccf81a 996 delay-moov-elst-signal-second-frag-discont-largets
+097ab434042086066592026a1b81d592 996 delay-moov-elst-signal-second-frag-discont-largets
 write_data len 110, time nopts, type trailer atom -
 write_data len 1223, time nopts, type header atom ftyp
 write_data len 2572, time -333333, type sync atom sidx
 write_data len 996, time 5166667, type sync atom sidx
 write_data len 148, time nopts, type trailer atom -
-d37a7eda807912b9ed05ccfe003a9e4f 4939 vfr
+da879cef0972615d0ef5133907f50443 4939 vfr
 write_data len 1223, time nopts, type header atom ftyp
 write_data len 2572, time -333333, type sync atom sidx
 write_data len 996, time 5166667, type sync atom sidx
 write_data len 148, time nopts, type trailer atom -
-d37a7eda807912b9ed05ccfe003a9e4f 4939 vfr-noduration
+da879cef0972615d0ef5133907f50443 4939 vfr-noduration
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 1500, time -333333, type sync atom moof
 write_data len 1500, time nopts, type unknown atom -
@@ -131,7 +131,7 @@ write_data len 1500, time 9666667, type sync atom moof
 write_data len 1500, time nopts, type unknown atom -
 write_data len 1004, time nopts, type unknown atom -
 write_data len 148, time nopts, type trailer atom -
-08b6401dc81912e5264245b7233c4ab3 9299 large_frag
+3332b321c8679e8461f2260b91f54f64 9299 large_frag
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 684, time -33333, type sync atom moof
 write_data len 504, time 800000, type boundary atom moof
@@ -139,15 +139,15 @@ write_data len 420, time 1266667, type boundary atom moof
 write_data len 668, time 1566667, type sync atom moof
 write_data len 440, time 2233333, type boundary atom moof
 write_data len 262, time nopts, type trailer atom -
-a5d087611a9229ba91eb0964cf2f17d9 4209 vfr-noduration-interleave
+b355a28c9acaf8f265349ceceaee9090 4209 vfr-noduration-interleave
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 916, time 0, type sync atom moof
 write_data len 908, time 1000000, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-d81c3a0ce5940a2db74c99ad435e0560 3203 delay-moov-elst-neg-cts
+46aba217983807ab4a6b7a854031b2bb 3203 delay-moov-elst-neg-cts
 write_data len 36, time nopts, type header atom ftyp
 write_data len 1123, time nopts, type header atom -
 write_data len 900, time 0, type sync atom moof
 write_data len 908, time 1000000, type sync atom moof
 write_data len 148, time nopts, type trailer atom -
-3be575022e446855bca1e45b7942cc0c 3115 empty-moov-neg-cts
+7428ad079e6c7b0ae63de75520a17567 3115 empty-moov-neg-cts
