Skip to content

Commit 99474f6

Browse files
committed
Update ffmpeg binary path and force MoviePy and ImageIO to use it
1 parent 46c09ee commit 99474f6

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.6] - 2024-09-15
9+
10+
- Force `MoviePy` and `ImageIO` to use the `ffmpeg` binary from the `PATH` environment variable.
11+
812
## [1.0.5] - 2024-09-06
913

1014
- Fix reexecution with admin privileges.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Add automatic captions to YouTube Shorts (and other videos) using Whisper and Mo
88

99
## Requirements
1010

11-
- Install [FFmpeg](https://ffmpeg.org/download.html) (make sure it's in your `PATH`)
12-
- Install [ImageMagick](https://imagemagick.org/script/download.php). Make sure to tick both boxes during installation:
11+
- Install the **latest** verion of [FFmpeg](https://ffmpeg.org/download.html) (make sure it's in your `PATH`)
12+
- Install the **latest** version of [ImageMagick](https://imagemagick.org/script/download.php). Make sure to tick both boxes during installation:
1313

1414
- Install legacy utilities (e.g. convert)
15-
- Add application directory to your system path
15+
- Add application directory to your system `PATH`
1616

1717

1818
## Quick start

captametropolis/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .utils import (
1414
_detect_local_whisper,
1515
_get_font_path,
16+
ffmpeg_binary,
1617
ffmpeg_installed,
1718
imagemagick_binary,
1819
)
@@ -28,6 +29,9 @@
2829

2930
if not ffmpeg_installed():
3031
raise UtilityNotFoundError("FFmpeg")
32+
else:
33+
change_settings({"FFMPEG_BINARY": ffmpeg_binary()})
34+
os.environ["IMAGEIO_FFMPEG_EXE"] = ffmpeg_binary()
3135

3236
if imagemagick_binary() == "unset":
3337
raise UtilityNotFoundError("ImageMagick")

captametropolis/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.5"
1+
__version__ = "1.0.6"

captametropolis/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ def _detect_local_whisper(verbose: bool = False):
8888
return use_local_whisper
8989

9090

91+
def ffmpeg_binary() -> str:
92+
return shutil.which("ffmpeg") or "unset"
93+
94+
9195
def ffmpeg_installed() -> bool:
92-
return shutil.which("ffmpeg") is not None
96+
return ffmpeg_binary() != "unset"
9397

9498

9599
def imagemagick_directory() -> str:

0 commit comments

Comments
 (0)