Video Logo Watermark
Overview
Add a logo watermark (from D:\logo\logo_black_text.png) to mp4 videos placed in
D:\workspace\. After processing, source videos are moved to
D:\workspace\完成\源文件\ and watermarked videos to D:\workspace\完成\增加logo\.
Workflow
Step 1: Discover new videos
List mp4 files in D:\workspace\ root that do NOT already have _with_logo in
their name:
Get-ChildItem -Path D:\workspace -Filter *.mp4 -File |
Where-Object { $_.BaseName -notmatch "_with_logo$" } |
Select-Object Name, @{N="SizeMB";E={[math]::Round($_.Length/1MB,1)}}
Step 2: Update the script
The processing script is scripts/add_logo.py. Copy it to D:\workspace\add_logo.py
before running. Modify the tasks list at the top of the script with the discovered
filenames:
tasks = [
("filename1.mp4", 0.25, "bottom-center"),
("filename2.mp4", 0.25, "bottom-center"),
]
Each task tuple: (filename, logo_width_ratio, position).
Position options:
- "bottom-center" — centered at bottom, 20px margin from edge
- "bottom-right" — bottom-right corner, 20px margin
- (x, y) — custom pixel coordinates
Step 3: Run the script
& "C:\Users\Administrator\.workbuddy\binaries\python\envs\default\Scripts\python.exe" D:\workspace\add_logo.py
The script:
1. Reads each video, overlays the logo
2. Writes output as {name}_with_logo.mp4
3. Auto-archives: source → 完成\源文件\, output → 完成\增加logo\
4. Skips files that already have a _with_logo output
Step 4: Deliver results
After processing, deliver the watermarked video(s) from
D:\workspace\完成\增加logo\ using deliver_attachments.
Environment
- Python:
C:\Users\Administrator\.workbuddy\binaries\python\envs\default\ - Dependencies: moviepy, Pillow (already installed)
- Logo file:
D:\logo\logo_black_text.png - Script:
scripts/add_logo.py(copy toD:\workspace\add_logo.pybefore running)
Default Parameters
| Parameter | Default | Notes |
|---|---|---|
| Position | bottom-center |
Also supports bottom-right, custom (x,y) |
| Logo width | 25% of video width | Range typically 15%-50% |
| Margin | 20px | From edge of video |
| Archive source | D:\workspace\完成\源文件\ |
Auto-created if missing |
| Archive output | D:\workspace\完成\增加logo\ |
Auto-created if missing |
Notes
- The script uses moviepy with libx264/aac codecs for broad compatibility
- Warning about last-frame bytes missing is benign — moviepy fills with last valid frame
- If a video already has a
_with_logocounterpart, it is skipped - Update working memory (
YYYY-MM-DD.mdandMEMORY.md) after each batch