diff mbox series

[FFmpeg-devel,7/7] fftools/ffmpeg: propagate frame durations to packets when encoding

Message ID 20230414164244.15264-7-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/7] lavfi: ensure audio frame durations match the sample count | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov April 14, 2023, 4:42 p.m. UTC
Remove now-obsolete code setting packet durations pre-muxing for CFR
encoded video.

Changes output in the following FATE tests:
* numerous adpcm tests
* ffmpeg-filter_complex_audio
* lavf-asf
* lavf-mkv
* lavf-mkv_attachment
* matroska-encoding-delay
  All of these change due to the fact that the output duration is now
  the actual input data duration and does not include padding added by
  the encoder.

* apng-osample: less wrong packet durations are now passed to the muxer.
  They are not entirely correct, because the first frame duration should
  be 3 rather than 2. This is caused by the vsync code and should be
  addressed later, but this change is a step in the right direction.
* tscc2-mov: last output frame has a duration of 11 rather than 1 - this
  corresponds to the duration actually returned by the demuxer.
* film-cvid: video frame durations are now 2 rather than 1 - this
  corresponds to durations actually returned by the demuxer and matches
  the timestamps.
* mpeg2-ticket6677: durations of some video frames are now 2 rather than
  1 - this matches the timestamps.
---
 fftools/ffmpeg_enc.c                       |   2 +
 fftools/ffmpeg_mux.c                       |   9 -
 tests/ref/acodec/adpcm-ima_wav             |   2 +-
 tests/ref/acodec/adpcm-ima_wav-trellis     |   2 +-
 tests/ref/acodec/adpcm-ms                  |   2 +-
 tests/ref/acodec/adpcm-ms-trellis          |   2 +-
 tests/ref/acodec/adpcm-swf                 |   2 +-
 tests/ref/acodec/adpcm-swf-trellis         |   2 +-
 tests/ref/acodec/adpcm-swf-wav             |   2 +-
 tests/ref/acodec/adpcm-yamaha              |   2 +-
 tests/ref/acodec/adpcm-yamaha-trellis      |   2 +-
 tests/ref/fate/apng-osample                |  12 +-
 tests/ref/fate/autorotate                  |   4 +-
 tests/ref/fate/ffmpeg-filter_complex_audio |   2 +-
 tests/ref/fate/film-cvid                   | 216 ++++++++++-----------
 tests/ref/fate/matroska-encoding-delay     |   2 +-
 tests/ref/fate/mpeg2-ticket6677            |   4 +-
 tests/ref/fate/tscc2-mov                   |   2 +-
 tests/ref/lavf/asf                         |   2 +-
 tests/ref/lavf/mkv                         |   2 +-
 tests/ref/lavf/mkv_attachment              |   2 +-
 21 files changed, 135 insertions(+), 142 deletions(-)

Comments

Anton Khirnov April 14, 2023, 4:51 p.m. UTC | #1
Quoting Anton Khirnov (2023-04-14 18:42:44)
> Remove now-obsolete code setting packet durations pre-muxing for CFR
> encoded video.
> 
> Changes output in the following FATE tests:
> * numerous adpcm tests
> * ffmpeg-filter_complex_audio
> * lavf-asf
> * lavf-mkv
> * lavf-mkv_attachment
> * matroska-encoding-delay
>   All of these change due to the fact that the output duration is now
>   the actual input data duration and does not include padding added by
>   the encoder.

It is not entirely clear to me that recording "user audio duration" (i.e.
samples submitted by the user to the encoder) rather than "coded audio
duration" (i.e. user duration plus any padding added by the encoder) in
containers (e.g. the 'fact' chunk in WAV, or duration metadata in
matroska) is the correct thing to do. It seems more elegant, but may
cause issues I'm not aware of. Opinions and arguments welcome.
diff mbox series

Patch

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 00cccef65b..d7259e6ccb 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -322,6 +322,8 @@  int enc_open(OutputStream *ost, AVFrame *frame)
             return ret;
     }
 
