Add Pixabay music fallback

This commit is contained in:
hbrain 2026-05-25 09:43:51 +00:00
parent e35201496f
commit 53b2e5ecca
2 changed files with 116 additions and 17 deletions

View file

@ -23,7 +23,7 @@ sudo apt install ffmpeg
The default title/stamp styling uses these fonts:
- Bebas Neue for the opening title, date, and location
- Noto Sans SemiBold for the bottom-left/bottom-right stamps and per-file captions
- Noto Sans Bold for the bottom-left/bottom-right stamps and per-file captions
Both fonts support common Danish and Croatian characters such as `æ ø å Æ Ø Å č ć ž š đ Č Ć Ž Š Đ`.
@ -33,9 +33,8 @@ Install them locally for the current user:
mkdir -p ~/.local/share/fonts/google
curl -L -o ~/.local/share/fonts/google/BebasNeue-Regular.ttf \
'https://github.com/google/fonts/raw/main/ofl/bebasneue/BebasNeue-Regular.ttf'
curl -L -o ~/.local/share/fonts/google/NotoSans-SemiBold.ttf \
'https://github.com/google/fonts/raw/main/ofl/notosans/NotoSans%5Bwdth,wght%5D.ttf'
fc-cache -f ~/.local/share/fonts/google
sudo apt install fonts-noto-core
fc-cache -f
```
Check that fonts are available:
@ -45,6 +44,36 @@ fc-match 'Bebas Neue'
fc-match 'Noto Sans'
```
## Optional Pixabay music download
If the input folder has no audio file, movmaker can download one random track from Pixabay Music.
Save your Pixabay API key in either an environment variable:
```bash
export PIXABAY_API_KEY='your_key_here'
```
or in a local config file:
```bash
mkdir -p ~/.config/movmaker
echo 'PIXABAY_API_KEY=your_key_here' > ~/.config/movmaker/pixabay.env
chmod 600 ~/.config/movmaker/pixabay.env
```
The default music search query is:
```text
cinematic punk rock
```
Override it with:
```bash
python3 movmaker.py input --music-genre "upbeat rock"
```
## Input folder
Example:
@ -134,6 +163,7 @@ python3 movmaker.py input \
--audio-fade 10 \
--audio-fade-in 2 \
--video-fade 1.5 \
--music-genre "cinematic punk rock" \
--resolution 1920x1080 \
--fps 30
```
@ -153,10 +183,12 @@ python3 movmaker.py input --preview
- includes video clips inline
- crossfades between media items over 3 seconds by default
- loops/trims music to match the video
- if no audio file exists in the input folder, searches Pixabay Music using `--music-genre` and downloads one random track; default query is `cinematic punk rock`
- reads the Pixabay API key from `PIXABAY_API_KEY` or `~/.config/movmaker/pixabay.env`
- fades music in over 2 seconds and out over 10 seconds by default
- fades video in/out over 1.5 seconds by default
- overlays the opening title for the first 6 seconds: large title, then date/location on one line
- displays optional per-file captions at bottom center with a shadow; use `|` to split caption lines
- displays optional per-file captions at bottom center with a thin black outline; use `|` to split caption lines
- adds persistent bottom-left title/date/place and bottom-right `@bubulescu` 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`