Skip to content

Commit 7e10ab1

Browse files
committed
Remove ae-ffmpeg and --my-ffmpeg
1 parent 8793ba4 commit 7e10ab1

File tree

6 files changed

+25
-31
lines changed

6 files changed

+25
-31
lines changed

auto_editor/__main__.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import auto_editor
1010
from auto_editor.edit import edit_media
11-
from auto_editor.ffwrapper import FFmpeg, initFFmpeg
11+
from auto_editor.ffwrapper import FFmpeg
1212
from auto_editor.utils.func import get_stdout
1313
from auto_editor.utils.log import Log
1414
from auto_editor.utils.types import (
@@ -166,11 +166,6 @@ def main_options(parser: ArgumentParser) -> ArgumentParser:
166166
metavar="PATH",
167167
help="Set a custom path to the ffmpeg location",
168168
)
169-
parser.add_argument(
170-
"--my-ffmpeg",
171-
flag=True,
172-
help="Use the ffmpeg on your PATH instead of the one packaged",
173-
)
174169
parser.add_text("Display Options:")
175170
parser.add_argument(
176171
"--progress",
@@ -279,7 +274,7 @@ def get_domain(url: str) -> str:
279274

280275
yt_dlp_path = args.yt_dlp_location
281276

282-
cmd = ["--ffmpeg-location", ffmpeg.path]
277+
cmd = ["--ffmpeg-location", ffmpeg.get_path("yt-dlp", log)]
283278

284279
if download_format is not None:
285280
cmd.extend(["-f", download_format])
@@ -357,7 +352,7 @@ def main() -> None:
357352
is_machine = args.progress == "machine"
358353
log = Log(args.debug, args.quiet, args.temp_dir, is_machine, no_color)
359354

360-
ffmpeg = initFFmpeg(log, args.ffmpeg_location, args.my_ffmpeg)
355+
ffmpeg = FFmpeg(args.ffmpeg_location)
361356
paths = []
362357
for my_input in args.input:
363358
if my_input.startswith("http://") or my_input.startswith("https://"):

auto_editor/ffwrapper.py

+17-19
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,29 @@
1111
from auto_editor.utils.log import Log
1212

1313

14-
def initFFmpeg(log: Log, ff_location: str | None, my_ffmpeg: bool) -> FFmpeg:
15-
if ff_location is not None:
16-
program = ff_location
17-
elif my_ffmpeg:
18-
program = "ffmpeg"
19-
else:
20-
try:
21-
import ae_ffmpeg
14+
def _get_ffmpeg(reason: str, ffloc: str | None, log: Log) -> str:
15+
program = "ffmpeg" if ffloc is None else ffloc
16+
if (path := which(program)) is None:
17+
log.error(f"{reason} needs ffmpeg cli but couldn't find ffmpeg on PATH.")
18+
return path
2219

23-
program = ae_ffmpeg.get_path()
24-
except ImportError:
25-
program = "ffmpeg"
2620

27-
path: str | None = which(program)
28-
if path is None:
29-
log.error("Did not find ffmpeg on PATH.")
21+
@dataclass(slots=True)
22+
class FFmpeg:
23+
ffmpeg_location: str | None
24+
path: str | None = None
3025

31-
return FFmpeg(path)
26+
def get_path(self, reason: str, log: Log) -> str:
27+
if self.path is not None:
28+
return self.path
3229

30+
self.path = _get_ffmpeg(reason, self.ffmpeg_location, log)
31+
return self.path
3332

34-
@dataclass(slots=True)
35-
class FFmpeg:
36-
path: str
33+
def Popen(self, reason: str, cmd: list[str], log: Log) -> Popen:
34+
if self.path is None:
35+
self.path = _get_ffmpeg(reason, self.ffmpeg_location, log)
3736

38-
def Popen(self, cmd: list[str]) -> Popen:
3937
return Popen([self.path] + cmd, stdout=PIPE, stderr=PIPE)
4038

4139

auto_editor/render/audio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def apply_audio_normalization(
122122
"null",
123123
file_null,
124124
]
125-
stderr = ffmpeg.Popen(cmd).communicate()[1]
125+
stderr = ffmpeg.Popen("EBU", cmd, log).communicate()[1]
126126
name, filter_args = parse_ebu_bytes(norm, stderr, log)
127127
else:
128128
assert "t" in norm

auto_editor/utils/types.py

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ class Args:
218218
no_open: bool = False
219219
temp_dir: str | None = None
220220
ffmpeg_location: str | None = None
221-
my_ffmpeg: bool = False
222221
progress: str = "modern"
223222
version: bool = False
224223
debug: bool = False

changelogs/2024.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# 26.0.1 (Unreleased)
22

33
## Fixes
4+
- Fix `ssa` not being a known format.
45
- Catch exception when parsing invalid bitrate.
5-
- Remove `--show-ffmpeg-commands` `--show-ffmpeg-debug` options.
6+
- Remove the `--my-ffmpeg` `--show-ffmpeg-commands` `--show-ffmpeg-debug` cli options.
7+
- Remove the `ae-ffmpeg` package dependency.
8+
- Remove unused args, functions.
69

710
# 26.0.0
811

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ requires-python = ">=3.10,<3.14"
1111
dependencies = [
1212
"numpy>=1.23.0,<3.0",
1313
"pyav==13.1.*",
14-
"ae-ffmpeg==1.2.*",
1514
]
1615
keywords = [
1716
"video", "audio", "media", "editor", "editing",

0 commit comments

Comments
 (0)