+    av_dict_set(&ost->encoder_opts, "flags", "+frame_duration", AV_DICT_MULTIKEY);
+
     ret = hw_device_setup_for_encode(ost);
     if (ret < 0) {
         av_log(ost, AV_LOG_ERROR,
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index b316925115..f23e237d37 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -77,15 +77,6 @@  static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
     if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->vsync_method == VSYNC_DROP)
         pkt->pts = pkt->dts = AV_NOPTS_VALUE;
 
-    if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if (ost->frame_rate.num && ost->is_cfr) {
-            if (pkt->duration > 0)
-                av_log(ost, AV_LOG_WARNING, "Overriding packet duration by frame rate, this should not happen\n");
-            pkt->duration = av_rescale_q(1, av_inv_q(ost->frame_rate),
-                                         pkt->time_base);
-        }
-    }
-
     av_packet_rescale_ts(pkt, pkt->time_base, ost->st->time_base);
     pkt->time_base = ost->st->time_base;
 
diff --git a/tests/ref/acodec/adpcm-ima_wav b/tests/ref/acodec/adpcm-ima_wav
index bd3306dfc5..44ca53a565 100644
--- a/tests/ref/acodec/adpcm-ima_wav
+++ b/tests/ref/acodec/adpcm-ima_wav
@@ -1,4 +1,4 @@ 
-56b75c3a6dacedcf2ce7b0586aa33594 *tests/data/fate/acodec-adpcm-ima_wav.wav
+af0b82a719762cc6e1a952a6081231cf *tests/data/fate/acodec-adpcm-ima_wav.wav
 267324 tests/data/fate/acodec-adpcm-ima_wav.wav
 78a2af1c895792d0c221d127bdd48ece *tests/data/fate/acodec-adpcm-ima_wav.out.wav
 stddev:  903.51 PSNR: 37.21 MAXDIFF:34026 bytes:  1058400/  1061748
diff --git a/tests/ref/acodec/adpcm-ima_wav-trellis b/tests/ref/acodec/adpcm-ima_wav-trellis
index 10d78c74f2..29c28edddf 100644
--- a/tests/ref/acodec/adpcm-ima_wav-trellis
+++ b/tests/ref/acodec/adpcm-ima_wav-trellis
@@ -1,4 +1,4 @@ 
-f9075c7a3adb2cd114b0bac69afcada6 *tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
+6f0df0f3275f833c341d63b9054caebb *tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
 267324 tests/data/fate/acodec-adpcm-ima_wav-trellis.wav
 26a9b280c14737b159c56e60181f1170 *tests/data/fate/acodec-adpcm-ima_wav-trellis.out.wav
 stddev:  710.03 PSNR: 39.30 MAXDIFF:25944 bytes:  1058400/  1061748
diff --git a/tests/ref/acodec/adpcm-ms b/tests/ref/acodec/adpcm-ms
index c760b783c2..9f546c9b77 100644
--- a/tests/ref/acodec/adpcm-ms
+++ b/tests/ref/acodec/adpcm-ms
@@ -1,4 +1,4 @@ 
-a407b87daeef5b25dfb6c5b3f519e9c1 *tests/data/fate/acodec-adpcm-ms.wav
+ed29590dc005c64940c46cfe4a0e8eba *tests/data/fate/acodec-adpcm-ms.wav
 268378 tests/data/fate/acodec-adpcm-ms.wav
 7be370f937c51e8a967e6a3d08d5156a *tests/data/fate/acodec-adpcm-ms.out.wav
 stddev: 1050.01 PSNR: 35.91 MAXDIFF:29806 bytes:  1058400/  1060576
diff --git a/tests/ref/acodec/adpcm-ms-trellis b/tests/ref/acodec/adpcm-ms-trellis
index 8587e703c6..e7ea230dba 100644
--- a/tests/ref/acodec/adpcm-ms-trellis
+++ b/tests/ref/acodec/adpcm-ms-trellis
@@ -1,4 +1,4 @@ 
-7ed05f7a88046aa4cd547ddf71953637 *tests/data/fate/acodec-adpcm-ms-trellis.wav
+70deb036ed0bf3dd03699eafbbfa51b7 *tests/data/fate/acodec-adpcm-ms-trellis.wav
 268378 tests/data/fate/acodec-adpcm-ms-trellis.wav
 ed9d9cdfd264f2ec6c79127c04dd224e *tests/data/fate/acodec-adpcm-ms-trellis.out.wav
 stddev:  896.03 PSNR: 37.28 MAXDIFF:28029 bytes:  1058400/  1060576
