Skip to content

fix: classify FFmpeg log messages as ffout/fferr instead of always stderr - #941

Open
PiedPiper911 wants to merge 2 commits into
ffmpegwasm:mainfrom
PiedPiper911:fix/log-type-classification
Open

fix: classify FFmpeg log messages as ffout/fferr instead of always stderr#941
PiedPiper911 wants to merge 2 commits into
ffmpegwasm:mainfrom
PiedPiper911:fix/log-type-classification

Conversation

@PiedPiper911

Copy link
Copy Markdown

Summary

Fixes #877 - ffmpeg.on('log') always reports type: "stderr" regardless of whether the output is an error or informational message.

Root Cause

FFmpeg natively writes virtually ALL its output to stderr -- including version info, stream details, encoding progress, and other informational messages. This is by design in native FFmpeg. So the printErr() callback in bind.js gets called for everything, and every log event gets type: "stderr".

Fix

Modified printErr() in src/bind/ffmpeg/bind.js to classify messages by content:

  • "ffout": Informational stderr output (progress bars, stream info, version, etc.)
  • "fferr": Actual error messages matching patterns like [error], [fatal], not found, invalid, cannot, etc.
  • "stdout": Unchanged (from print())

Breaking Change Note

Users who were checking type === "stderr" will need to update to type === "fferr" for error detection. This is a deliberate API improvement -- the old behavior was the bug itself.

Changes

  • src/bind/ffmpeg/bind.js: Added FFMPEG_ERROR_PATTERNS regex array and classification logic in printErr()
  • packages/types/types/index.d.ts: Updated Log.type JSDoc to document new values

Test plan

  • Run a successful transcoding command - all log events should have type "ffout", never "stderr"
  • Run a failing command (e.g., nonexistent input file) - error log events should have type "fferr"
  • Verify stdout logs still work unchanged

…derr

FFmpeg writes virtually all output (including informational messages like
version info, stream details, progress) to stderr. Previously every log
event had type "stderr", making it impossible to distinguish errors.

Now messages are classified by content:
- "ffout": informational stderr output (progress, stream info, etc.)
- "fferr": actual error messages ([error], [fatal], "not found", etc.)
- "stdout": unchanged (from print())

Fixes ffmpegwasm#877
@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for ffmpegwasm canceled.

Name Link
🔨 Latest commit a165442
🔍 Latest deploy log https://app.netlify.com/projects/ffmpegwasm/deploys/6a74789c5c01df0008d15fac

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.

All logs have stderr, even there are no errors

1 participant