Skip to content

Commit 80fd11e

Browse files
Suppress pydub ffmpeg warning on import (#4603)
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
1 parent 498f0b9 commit 80fd11e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

manim/scene/scene_file_writer.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import json
88
import shutil
9+
import warnings
910
from fractions import Fraction
1011
from pathlib import Path
1112
from queue import Queue
@@ -17,7 +18,17 @@
1718
import numpy as np
1819
import srt
1920
from PIL import Image
20-
from pydub import AudioSegment
21+
22+
# Manim handles audio conversion through PyAV directly. Importing pydub emits a
23+
# RuntimeWarning if ffmpeg/avconv is not on PATH, even when only WAV code paths
24+
# are used (which do not need ffmpeg). Silence this specific warning.
25+
with warnings.catch_warnings():
26+
warnings.filterwarnings(
27+
"ignore",
28+
message=r".*ffmpeg or avconv.*",
29+
category=RuntimeWarning,
30+
)
31+
from pydub import AudioSegment
2132

2233
from manim import __version__
2334

0 commit comments

Comments
 (0)