diff --git a/tests/ref/acodec/adpcm-swf b/tests/ref/acodec/adpcm-swf
index 61d92da084..0bc9d6ffd0 100644
--- a/tests/ref/acodec/adpcm-swf
+++ b/tests/ref/acodec/adpcm-swf
@@ -1,4 +1,4 @@ 
-64aedd1487cb355406dde36d2bba374f *tests/data/fate/acodec-adpcm-swf.flv
+03bda567604b31c86c8740a044eedb1d *tests/data/fate/acodec-adpcm-swf.flv
 267801 tests/data/fate/acodec-adpcm-swf.flv
 9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf.out.wav
 stddev:  919.82 PSNR: 37.06 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/acodec/adpcm-swf-trellis b/tests/ref/acodec/adpcm-swf-trellis
index f4c69ca622..a6f9b10ac0 100644
--- a/tests/ref/acodec/adpcm-swf-trellis
+++ b/tests/ref/acodec/adpcm-swf-trellis
@@ -1,4 +1,4 @@ 
-fde151ce9b8be0e144e72113508bcff6 *tests/data/fate/acodec-adpcm-swf-trellis.flv
+83d6efddeb11bb0f0a4131a6384c7e4b *tests/data/fate/acodec-adpcm-swf-trellis.flv
 267801 tests/data/fate/acodec-adpcm-swf-trellis.flv
 6a0007e42d92a225a8becddedccf9a0f *tests/data/fate/acodec-adpcm-swf-trellis.out.wav
 stddev:  731.05 PSNR: 39.05 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/acodec/adpcm-swf-wav b/tests/ref/acodec/adpcm-swf-wav
index 80ce287b01..a6c51c565e 100644
--- a/tests/ref/acodec/adpcm-swf-wav
+++ b/tests/ref/acodec/adpcm-swf-wav
@@ -1,4 +1,4 @@ 
-a21ee5ba531ec89e306d78c861eb6ed1 *tests/data/fate/acodec-adpcm-swf-wav.wav
+e8a4ac69e50211f3ef828d26b7051397 *tests/data/fate/acodec-adpcm-swf-wav.wav
 266624 tests/data/fate/acodec-adpcm-swf-wav.wav
 9d061488fdc1a557bdc454b9d1aba59c *tests/data/fate/acodec-adpcm-swf-wav.out.wav
 stddev:  919.82 PSNR: 37.06 MAXDIFF:51119 bytes:  1058400/  1064960
diff --git a/tests/ref/acodec/adpcm-yamaha b/tests/ref/acodec/adpcm-yamaha
index f3e6dbede2..8b94979245 100644
--- a/tests/ref/acodec/adpcm-yamaha
+++ b/tests/ref/acodec/adpcm-yamaha
@@ -1,4 +1,4 @@ 
-245c194e84d482a70ca89de9c0bbd591 *tests/data/fate/acodec-adpcm-yamaha.wav
+4719ae6d28c4b13c270caefb34fde140 *tests/data/fate/acodec-adpcm-yamaha.wav
 265274 tests/data/fate/acodec-adpcm-yamaha.wav
 758b4aee62964831d0a335ada9672104 *tests/data/fate/acodec-adpcm-yamaha.out.wav
 stddev: 1242.71 PSNR: 34.44 MAXDIFF:39960 bytes:  1058400/  1060864
diff --git a/tests/ref/acodec/adpcm-yamaha-trellis b/tests/ref/acodec/adpcm-yamaha-trellis
index 909a95139b..f653f21492 100644
--- a/tests/ref/acodec/adpcm-yamaha-trellis
+++ b/tests/ref/acodec/adpcm-yamaha-trellis
@@ -1,4 +1,4 @@ 
-c8306ada93ef52b1e87b6758853f4937 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
+6601c0c29d2ac6ed2eee94b13bc3f289 *tests/data/fate/acodec-adpcm-yamaha-trellis.wav
 265274 tests/data/fate/acodec-adpcm-yamaha-trellis.wav
 8ad27b0ea7e13e70ed334b5ec26c62ef *tests/data/fate/acodec-adpcm-yamaha-trellis.out.wav
 stddev:  926.56 PSNR: 36.99 MAXDIFF:33570 bytes:  1058400/  1060864
