Bug Report
Description
Some rendered videos have a black frame at the end. This appears to be a duration/sizing mismatch in the FFmpeg pipeline (editly layer) — when the source clip doesn't perfectly fill the expected duration, a black frame gets appended to pad the remaining time.
Reproduction
Example video with black last frame:
https://su.varg.ai/renders/1772764472485_yyzfle0c.mp4
Root cause (needs investigation)
Likely one of:
- Editly clip duration rounding — the clip duration in the editly spec is slightly longer than the actual source video, causing FFmpeg to pad with black
- FFmpeg trim filter —
cutTo or duration calculation results in a fractional-frame overshoot
- Concat demuxer — when concatenating clips, a duration mismatch between the editly spec and the actual media causes a black frame gap
- FPS mismatch — source video FPS doesn't divide evenly into the target duration, leaving a partial frame that renders as black
Where to investigate
templates/sdk/src/ai-sdk/providers/editly/index.ts — clip duration calculation (cutTo - cutFrom), trim filters, concat logic
- FFmpeg filter chain construction — check if
-shortest or padding flags are involved
- Check if
tpad or similar filter is being applied implicitly
Expected behavior
Videos should end cleanly on the last real frame with no black padding. If a source clip is slightly shorter than the specified duration, the last frame should be held (freeze frame) rather than showing black.
Suggested fix directions
- Add
-shortest flag to FFmpeg output if not already present
- Clamp clip durations to actual source media duration
- Use
tpad=stop_mode=clone to freeze the last frame instead of showing black
- Investigate rounding strategy for frame-accurate trimming
Bug Report
Description
Some rendered videos have a black frame at the end. This appears to be a duration/sizing mismatch in the FFmpeg pipeline (editly layer) — when the source clip doesn't perfectly fill the expected duration, a black frame gets appended to pad the remaining time.
Reproduction
Example video with black last frame:
https://su.varg.ai/renders/1772764472485_yyzfle0c.mp4
Root cause (needs investigation)
Likely one of:
cutToor duration calculation results in a fractional-frame overshootWhere to investigate
templates/sdk/src/ai-sdk/providers/editly/index.ts— clip duration calculation (cutTo - cutFrom), trim filters, concat logic-shortestor padding flags are involvedtpador similar filter is being applied implicitlyExpected behavior
Videos should end cleanly on the last real frame with no black padding. If a source clip is slightly shorter than the specified duration, the last frame should be held (freeze frame) rather than showing black.
Suggested fix directions
-shortestflag to FFmpeg output if not already presenttpad=stop_mode=cloneto freeze the last frame instead of showing black