This repository has been archived by the owner. It is now read-only.

Lacing and DiscardPadding #2100

Closed
mkver opened this Issue Sep 21, 2017 · 1 comment

Comments

2 participants
@mkver

mkver commented Sep 21, 2017

Hello,

as I have already mentioned in #2099 mkvmerge uses lacing in conjunction with DiscardPadding. This is probably no good idea because it is not precisely defined to which blocks the DiscardPadding belongs and because support for both in the same block will probably never be very widespread. Even mkvmerge has bugs in this regard: After I extract the audio from test224.x264-Opus.mkv I remux it with lacing disabled and get this:


| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.040s = 00:00:02.040)
|  + Frame with size 594
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.060s = 00:00:02.060)
|   + Frame with size 588
|  + Discard padding: 0.667ms (666667ns)
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.080s = 00:00:02.080)
|  + Frame with size 581
|+ Cluster
| + Cluster timecode: 2.100s
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.100s = 00:00:02.100)
|  + Frame with size 600
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.120s = 00:00:02.120)
|  + Frame with size 670
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.140s = 00:00:02.140)
|  + Frame with size 587
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.160s = 00:00:02.160)
|  + Frame with size 605
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.180s = 00:00:02.180)
|  + Frame with size 650
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.200s = 00:00:02.200)
|   + Frame with size 616
|  + Discard padding: 1.833ms (1833334ns)
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.220s = 00:00:02.220)
|  + Frame with size 606
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.240s = 00:00:02.240)
|  + Frame with size 702
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.260s = 00:00:02.260)
|  + Frame with size 595
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.280s = 00:00:02.280)
|  + Frame with size 590
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.300s = 00:00:02.300)
|  + Frame with size 592
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.320s = 00:00:02.320)
|  + Frame with size 581

Muxing this Matroska-file with lacing gives:

| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.040s = 00:00:02.040)
|  + Frame with size 594
| + Block group
|  + Block (track number 1, 2 frame(s), timecode 2.060s = 00:00:02.060)
|   + Frame with size 588
|   + Frame with size 581
|  + Discard padding: 0.667ms (666667ns)
|+ Cluster
| + Cluster timecode: 2.100s
| + SimpleBlock (key, track number 1, 5 frame(s), timecode 2.100s = 00:00:02.100)
|  + Frame with size 600
|  + Frame with size 670
|  + Frame with size 587
|  + Frame with size 605
|  + Frame with size 650
| + Block group
|  + Block (track number 1, 7 frame(s), timecode 2.200s = 00:00:02.200)
|   + Frame with size 616
|   + Frame with size 606
|   + Frame with size 702
|   + Frame with size 595
|   + Frame with size 590
|   + Frame with size 592
|   + Frame with size 581
|  + Discard padding: 1.833ms (1833334ns)

So in both block-laces one the DiscardPadding actually applies to the first packet in the lace, not the last as I would guess if I had to guess based upon the spec.
If I remux this file again with disable-lacing, I get:

| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.040s = 00:00:02.040)
|  + Frame with size 594
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.060s = 00:00:02.060)
|   + Frame with size 588
|  + Discard padding: 0.667ms (666667ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.080s = 00:00:02.080)
|   + Frame with size 581
|  + Discard padding: 0.667ms (666667ns)
|+ Cluster
| + Cluster timecode: 2.100s
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.100s = 00:00:02.100)
|  + Frame with size 600
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.120s = 00:00:02.120)
|  + Frame with size 670
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.140s = 00:00:02.140)
|  + Frame with size 587
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.160s = 00:00:02.160)
|  + Frame with size 605
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 2.180s = 00:00:02.180)
|  + Frame with size 650
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.200s = 00:00:02.200)
|   + Frame with size 616
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.220s = 00:00:02.220)
|   + Frame with size 606
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.240s = 00:00:02.240)
|   + Frame with size 702
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.260s = 00:00:02.260)
|   + Frame with size 595
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.280s = 00:00:02.280)
|   + Frame with size 590
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.300s = 00:00:02.300)
|   + Frame with size 592
|  + Discard padding: 1.833ms (1833334ns)
| + Block group
|  + Block (track number 1, 1 frame(s), timecode 2.320s = 00:00:02.320)
|   + Frame with size 581
|  + Discard padding: 1.833ms (1833334ns)

Now all the packets that come from a lace with DiscardPadding get the DiscardPadding value from the lace.

Greetings
Andi

@mbunkus

This comment has been minimized.

Show comment
Hide comment
@mbunkus

mbunkus Sep 24, 2017

Owner

Good analysis. I agree that discard padding should not be used together with lacing in the same BlockGroup. I'll fix it.

Owner

mbunkus commented Sep 24, 2017

Good analysis. I agree that discard padding should not be used together with lacing in the same BlockGroup. I'll fix it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.