remotion-dev/remotion · error · Error
Stream buffer not found
Error message
Stream buffer not found
What it means
Thrown by processAudio at process-audio.ts:63 when transportStream.streamBuffers does not contain an entry for transportStreamEntry.pid. This is an internal-state invariant: by the time processAudio is invoked, a buffer for the PID should have been allocated during earlier PES assembly.
Source
Thrown at packages/media-parser/src/containers/transport-stream/process-audio.ts:63
transportStream,
makeSamplesStartAtZero,
avcState,
}: {
transportStreamEntry: TransportStreamEntry;
structure: TransportStreamStructure;
sampleCallbacks: CallbacksState;
logLevel: MediaParserLogLevel;
onAudioTrack: MediaParserOnAudioTrack | null;
onVideoTrack: MediaParserOnVideoTrack | null;
transportStream: TransportStreamState;
offset: number;
makeSamplesStartAtZero: boolean;
avcState: AvcState;
}): Promise<void> => {
const {streamBuffers, nextPesHeaderStore: nextPesHeader} = transportStream;
const streamBuffer = streamBuffers.get(transportStreamEntry.pid);
if (!streamBuffer) {
throw new Error('Stream buffer not found');
}
const expectedLength =
readAdtsHeader(streamBuffer.getBuffer())?.frameLength ?? null;
if (expectedLength === null) {
throw new Error('Expected length is null');
}
if (expectedLength > streamBuffer.getBuffer().length) {
throw new Error('Expected length is greater than stream buffer length');
}
await processStreamBuffer({
streamBuffer: makeTransportStreamPacketBuffer({
buffers: streamBuffer.getBuffer().slice(0, expectedLength),
offset,
pesHeader: streamBuffer.pesHeader,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Re-mux the source: ffmpeg -i in.ts -c copy out.ts to ensure every PMT-declared PID has packets.
- If reproducing, file a bug on @remotion/media-parser with the sample.
- Verify with ffprobe that the audio PID is present and carries data.
- Transcode to MP4 as a workaround to skip the transport-stream code path.
Defensive patterns
Strategy: try-catch
Try / catch
try { await parseMedia({src}); }
catch (e) {
if (e instanceof Error && e.message === 'Stream buffer not found') {
// internal state issue - try re-muxing, otherwise report
await runFfmpeg(['-i', src, '-c', 'copy', src + '.remux.ts']);
await parseMedia({src: src + '.remux.ts'});
} else throw e;
} Prevention
- Re-mux .ts files to ensure every PMT-declared PID carries packets.
- Verify with ffprobe that declared audio PIDs have data.
- Report persistent occurrences to @remotion/media-parser with a sample.
When it happens
Trigger: processAudio looks up streamBuffers.get(transportStreamEntry.pid) and throws on undefined. Triggered when audio processing is scheduled for a PID before any PES packet for that PID has been buffered, or when the streamBuffers map has been cleared/reset mid-parse.
Common situations: Race-condition style bugs in the parser; corrupt streams where the PMT references a PID that never carries packets; partial files where audio packets are missing; an internal ordering bug between PAT/PMT/PES handling.
Related errors
- Expected length is null
- Expected length is greater than stream buffer length
- Invalid table ID: ${tableId}
- Invalid section length
- Unexpected PES packet start code: ${ident.toString(16)}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/f9d08d26ab4b4524.
Report an issue: GitHub.