Spaces:
Sleeping
Sleeping
File size: 766 Bytes
2cb327c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | """
FFmpeg Utilities
================
Shared check for FFmpeg availability, used by both Hindi and English TTS modules.
Usage:
from backend.common import check_ffmpeg
has_ffmpeg = check_ffmpeg()
"""
import subprocess
def check_ffmpeg() -> bool:
"""Check whether FFmpeg is installed and available on the system PATH.
Returns True if the `ffmpeg -version` command exits successfully.
Returns False otherwise (prints install instructions on first failure).
"""
try:
subprocess.run(
["ffmpeg", "-version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True,
)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False
|