You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<Audio> at composition root resolves to duration=Infinity in ffmpeg filter graph #4
A bare <Audio src={...} /> placed at the root of a <Composition> (no endAt prop, no wrapping <Sequence>) causes the renderer to emit duration=Infinity into the ffmpeg atrim filter, which crashes the render.
Reproduction
// MyChapter.tsximport{CanvasElement,Audio,staticFile}from'@rendiv/core';exportconstCHAPTER_DURATION=3814;exportconstMyChapter=()=>(<CanvasElementid="MyChapter"><Audiosrc={staticFile('audio/chapter.mp3')}/>{/* ...other content sized to CHAPTER_DURATION... */}</CanvasElement>);// index.tsx<Compositionid=\"MyChapter\"
component={MyChapter}durationInFrames={CHAPTER_DURATION}fps={30}width={1920}height={1080}/>
FFmpeg exited with code 234:
[Parsed_atrim_0 @ 0x...] Unable to parse option value \"Infinity\" as duration
Error applying option 'duration' to filter 'atrim': Invalid argument
Failed to set value '[1:a]atrim=start=0.000000:duration=Infinity,asetpts=PTS-STARTPTS[aout]'
for option 'filter_complex': Invalid argument
Expected
The renderer should treat `` without an explicit `endAt` as bounded by the parent composition's `durationInFrames` — same behavior as Remotion.
This works, but every chapter master in the project needed the same one-line fix, and the failure mode (`duration=Infinity` from ffmpeg) was very far from the cause.
Suggested fixes (any one would help; all three would be ideal)
Default `endAt` to composition duration. When `` has no `endAt` and no wrapping ``, treat it as `endAt = compositionDurationInFrames`.
Guard the filter-graph emitter. Before serializing `atrim=duration=${value}`, `assert(Number.isFinite(value))` and throw with a useful message, e.g.:
`Audio src="..." resolved to infinite duration. Pass endAt={N} or wrap in .`
Mount-time lint. Walk the composition tree once and warn for any `` / `
The same duration=Infinity failure also happens when <Audio> is inside a <Sequence> that has from but no durationInFrames, which is a common way to place narration clips:
On master (6d6aca2), rendering with renderFrames() + stitchFramesToVideo() registers the source as { startAtFrame: 15, durationInFrames: Infinity }, and FFmpeg fails with Unable to parse option value "Infinity" as duration. This happens after every frame has already been rendered.
The root cause is the same in both cases: SequenceContext defaults to durationInFrames: Infinity, a <Sequence> without durationInFrames keeps Infinity, and Audio, Video and OffthreadVideo register that value as is.
I opened #25, which clamps the registered duration to compositionDuration - startAtFrame in all three components (your suggested fix 1), with tests for both the root-level case and the Sequence case.
Activity
elwizard33 commentedon Nov 2, 2026
The same
duration=Infinityfailure also happens when<Audio>is inside a<Sequence>that hasfrombut nodurationInFrames, which is a common way to place narration clips:On master (6d6aca2), rendering with
renderFrames()+stitchFramesToVideo()registers the source as{ startAtFrame: 15, durationInFrames: Infinity }, and FFmpeg fails withUnable to parse option value "Infinity" as duration. This happens after every frame has already been rendered.The root cause is the same in both cases:
SequenceContextdefaults todurationInFrames: Infinity, a<Sequence>withoutdurationInFrameskeepsInfinity, andAudio,VideoandOffthreadVideoregister that value as is.I opened #25, which clamps the registered duration to
compositionDuration - startAtFramein all three components (your suggested fix 1), with tests for both the root-level case and the Sequence case.