diff --git a/tests/ref/fate/apng-osample b/tests/ref/fate/apng-osample
index 5fca5e667d..c91dd5284d 100644
--- a/tests/ref/fate/apng-osample
+++ b/tests/ref/fate/apng-osample
@@ -3,9 +3,9 @@ 
 #codec_id 0: rawvideo
 #dimensions 0: 116x135
 #sar 0: 0/1
-0,          0,          0,        1,    62640, 0x31eb581d
-0,          3,          3,        1,    62640, 0x29e11b82
-0,          6,          6,        1,    62640, 0x207ed588
-0,          9,          9,        1,    62640, 0x3845c906
-0,         12,         12,        1,    62640, 0x6797fe69
-0,         15,         15,        1,    62640, 0x1f086a09
+0,          0,          0,        2,    62640, 0x31eb581d
+0,          3,          3,        3,    62640, 0x29e11b82
+0,          6,          6,        3,    62640, 0x207ed588
+0,          9,          9,        3,    62640, 0x3845c906
+0,         12,         12,        3,    62640, 0x6797fe69
+0,         15,         15,        3,    62640, 0x1f086a09
diff --git a/tests/ref/fate/autorotate b/tests/ref/fate/autorotate
index c18a017abf..dff628bbff 100644
--- a/tests/ref/fate/autorotate
+++ b/tests/ref/fate/autorotate
@@ -1,5 +1,5 @@ 
-e432aa783e79208a61052f6ced525fff *tests/data/fate/autorotate.mov
-197358 tests/data/fate/autorotate.mov
+701a366a5b97ea92b0e25f5d059a0dd6 *tests/data/fate/autorotate.mov
+197366 tests/data/fate/autorotate.mov
 #extradata 0:       34, 0x9d7d073f
 #tb 0: 1/15360
 #media_type 0: video
diff --git a/tests/ref/fate/ffmpeg-filter_complex_audio b/tests/ref/fate/ffmpeg-filter_complex_audio
index 0d1f650040..3f2f670514 100644
--- a/tests/ref/fate/ffmpeg-filter_complex_audio
+++ b/tests/ref/fate/ffmpeg-filter_complex_audio
@@ -6,4 +6,4 @@ 
 0,       -256,       -256,     1536,      416, 0x3001fb2d
 0,       1280,       1280,     1536,      418, 0xba72fc16
 0,       2816,       2816,     1536,      418, 0xba72fc16
-0,       4352,       4352,     1536,      418, 0xba72fc16
+0,       4352,       4352,        3,      418, 0xba72fc16
diff --git a/tests/ref/fate/film-cvid b/tests/ref/fate/film-cvid
index 24540bf131..60bbc192d8 100644
--- a/tests/ref/fate/film-cvid
+++ b/tests/ref/fate/film-cvid
@@ -4,112 +4,112 @@ 
 #dimensions 0: 320x224
 #sar 0: 0/1
 0,          0,          0,        1,   215040, 0x067c5362
