Skip to content

Commit

Permalink
fix: try for absolute ffprobe path on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanVoxel committed Dec 5, 2024
1 parent 3627b5a commit 35f32fe
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tagstudio/src/qt/helpers/vendored/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,34 @@
# Vendored from ffmpeg-python and ffmpeg-python PR#790 by amamic1803

import json
import platform
import shutil
import subprocess

import ffmpeg
import structlog
from src.qt.helpers.silent_popen import promptless_Popen

logger = structlog.get_logger(__name__)

def _probe(filename, cmd="ffprobe", timeout=None, **kwargs):
FFMPEG_MACOS_LOCATIONS: list[str] = ["", "/opt/homebrew/bin/", "/usr/local/bin/"]


def _get_ffprobe_location() -> str:
cmd: str = "ffprobe"
if platform.system() == "Darwin":
for loc in FFMPEG_MACOS_LOCATIONS:
if shutil.which(loc + cmd):
cmd = loc + cmd
break
logger.info(f"[FFPROBE] Using FFmpeg location: {cmd}")
return cmd


FFPROBE_CMD = _get_ffprobe_location()


def _probe(filename, cmd=FFPROBE_CMD, timeout=None, **kwargs):
"""Run ffprobe on the specified file and return a JSON representation of the output.
Raises:
Expand Down

0 comments on commit 35f32fe

Please sign in to comment.