markitdown icon indicating copy to clipboard operation
markitdown copied to clipboard

fix: suppress pydub RuntimeWarning when ffmpeg is not installed

Open xor-xe opened this issue 7 months ago • 0 comments

Description

When pydub is imported on a system without ffmpeg or avconv in PATH, it emits a RuntimeWarning at import time — even when no audio conversion is being performed. This affects any user who has the audio-transcription extras installed.

The existing warnings.catch_warnings() block in _transcribe_audio.py already suppresses DeprecationWarning and SyntaxWarning on import, but RuntimeWarning was not covered.

Fix

Extend the existing filter block with a targeted filter for pydub's ffmpeg warning:

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

Using message=".*ffmpeg.*" keeps the scope narrow — only the specific "Couldn't find ffmpeg or avconv" warning is silenced, not all RuntimeWarnings. If ffmpeg is actually missing when audio conversion is attempted, pydub will raise a proper error at that point anyway.

Related

Fixes #1685

xor-xe avatar Apr 10 '26 14:04 xor-xe