-0,          2,          2,        1,   215040, 0xd9eacb98
-0,          4,          4,        1,   215040, 0x3c8a4cbd
-0,          6,          6,        1,   215040, 0xbdf996e1
-0,          8,          8,        1,   215040, 0x1b7fa123
-0,         10,         10,        1,   215040, 0x834b4a8d
-0,         12,         12,        1,   215040, 0xf4b1bebe
-0,         14,         14,        1,   215040, 0x088c3802
-0,         16,         16,        1,   215040, 0xf6ddedb9
-0,         18,         18,        1,   215040, 0x2791d538
-0,         20,         20,        1,   215040, 0x81fe4688
-0,         22,         22,        1,   215040, 0xad864fbd
-0,         24,         24,        1,   215040, 0xa637a97a
-0,         26,         26,        1,   215040, 0x2287e378
-0,         28,         28,        1,   215040, 0x13a017d7
-0,         30,         30,        1,   215040, 0x89a4acee
-0,         32,         32,        1,   215040, 0x97888ffc
-0,         34,         34,        1,   215040, 0x7c2c3b58
-0,         36,         36,        1,   215040, 0x2e3ab808
-0,         38,         38,        1,   215040, 0x2d553af2
-0,         40,         40,        1,   215040, 0x929c420e
-0,         42,         42,        1,   215040, 0x4841bd6d
-0,         44,         44,        1,   215040, 0xb350fbcd
-0,         46,         46,        1,   215040, 0x0d70b918
-0,         48,         48,        1,   215040, 0xf98b0f47
-0,         50,         50,        1,   215040, 0x748b8ff2
-0,         52,         52,        1,   215040, 0x62017c38
-0,         54,         54,        1,   215040, 0x46042bb4
-0,         56,         56,        1,   215040, 0xe7a74806
-0,         58,         58,        1,   215040, 0xb4c856e6
-0,         60,         60,        1,   215040, 0xb21a28dd
-0,         62,         62,        1,   215040, 0x2a6e0834
-0,         64,         64,        1,   215040, 0x7044d6ca
-0,         66,         66,        1,   215040, 0x17780335
-0,         68,         68,        1,   215040, 0x94f51e7a
-0,         70,         70,        1,   215040, 0x5beb5f5f
-0,         72,         72,        1,   215040, 0xc7d59527
-0,         74,         74,        1,   215040, 0x40f69049
-0,         76,         76,        1,   215040, 0x1f78740e
-0,         78,         78,        1,   215040, 0x49f7265d
-0,         80,         80,        1,   215040, 0x057ac5c9
-0,         82,         82,        1,   215040, 0x649bd476
-0,         84,         84,        1,   215040, 0x1c75aa43
-0,         86,         86,        1,   215040, 0xc4bd1e29
-0,         88,         88,        1,   215040, 0x5033fa74
-0,         90,         90,        1,   215040, 0xba5c949e
-0,         92,         92,        1,   215040, 0x2fa78a0e
-0,         94,         94,        1,   215040, 0x9d363dce
-0,         96,         96,        1,   215040, 0xd1dc82b0
-0,         98,         98,        1,   215040, 0xd25be322
-0,        100,        100,        1,   215040, 0xf1374ef9
-0,        102,        102,        1,   215040, 0x33467b42
-0,        104,        104,        1,   215040, 0x7ec7dfad
-0,        106,        106,        1,   215040, 0x706ed416
-0,        108,        108,        1,   215040, 0x6576b3eb
-0,        110,        110,        1,   215040, 0x6576b3eb
-0,        112,        112,        1,   215040, 0x6576b3eb
-0,        114,        114,        1,   215040, 0x6576b3eb
-0,        116,        116,        1,   215040, 0x6576b3eb
-0,        118,        118,        1,   215040, 0x6576b3eb
-0,        120,        120,        1,   215040, 0x6576b3eb
-0,        122,        122,        1,   215040, 0x6873993d
-0,        124,        124,        1,   215040, 0x8c2a84d8
-0,        126,        126,        1,   215040, 0xdd456bd5
-0,        128,        128,        1,   215040, 0x50fa4f3d
-0,        130,        130,        1,   215040, 0x00c4369c
-0,        132,        132,        1,   215040, 0xe4c220d2
-0,        134,        134,        1,   215040, 0xe43a033b
-0,        136,        136,        1,   215040, 0x72f6e32c
-0,        138,        138,        1,   215040, 0xb738c69c
-0,        140,        140,        1,   215040, 0x56bda3fe
-0,        142,        142,        1,   215040, 0xaa2f7da3
-0,        144,        144,        1,   215040, 0xf21f5c24
-0,        146,        146,        1,   215040, 0xd33e3579
-0,        148,        148,        1,   215040, 0x6a601495
-0,        150,        150,        1,   215040, 0xdfcff1e0
-0,        152,        152,        1,   215040, 0xa774d327
-0,        154,        154,        1,   215040, 0x8e9db8c9
-0,        156,        156,        1,   215040, 0xb4fd9689
-0,        158,        158,        1,   215040, 0xa80b77ff
-0,        160,        160,        1,   215040, 0x1d9c6568
-0,        162,        162,        1,   215040, 0x388c515a
-0,        164,        164,        1,   215040, 0x388c515a
-0,        166,        166,        1,   215040, 0x388c515a
-0,        168,        168,        1,   215040, 0x388c515a
-0,        170,        170,        1,   215040, 0x388c515a
-0,        172,        172,        1,   215040, 0x388c515a
-0,        174,        174,        1,   215040, 0x388c515a
-0,        176,        176,        1,   215040, 0x388c515a
-0,        178,        178,        1,   215040, 0x388c515a
-0,        180,        180,        1,   215040, 0x388c515a
-0,        182,        182,        1,   215040, 0x388c515a
-0,        184,        184,        1,   215040, 0x3aef5fee
-0,        186,        186,        1,   215040, 0x3aef5fee
-0,        188,        188,        1,   215040, 0x3aef5fee
-0,        190,        190,        1,   215040, 0x3aef5fee
-0,        192,        192,        1,   215040, 0x7f8e4b62
-0,        194,        194,        1,   215040, 0xbf9fcae8
-0,        196,        196,        1,   215040, 0x02f9a66c
-0,        198,        198,        1,   215040, 0x00ef062f
-0,        200,        200,        1,   215040, 0xe83b132c
-0,        202,        202,        1,   215040, 0x2701d21b
-0,        204,        204,        1,   215040, 0xbea79188
-0,        206,        206,        1,   215040, 0x6f6d3109
-0,        208,        208,        1,   215040, 0x4173f1e8
-0,        210,        210,        1,   215040, 0xd7adfce1
-0,        212,        212,        1,   215040, 0xa3825ffd
-0,        214,        214,        1,   215040, 0x41e63fe4
-0,        216,        216,        1,   215040, 0xb525b9c5
+0,          2,          2,        2,   215040, 0xd9eacb98
+0,          4,          4,        2,   215040, 0x3c8a4cbd
+0,          6,          6,        2,   215040, 0xbdf996e1
+0,          8,          8,        2,   215040, 0x1b7fa123
+0,         10,         10,        2,   215040, 0x834b4a8d
+0,         12,         12,        2,   215040, 0xf4b1bebe
+0,         14,         14,        2,   215040, 0x088c3802
+0,         16,         16,        2,   215040, 0xf6ddedb9
+0,         18,         18,        2,   215040, 0x2791d538
+0,         20,         20,        2,   215040, 0x81fe4688
+0,         22,         22,        2,   215040, 0xad864fbd
+0,         24,         24,        2,   215040, 0xa637a97a
+0,         26,         26,        2,   215040, 0x2287e378
+0,         28,         28,        2,   215040, 0x13a017d7
+0,         30,         30,        2,   215040, 0x89a4acee
+0,         32,         32,        2,   215040, 0x97888ffc
+0,         34,         34,        2,   215040, 0x7c2c3b58
+0,         36,         36,        2,   215040, 0x2e3ab808
+0,         38,         38,        2,   215040, 0x2d553af2
+0,         40,         40,        2,   215040, 0x929c420e
+0,         42,         42,        2,   215040, 0x4841bd6d
+0,         44,         44,        2,   215040, 0xb350fbcd
+0,         46,         46,        2,   215040, 0x0d70b918
+0,         48,         48,        2,   215040, 0xf98b0f47
+0,         50,         50,        2,   215040, 0x748b8ff2
+0,         52,         52,        2,   215040, 0x62017c38
+0,         54,         54,        2,   215040, 0x46042bb4
+0,         56,         56,        2,   215040, 0xe7a74806
+0,         58,         58,        2,   215040, 0xb4c856e6
+0,         60,         60,        2,   215040, 0xb21a28dd
+0,         62,         62,        2,   215040, 0x2a6e0834
+0,         64,         64,        2,   215040, 0x7044d6ca
+0,         66,         66,        2,   215040, 0x17780335
+0,         68,         68,        2,   215040, 0x94f51e7a
+0,         70,         70,        2,   215040, 0x5beb5f5f
+0,         72,         72,        2,   215040, 0xc7d59527
+0,         74,         74,        2,   215040, 0x40f69049
+0,         76,         76,        2,   215040, 0x1f78740e
+0,         78,         78,        2,   215040, 0x49f7265d
+0,         80,         80,        2,   215040, 0x057ac5c9
+0,         82,         82,        2,   215040, 0x649bd476
+0,         84,         84,        2,   215040, 0x1c75aa43
+0,         86,         86,        2,   215040, 0xc4bd1e29
+0,         88,         88,        2,   215040, 0x5033fa74
+0,         90,         90,        2,   215040, 0xba5c949e
+0,         92,         92,        2,   215040, 0x2fa78a0e
+0,         94,         94,        2,   215040, 0x9d363dce
+0,         96,         96,        2,   215040, 0xd1dc82b0
+0,         98,         98,        2,   215040, 0xd25be322
+0,        100,        100,        2,   215040, 0xf1374ef9
+0,        102,        102,        2,   215040, 0x33467b42
+0,        104,        104,        2,   215040, 0x7ec7dfad
+0,        106,        106,        2,   215040, 0x706ed416
+0,        108,        108,        2,   215040, 0x6576b3eb
+0,        110,        110,        2,   215040, 0x6576b3eb
+0,        112,        112,        2,   215040, 0x6576b3eb
+0,        114,        114,        2,   215040, 0x6576b3eb
+0,        116,        116,        2,   215040, 0x6576b3eb
+0,        118,        118,        2,   215040, 0x6576b3eb
+0,        120,        120,        2,   215040, 0x6576b3eb
+0,        122,        122,        2,   215040, 0x6873993d
+0,        124,        124,        2,   215040, 0x8c2a84d8
+0,        126,        126,        2,   215040, 0xdd456bd5
+0,        128,        128,        2,   215040, 0x50fa4f3d
+0,        130,        130,        2,   215040, 0x00c4369c
+0,        132,        132,        2,   215040, 0xe4c220d2
+0,        134,        134,        2,   215040, 0xe43a033b
+0,        136,        136,        2,   215040, 0x72f6e32c
+0,        138,        138,        2,   215040, 0xb738c69c
+0,        140,        140,        2,   215040, 0x56bda3fe
+0,        142,        142,        2,   215040, 0xaa2f7da3
+0,        144,        144,        2,   215040, 0xf21f5c24
+0,        146,        146,        2,   215040, 0xd33e3579
+0,        148,        148,        2,   215040, 0x6a601495
+0,        150,        150,        2,   215040, 0xdfcff1e0
+0,        152,        152,        2,   215040, 0xa774d327
+0,        154,        154,        2,   215040, 0x8e9db8c9
+0,        156,        156,        2,   215040, 0xb4fd9689
+0,        158,        158,        2,   215040, 0xa80b77ff
+0,        160,        160,        2,   215040, 0x1d9c6568
+0,        162,        162,        2,   215040, 0x388c515a
+0,        164,        164,        2,   215040, 0x388c515a
+0,        166,        166,        2,   215040, 0x388c515a
+0,        168,        168,        2,   215040, 0x388c515a
+0,        170,        170,        2,   215040, 0x388c515a
+0,        172,        172,        2,   215040, 0x388c515a
+0,        174,        174,        2,   215040, 0x388c515a
+0,        176,        176,        2,   215040, 0x388c515a
+0,        178,        178,        2,   215040, 0x388c515a
+0,        180,        180,        2,   215040, 0x388c515a
+0,        182,        182,        2,   215040, 0x388c515a
+0,        184,        184,        2,   215040, 0x3aef5fee
+0,        186,        186,        2,   215040, 0x3aef5fee
+0,        188,        188,        2,   215040, 0x3aef5fee
+0,        190,        190,        2,   215040, 0x3aef5fee
+0,        192,        192,        2,   215040, 0x7f8e4b62
+0,        194,        194,        2,   215040, 0xbf9fcae8
+0,        196,        196,        2,   215040, 0x02f9a66c
+0,        198,        198,        2,   215040, 0x00ef062f
+0,        200,        200,        2,   215040, 0xe83b132c
+0,        202,        202,        2,   215040, 0x2701d21b
+0,        204,        204,        2,   215040, 0xbea79188
+0,        206,        206,        2,   215040, 0x6f6d3109
+0,        208,        208,        2,   215040, 0x4173f1e8
+0,        210,        210,        2,   215040, 0xd7adfce1
+0,        212,        212,        2,   215040, 0xa3825ffd
+0,        214,        214,        2,   215040, 0x41e63fe4
+0,        216,        216,        2,   215040, 0xb525b9c5
 0,        218,        218,        1,   215040, 0x00000000
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index 086fe94e93..437992468d 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,4 +1,4 @@ 
-ce2ab14d45217a043f9f50fe6adfe5ce *tests/data/fate/matroska-encoding-delay.matroska
+416f35d123daef715b7c4bbb75c9c778 *tests/data/fate/matroska-encoding-delay.matroska
 961251 tests/data/fate/matroska-encoding-delay.matroska
 #extradata 0:       22, 0x32ea0490
 #tb 0: 1/1000
