nilaoda/N_m3u8DL-RE · error · Exception
WVTT sample duration unknown, and no default found!
Error message
WVTT sample duration unknown, and no default found!
What it means
While decoding WVTT samples, ExtractSub determines each sample's duration from the TRUN per-sample duration, an explicit 'tfdt'/sample timing, or the TFHD defaultSampleDuration. If none of these provided a duration, the cue timing cannot be computed, so it throws this error.
Solutions
- Re-mux the segment with ffmpeg/Shaka packager so tfhd includes defaultSampleDuration.
- Ensure trun flags include sample-duration (0x000100) so per-sample durations are present.
- Verify the tfhd flags actually contain the default-sample-duration bit (0x000008) in the segment.
- Patch MP4VttUtil to supply a fallback default duration from the container/movie header.
Defensive patterns
Strategy: validation
Validate before calling
// confirm the init/segment provides timing: tfhd with default-sample-duration or trun with sample-duration
bool HasTimingInfo(byte[] seg) =>
Mp4BoxScanner.Find(seg, "tfdt") != null ||
(Mp4BoxScanner.Find(seg, "tfhd") is { } t && (t.Flags & 0x000008) != 0) ||
(Mp4BoxScanner.Find(seg, "trun") is { } r && (r.Flags & 0x000100) != 0); Try / catch
try { var subs = MP4VttUtil.ExtractSub(dataSeg, baseTime); }
catch (Exception ex) when (ex.Message.Contains("duration unknown")) {
logger.Warn("No sample duration in fragment; falling back to default cue duration");
subs = ExtractWithDefaultDuration(dataSeg, TimeSpan.FromSeconds(2));
} Prevention
- Ensure init segments declare defaultSampleDuration in tfhd.
- Use packagers that emit per-sample durations in trun.
- Test subtitle fragments from each new stream source for timing fields.
- Prefer well-known muxers for WVTT content.
When it happens
Trigger: The segment's trun box omits per-sample durations, no tfdt box supplied timing, and the tfhd box has no defaultSampleDuration — the loop reaches a presentation with unknown duration and no default.
Common situations: Minimally muxed fragments produced by custom packagers that strip default durations from tfhd; hand-crafted or edited MP4 fragments; packagers that always rely on trun durations but the flags were misparsed.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- A TRUN box should have a valid version value
- A TRUN box should have a valid flags value
- VTT cues in mp4 with multiple MDAT are not currently…
- A required box is missing
- The samples do not fit evenly into the sample sizes given…
AI-assisted analysis of nilaoda/N_m3u8DL-RE@e113dee70c (2026-09-13).
Data as JSON: /api/errors/1ebd4f4de662ff22.
Report an issue: GitHub.
Appendix: source
Thrown at src/N_m3u8DL-RE.Parser/Mp4/MP4VttUtil.cs:163
0 + (double)currentTime / timescale);
// Check if same subtitle has been splitted
if (cue != null)
{
var index = cues.FindLastIndex(s => s.EndTime == cue.StartTime && s.Settings == cue.Settings && s.Payload == cue.Payload);
if (index != -1)
{
cues[index].EndTime = cue.EndTime;
}
else
{
cues.Add(cue);
}
}
}
}
else
{
throw new Exception("WVTT sample duration unknown, and no default found!");
}
if (!(presentation.SampleSize == 0 || totalSize <= presentation.SampleSize))
{
throw new Exception("The samples do not fit evenly into the sample sizes given in the TRUN box!");
}
} while (presentation.SampleSize != 0 && (totalSize < presentation.SampleSize));
if (reader.HasMoreData())
{
// throw new Exception("MDAT which contain VTT cues and non-VTT data are not currently supported!");
}
}
}
if (cues.Count > 0)
{View on GitHub (pinned to e113dee70c)