From 61fbf6382e12751fb1448e5b63aa9f376649a64f Mon Sep 17 00:00:00 2001 From: hbrain Date: Thu, 28 May 2026 14:39:49 +0000 Subject: [PATCH] Add intro logo alpha constant --- README.md | 5 +++-- movmaker.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fa1241d..c441e3f 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ The most common visual timing/styling tweaks are exposed as constants near the t | `INTRO_LOGO_TARGET_HEIGHT_RATIO` | Portion of the video height used for the intro logo before padding (e.g. `0.75` = 75 % of frame height). | `0.75` | | `INTRO_LOGO_EXTRA_HOLD` | Extra seconds the synthesized intro still remains before the first crossfade. | `6.0` | | `INTRO_LOGO_FADE_OFFSET` | Minimum time (s) the logo stays fully visible before the first xfade is allowed to start. | `3.0` | +| `INTRO_LOGO_DEFAULT_ALPHA` | Default opacity for the intro logo (1 = fully opaque, 0 = invisible). | `1.0` | | `INTRO_TITLE_FADE_DELAY` | Seconds after start before the main title begins fading in. | `2.0` | | `INTRO_TITLE_FADE_LENGTH` | Seconds the fade-in/out lasts. | `1.0` | | `INTRO_TITLE_VISIBLE` | Seconds the title stays fully visible between fade in/out. | `4.0` | @@ -255,13 +256,13 @@ Adjust these constants and rerun `movmaker.py` to change the intro behavior with - if no audio file exists in the input folder, searches Jamendo using `--music-genre` and downloads one random Creative Commons track that allows non-commercial reuse and derivative works; default query is `cinematic punk rock` - reads the Jamendo client ID from `JAMENDO_CLIENT_ID` or `~/.config/movmaker/jamendo.env` - fades music in over `DEFAULT_AUDIO_FADE_IN` seconds (2 s) and out over `DEFAULT_AUDIO_FADE_OUT` seconds (10 s) by default -- builds a black intro still (matching the first media item’s resolution) when `--intro-logo` is provided, scales the logo to `INTRO_LOGO_TARGET_HEIGHT_RATIO` of the frame height (75 % by default), shows it at full opacity from frame 0, and keeps it on screen for `audio_fade_in + INTRO_LOGO_EXTRA_HOLD` seconds (with defaults this is `DEFAULT_AUDIO_FADE_IN + INTRO_LOGO_EXTRA_HOLD`, i.e. 8 s) before allowing the first crossfade +- builds a black intro still (matching the first media item’s resolution) when `--intro-logo` is provided, scales the logo to `INTRO_LOGO_TARGET_HEIGHT_RATIO` of the frame height (75 % by default), shows it at `INTRO_LOGO_DEFAULT_ALPHA` opacity (1.0 = fully opaque) from frame 0, and keeps it on screen for `audio_fade_in + INTRO_LOGO_EXTRA_HOLD` seconds (with defaults this is `DEFAULT_AUDIO_FADE_IN + INTRO_LOGO_EXTRA_HOLD`, i.e. 8 s) before allowing the first crossfade - opening title text fades in after `INTRO_TITLE_FADE_DELAY` seconds (2 s), stays visible for `INTRO_TITLE_VISIBLE` seconds (4 s), then fades out over `INTRO_TITLE_FADE_LENGTH` seconds (1 s) - fades the first real clip in and the final clip out with the `--video-fade` duration (default `DEFAULT_VIDEO_FADE`, currently 1 s); the black intro/logo pad respects this fade-in only when `INTRO_VIDEO_FADE_ENABLED` is `True` - displays optional per-file captions at bottom center with slightly off-white text and a soft shadow; use `|` to split caption lines - adds persistent bottom-left title/date/place and bottom-right `Bubulescu.Org` stamps - preserves special characters in rendered overlays and metadata -- uses safe ASCII only for generated filenames, so special letters become readable equivalents like `Č` -> `C`, `å` -> `a`, `ø` -> `o` +- uses safe ASCII only for generated filenames, so special letters become readable equivalents like `Č` -> `C`, `å` -> `aa`, `ø` -> `o`, `ä` -> `ae`, `ß` -> `ss` - embeds MP4 metadata: title, date, location/place, QuickTime location name, artist, comment, and creation_time - writes an MP4 file named like `YYYYMMDD_title.mp4` in the current directory by default; use `--out-dir DIR` to choose another output directory - takes `YYYYMMDD` from the first picture/video metadata, falling back to file modification date diff --git a/movmaker.py b/movmaker.py index ac43009..17d5ab4 100755 --- a/movmaker.py +++ b/movmaker.py @@ -39,6 +39,7 @@ DEFAULT_INTRO_LOGO = BASE_DIR / "img" / "moto_travel.png" INTRO_LOGO_TARGET_HEIGHT_RATIO = 0.75 INTRO_LOGO_EXTRA_HOLD = 6.0 INTRO_LOGO_FADE_OFFSET = 3.0 +INTRO_LOGO_DEFAULT_ALPHA = 1.0 INTRO_TITLE_FADE_DELAY = 2.0 INTRO_TITLE_FADE_LENGTH = 1.0 INTRO_TITLE_VISIBLE = 6.0 @@ -483,9 +484,20 @@ def media_date(path: Path) -> datetime: def ascii_safe(value: str) -> str: replacements = { + # Danish letters "æ": "ae", "Æ": "Ae", "ø": "o", "Ø": "O", "å": "aa", "Å": "Aa", + # German letters + "ä": "ae", "Ä": "Ae", + "ö": "oe", "Ö": "Oe", + "ü": "ue", "Ü": "Ue", + "ß": "ss", "ẞ": "SS", + # Croatian letters + "č": "c", "Č": "C", + "ć": "c", "Ć": "C", + "ž": "z", "Ž": "Z", + "š": "s", "Š": "S", "đ": "d", "Đ": "D", } value = "".join(replacements.get(ch, ch) for ch in value) @@ -1130,7 +1142,7 @@ def main(argv: list[str] | None = None) -> int: parser.add_argument("--audio-fade-in", type=float, default=DEFAULT_AUDIO_FADE_IN, help="music fade-in duration in seconds") parser.add_argument("--video-fade", type=float, default=DEFAULT_VIDEO_FADE, help="video fade-in/fade-out duration in seconds") parser.add_argument("--intro-logo", type=Path, default=DEFAULT_INTRO_LOGO, help="PNG logo shown centered over the black intro") - parser.add_argument("--intro-logo-alpha", type=float, default=1.0, help="opacity for the intro logo, from 0 to 1") + parser.add_argument("--intro-logo-alpha", type=float, default=INTRO_LOGO_DEFAULT_ALPHA, help="opacity for the intro logo, from 0 to 1") parser.add_argument("--resolution", type=parse_resolution, default=(1920, 1080), help="output resolution, e.g. 1920x1080") parser.add_argument("--fps", type=int, default=30, help="output frames per second") parser.add_argument("--preset", default="veryfast", help="x264 speed preset, e.g. ultrafast, superfast, veryfast")