{"record":{"id":"6902c9f6e2e6bfd9","repo":"remotion-dev/remotion","slug":"dts-is-present-but-not-pts-this-is-not-allowed-in","errorCode":null,"errorMessage":"DTS is present but not PTS, this is not allowed in the spec","messagePattern":"DTS is present but not PTS, this is not allowed in the spec","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/transport-stream/parse-pes.ts","lineNumber":43,"sourceCode":"\titerator.startReadingBits();\n\tconst markerBits = iterator.getBits(2);\n\tif (markerBits !== 0b10) {\n\t\tthrow new Error(`Invalid marker bits: ${markerBits}`);\n\t}\n\n\tconst scrambled = iterator.getBits(2);\n\tif (scrambled !== 0b00) {\n\t\tthrow new Error(`Only supporting non-scrambled streams`);\n\t}\n\n\tconst priority = iterator.getBits(1);\n\titerator.getBits(1); // data alignment indicator\n\titerator.getBits(1); // copy right\n\titerator.getBits(1); // original or copy\n\tconst ptsPresent = iterator.getBits(1);\n\tconst dtsPresent = iterator.getBits(1);\n\tif (!ptsPresent && dtsPresent) {\n\t\tthrow new Error(\n\t\t\t`DTS is present but not PTS, this is not allowed in the spec`,\n\t\t);\n\t}\n\n\titerator.getBits(1); // escr flag\n\titerator.getBits(1); // es rate flag\n\titerator.getBits(1); // dsm trick mode flag\n\titerator.getBits(1); // additional copy info flag\n\titerator.getBits(1); // crc flag\n\titerator.getBits(1); // extension flag\n\tconst pesHeaderLength = iterator.getBits(8);\n\tconst offsetAfterHeader = iterator.counter.getOffset();\n\tlet pts: number | null = null;\n\tif (!ptsPresent) {\n\t\tthrow new Error(`PTS is required`);\n\t}\n\n\tconst fourBits = iterator.getBits(4);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/transport-stream/parse-pes.ts#L25-L61","documentation":"Thrown at parse-pes.ts:43 when the PTS_DTS_flags are '01' (DTS present but no PTS). ISO/IEC 13818-1 explicitly forbids this combination: a stream may have only PTS (flags=10), both PTS and DTS (flags=11), or neither (flags=00), but never DTS alone.","triggerScenarios":"parsePes reads ptsPresent and dtsPresent bits; if dtsPresent is true while ptsPresent is false, the spec violation is reported. Triggered by a malformed PES header, an encoder bug, or bit corruption in the flag field.","commonSituations":"Broken muxers that set PTS_DTS_flags incorrectly; corrupt captures; partial packets where the flag byte is incomplete.","solutions":["Re-mux the file with a conformant muxer (ffmpeg -i in.ts -c copy out.ts).","Verify with dvbsnoop or ts2sec that PTS_DTS_flags are valid.","Use a different source if the file is a damaged capture.","File an upstream bug against the muxer if the corruption is reproducible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await parseMedia({src}); }\ncatch (e) { if (e instanceof Error && e.message === 'DTS is present but not PTS, this is not allowed in the spec') { await runFfmpeg(['-i', src, '-c', 'copy', src + '.remux.ts']); await parseMedia({src: src + '.remux.ts'}); } else throw e; }","preventionTips":["Re-mux malformed .ts files with ffmpeg to fix PES header flags.","Validate with dvbsnoop that PTS_DTS_flags are spec-compliant.","Reject streams that fail reference-tool validation."],"tags":["media-parser","transport-stream","mpegts","pes","pts","dts","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}