diff --git a/tests/ref/fate/mpeg2-ticket6677 b/tests/ref/fate/mpeg2-ticket6677
index 2079a08c20..01e46b559b 100644
--- a/tests/ref/fate/mpeg2-ticket6677
+++ b/tests/ref/fate/mpeg2-ticket6677
@@ -4,9 +4,9 @@ 
 #dimensions 0: 720x480
 #sar 0: 8/9
 0,          1,          1,        1,   518400, 0xc1866f5f
-0,          2,          2,        1,   518400, 0x9ba32764
+0,          2,          2,        2,   518400, 0x9ba32764
 0,          4,          4,        1,   518400, 0xa9031bb8
 0,          5,          5,        1,   518400, 0x5e2c3502
 0,          6,          6,        1,   518400, 0xe860027a
-0,          7,          7,        1,   518400, 0xa9152430
+0,          7,          7,        2,   518400, 0xa9152430
 0,          9,          9,        1,   518400, 0xb98dd9f7
diff --git a/tests/ref/fate/tscc2-mov b/tests/ref/fate/tscc2-mov
index 679f5bb63c..068002a82e 100644
--- a/tests/ref/fate/tscc2-mov
+++ b/tests/ref/fate/tscc2-mov
@@ -7,4 +7,4 @@ 
 0,          1,          1,        1,  1180116, 0x6f73e080
 0,          2,          2,        1,  1180116, 0x5244d9e5
 0,          3,          3,        1,  1180116, 0x629bf10f
