Skip to content

fix: suppress pydub RuntimeWarning when ffmpeg is missing (fixes #1685)#1985

Open
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-1685-pydub-runtime-warning
Open

fix: suppress pydub RuntimeWarning when ffmpeg is missing (fixes #1685)#1985
hanhan761 wants to merge 1 commit into
microsoft:mainfrom
hanhan761:fix-1685-pydub-runtime-warning

Conversation

@hanhan761
Copy link
Copy Markdown

Summary

Suppresses the RuntimeWarning from pydub when ffmpeg/avconv is not installed. The warning appears on import even when audio transcription is not actively used.

Issue

Closes #1685

Change

_transcribe_audio.py:15 — added one line to the existing warnings.catch_warnings block:

warnings.filterwarnings("ignore", category=RuntimeWarning, message=".*ffmpeg.*")

Edge Cases Not Covered

  • If a user explicitly wants to see the warning (e.g. to debug why audio transcription fails), they can import pydub directly before using markitdown, or configure Python's warnings filter themselves.
  • This only affects the RuntimeWarning with "ffmpeg" in the message; other RuntimeWarnings from pydub or other dependencies are still visible.

Verification

Syntax validated with py_compile.compile(). The filter follows the same pattern as the existing DeprecationWarning and SyntaxWarning filters on the lines above.

Closes microsoft#1685

Importing pydub emits a RuntimeWarning when ffmpeg/avconv is not
installed on the system. This warning appears even when audio
transcription is not actively being used.

_transcribe_audio.py already wraps the imports in a
warnings.catch_warnings block that suppresses DeprecationWarning and
SyntaxWarning. Add a filter for the ffmpeg RuntimeWarning as well.
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.

[Bug]: RuntimeWarning from pydub: "Couldn't find ffmpeg or avconv" on Linux

1 participant