Opus and (default) duration
Hello,
I just observed something interesting with opus and mkvmerge:
a) If I mux an opus file from an ogg container, the last frame has DiscardPadding as it should:
|+ Segment tracks
| + A track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 2520082474116544113
| + Track type: audio
| + Codec ID: A_OPUS
| + Seek pre-roll: 80.000ms (80000000ns)
| + CodecPrivate, length 19
| + Language: und
| + Codec delay: 6.500ms (6500000ns)
| + Audio track
| + Sampling frequency: 48000
| + Channels: 2
...
| + Block group
| + Block (track number 1, 1 frame(s), timestamp 1.380s = 00:00:01.380)
| + Frame with size 329
| + Discard padding: 1.500ms (1500000ns)
| + Block duration: 19.000000ms
|+ Cues (subentries will be skipped)
But if I remux this last Matroska file, the block duration (but not the DiscardPadding) in the last frame is gone:
|+ Segment tracks
| + A track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 2520082474116544113
| + Track type: audio
| + Codec ID: A_OPUS
| + Seek pre-roll: 80.000ms (80000000ns)
| + CodecPrivate, length 19
| + Language: und
| + Codec delay: 6.500ms (6500000ns)
| + Audio track
| + Sampling frequency: 48000
| + Channels: 2
...
| + Block group
| + Block (track number 1, 1 frame(s), timestamp 1.380s = 00:00:01.380)
| + Frame with size 329
| + Discard padding: 1.500ms (1500000ns)
|+ Cues (subentries will be skipped)
b) But the remuxed file still has a correct length (both in the SegmentInfo and in the tags). It even contains them when remuxing the file again. This is to be expected as you already use the information from the bitstream level. This is good as it means that MKVToolNix can be modified to repair tracks where the last frame is missing its duration value.
c) The reference encoder for opus doesn't seem to be using variable block sizes that much. In all my test, the default settings produced a file in which all frames are 20ms long (except the last with its DiscardPadding). So I thought that it might be a good thing to use the header editor to include that value as a default duration (this should of course only be done if the last frame has an explicit duration). It turned out that this value is gone after remuxing, too.
Greetings Andi