{"record":{"id":"0f9e1e3fb3e2e30a","repo":"remotion-dev/remotion","slug":"invalid-dts-marker-bits-fourbits","errorCode":null,"errorMessage":"Invalid DTS marker bits: ${_fourBits}","messagePattern":"Invalid DTS marker bits: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/transport-stream/parse-pes.ts","lineNumber":78,"sourceCode":"\n\tconst fourBits = iterator.getBits(4);\n\tif (fourBits !== 0b0011 && fourBits !== 0b0010) {\n\t\tthrow new Error(`Invalid PTS marker bits: ${fourBits}`);\n\t}\n\n\tconst pts1 = iterator.getBits(3);\n\titerator.getBits(1); // marker bit\n\tconst pts2 = iterator.getBits(15);\n\titerator.getBits(1); // marker bit\n\tconst pts3 = iterator.getBits(15);\n\titerator.getBits(1); // marker bit\n\tpts = (pts1 << 30) | (pts2 << 15) | pts3;\n\n\tlet dts: number | null = null;\n\tif (dtsPresent) {\n\t\tconst _fourBits = iterator.getBits(4);\n\t\tif (_fourBits !== 0b0001) {\n\t\t\tthrow new Error(`Invalid DTS marker bits: ${_fourBits}`);\n\t\t}\n\n\t\tconst dts1 = iterator.getBits(3);\n\t\titerator.getBits(1); // marker bit\n\t\tconst dts2 = iterator.getBits(15);\n\t\titerator.getBits(1); // marker bit\n\t\tconst dts3 = iterator.getBits(15);\n\t\titerator.getBits(1); // marker bit\n\t\tdts = (dts1 << 30) | (dts2 << 15) | dts3;\n\t}\n\n\titerator.stopReadingBits();\n\titerator.discard(\n\t\tpesHeaderLength - (iterator.counter.getOffset() - offsetAfterHeader),\n\t);\n\n\tconst packet: PacketPes = {\n\t\tdts,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/transport-stream/parse-pes.ts#L60-L96","documentation":"Thrown at parse-pes.ts:78 when the 4-bit prefix of the DTS field is not 0b0001. The DTS prefix is fixed at '0001' by ISO/IEC 13818-1 whenever DTS is present; any other value means the DTS encoding is invalid.","triggerScenarios":"Inside the dtsPresent branch, parsePes reads getBits(4) into _fourBits and compares to 0b0001. Triggered by corruption in the DTS field, a truncated header, or a muxer that mis-wrote the prefix.","commonSituations":"Corrupted .ts captures; partial packets where DTS bytes are missing; faulty encoders; bit-flips from a noisy channel.","solutions":["Re-mux the file: ffmpeg -i in.ts -c copy out.ts.","Validate DTS values with ffprobe -show_frames.","Re-acquire the source if it is a damaged capture.","File a bug with a sample if the file is otherwise playable in reference tools."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await parseMedia({src}); }\ncatch (e) { if (e instanceof Error && e.message.startsWith('Invalid DTS marker bits')) { await runFfmpeg(['-i', src, '-c', 'copy', src + '.remux.ts']); await parseMedia({src: src + '.remux.ts'}); } else throw e; }","preventionTips":["Re-mux corrupt .ts files before parsing.","Validate DTS with ffprobe -show_frames.","Treat persistent DTS-prefix errors as damaged-source."],"tags":["media-parser","transport-stream","mpegts","pes","dts","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}