-0,          4,          4,        1,  1180116, 0x97c726cb
+0,          4,          4,       11,  1180116, 0x97c726cb
diff --git a/tests/ref/lavf/asf b/tests/ref/lavf/asf
index fbcbd480d0..340461fdb5 100644
--- a/tests/ref/lavf/asf
+++ b/tests/ref/lavf/asf
@@ -1,3 +1,3 @@ 
-76f131a5426f0ba5fc7409d1a1bbfdd7 *tests/data/lavf/lavf.asf
+776cd99d73857d4ef824e3936c6a0932 *tests/data/lavf/lavf.asf
 333585 tests/data/lavf/lavf.asf
 tests/data/lavf/lavf.asf CRC=0xf6340a10
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index 0aeb7cfae6..5d0bf06fa9 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@ 
-fde4f0580865684b878f0e13997213af *tests/data/lavf/lavf.mkv
+1dce6c32d49a8f637262db2d8e7f2744 *tests/data/lavf/lavf.mkv
 320439 tests/data/lavf/lavf.mkv
 tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index 6ab72b9a45..b79bf9a619 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@ 
-c75c844f592d44c2a79ff5fc1e8179e0 *tests/data/lavf/lavf.mkv_attachment
+140ffb4f6a734972a9d38f4e6d57f304 *tests/data/lavf/lavf.mkv_attachment
 472589 tests/data/lavf/lavf.mkv_attachment
 tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68