Skip to content

Conversation

Jonham
Copy link

@Jonham Jonham commented Aug 17, 2025

Fork from: fluent-ffmpeg#1321 by @decompi

This pull request fixes a bug that causes fluent-ffmpeg to crash when stdoutRing or stderrRing are undefined which happens when FFmpeg exits early or fails to spawn properly.

Problem:
In some rare cases (see fluent-ffmpeg#1316 ), the following error occurs:

TypeError: Cannot read properties of undefined (reading 'get')
at emitEnd (.../lib/processor.js:543:37)
This indicates stdoutRing or stderrRing may have not been initialized in time

My Patch:

Adds a null-safe check using stdoutRing?.get?.() and fallback to null if undefined.
Logs a warning when either ring is unexpectedly missing
Changed Lines:

Line 470 (timeout handler)
Line 502(output stream err handler)
Line 550 (final endCB cleanup)

@Jonham Jonham changed the title Fix: prevent crash when stdoutRing or stderrRing is undefined Fix: prevent crash when stdoutRing or stderrRing is undefined by @decompi Aug 17, 2025
@Jonham Jonham changed the base branch from master to main August 17, 2025 15:01
@Jonham Jonham merged commit a0e31a0 into ts-ffmpeg:main Aug 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant