ffmpeg-skill 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/SKILL.md +15 -12
- package/docs/contract.md +28 -9
- package/package.json +1 -1
- package/references/gotchas.md +49 -7
- package/references/scripts.md +57 -5
- package/scripts/_common.py +378 -0
- package/scripts/_contract.py +53 -6
- package/scripts/caption.py +449 -16
- package/scripts/graphics.py +18 -3
- package/scripts/overlay.py +9 -1
- package/scripts/render.py +5 -4
package/scripts/overlay.py
CHANGED
|
@@ -24,7 +24,7 @@ import argparse
|
|
|
24
24
|
import sys
|
|
25
25
|
from typing import List, Optional
|
|
26
26
|
|
|
27
|
-
from _common import STATE, load_brand, video_args, add_common, apply_common, default_font_file, emit, aac_args, cfr_args, default_output, die, escape_drawtext, escape_filter_path, ffmpeg_base, info, parse_time, probe, run, run_keeping_subtitles, validate_color, x264_args, X264_PRESETS, time_arg, fmt_secs
|
|
27
|
+
from _common import STATE, script_font_for_text, load_brand, video_args, add_common, apply_common, default_font_file, emit, aac_args, cfr_args, default_output, die, escape_drawtext, escape_filter_path, ffmpeg_base, info, parse_time, probe, run, run_keeping_subtitles, validate_color, x264_args, X264_PRESETS, time_arg, fmt_secs
|
|
28
28
|
|
|
29
29
|
POS = {
|
|
30
30
|
"top-left": ("{m}", "{m}"),
|
|
@@ -144,6 +144,14 @@ def main() -> int:
|
|
|
144
144
|
args.font = brand.get("font", args.font)
|
|
145
145
|
if not args.font_file and brand.get("font_file"):
|
|
146
146
|
args.font_file = brand["font_file"]
|
|
147
|
+
if args.text and not args.font_file:
|
|
148
|
+
# 1.12: non-Latin overlay text picks a font by script, so a title in Japanese, Korean,
|
|
149
|
+
# Arabic ... draws glyphs instead of boxes. drawtext does not shape or reorder RTL text --
|
|
150
|
+
# see references/gotchas.md#fonts-by-script.
|
|
151
|
+
_script, script_file, _family = script_font_for_text(
|
|
152
|
+
args.text, font=args.font, font_explicit=args.font != ap.get_default("font"), font_file=args.font_file)
|
|
153
|
+
if script_file:
|
|
154
|
+
args.font_file = script_file
|
|
147
155
|
if not args.font_file:
|
|
148
156
|
args.font_file = default_font_file(args.font)
|
|
149
157
|
meta = probe(args.input)
|
package/scripts/render.py
CHANGED
|
@@ -91,9 +91,10 @@ OBJECT_KEYS: Dict[str, frozenset] = {
|
|
|
91
91
|
"transition": frozenset({"type", "duration"}),
|
|
92
92
|
"silence": frozenset({"threshold", "min_silence", "margin"}),
|
|
93
93
|
"captions": frozenset({"text", "srt", "ass", "font", "size", "color", "position", "margin",
|
|
94
|
-
"animate", "highlight_color", "outline", "karaoke", "bold", "box"
|
|
94
|
+
"animate", "highlight_color", "outline", "karaoke", "bold", "box",
|
|
95
|
+
"lang", "offset", "max_lines", "min_duration"}),
|
|
95
96
|
"graphics[]": frozenset({"template", "name", "title", "subtitle", "start", "end", "position",
|
|
96
|
-
"from", "scale", "primary", "text_color"}),
|
|
97
|
+
"from", "scale", "primary", "text_color", "lang"}),
|
|
97
98
|
"overlays[]": frozenset({"logo", "image", "text", "position", "start", "end", "fade", "opacity",
|
|
98
99
|
"scale", "font_size", "font", "font_file", "margin", "box"}),
|
|
99
100
|
"audio": frozenset({"music", "replace", "music_volume", "fade_in", "fade_out", "music_fade_out",
|
|
@@ -418,7 +419,7 @@ def main() -> int:
|
|
|
418
419
|
argv += ["--ass", rel(cap["ass"])]
|
|
419
420
|
else:
|
|
420
421
|
die("captions needs text, srt or ass")
|
|
421
|
-
for k, flag in (("font", "--font"), ("size", "--size"), ("color", "--color"), ("position", "--position"), ("margin", "--margin"), ("animate", "--animate"), ("highlight_color", "--highlight-color"), ("outline", "--outline")):
|
|
422
|
+
for k, flag in (("font", "--font"), ("size", "--size"), ("color", "--color"), ("position", "--position"), ("margin", "--margin"), ("animate", "--animate"), ("highlight_color", "--highlight-color"), ("outline", "--outline"), ("lang", "--lang"), ("offset", "--offset"), ("max_lines", "--max-lines"), ("min_duration", "--min-duration")):
|
|
422
423
|
if cap.get(k) is not None:
|
|
423
424
|
argv += [flag, str(cap[k])]
|
|
424
425
|
for k, flag in (("karaoke", "--karaoke"), ("bold", "--bold"), ("box", "--box")):
|
|
@@ -437,7 +438,7 @@ def main() -> int:
|
|
|
437
438
|
if not g.get("template"):
|
|
438
439
|
die(f"graphics[{i}] needs a template")
|
|
439
440
|
argv = [current, "-o", nxt, "--template", g["template"]]
|
|
440
|
-
for k, flag in (("name", "--name"), ("title", "--title"), ("subtitle", "--subtitle"), ("start", "--start"), ("end", "--end"), ("position", "--position"), ("from", "--from"), ("scale", "--scale"), ("primary", "--primary"), ("text_color", "--text-color")):
|
|
441
|
+
for k, flag in (("name", "--name"), ("title", "--title"), ("subtitle", "--subtitle"), ("start", "--start"), ("end", "--end"), ("position", "--position"), ("from", "--from"), ("scale", "--scale"), ("primary", "--primary"), ("text_color", "--text-color"), ("lang", "--lang")):
|
|
441
442
|
if g.get(k) is not None:
|
|
442
443
|
argv += [flag, str(g[k])]
|
|
443
444
|
sh("graphics.py", *(argv + brand_args))
|