본문으로 건너뛰기
cccskills
무료GitHub에 공개

social-media-slideshow-video

PIL + ffmpeg slideshow videos: product reviews, promos, TikTok/Reels/Shorts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구TikTok

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md6.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Social Media Slideshow Video Generator

When to use

Use when users request: product review videos, promotional slideshow videos, TikTok/Reels/Shorts content from static images, photo-based video with text overlays, hijab/fashion/beauty review videos, unboxing recap videos, or any image-to-video social media content with designed slides.

Stack

LayerToolPurpose
ImagingPillow (PIL)Slide design, text rendering, image manipulation
Encodingffmpeg (CLI)Frame sequence → MP4 encoding
CorePython 3Orchestration

No GPU, no moviepy, no heavy dependencies needed.

Architecture: File-Based Frame Pipeline

Critical: Do NOT store all frames as numpy arrays in memory. A 15-second 1080×1920 video at 24fps = 360 frames × ~6MB each = 2.1GB RAM → OOM kill.

Correct approach:

1. Render each SLIDE as a static PIL Image (5-10 slides in memory is fine)
2. For each slide, generate per-frame variations (fade, zoom) and SAVE AS PNG to tmpdir
3. Feed the PNG sequence to ffmpeg via -i pattern
4. Clean up temp files

Why not pipe to ffmpeg stdin?

Piping raw RGB frames to ffmpeg stdin causes deadlocks and broken pipe errors in many environments. The file-based approach is robust and debuggable.

Resolution Presets

PlatformResolutionAspectFPS
TikTok / Reels / Shorts1080×19209:1624
YouTube landscape1920×108016:924-30
Instagram square1080×10801:124
Story/Status1080×19209:1624

Slide Types & Design Patterns

1. Title Slide

  • Gradient background (soft, matching product color)
  • Hero photo in rounded-rect or circular frame with colored border
  • Product name + subtitle text centered below
  • Tag/category text above photo

2. Detail/Review Slide

  • Blurred photo as background (GaussianBlur(radius=20) + dark blend at 0.55)
  • Photo at top with gradient fade mask at bottom edge
  • Semi-transparent card overlay (RGBA with alpha ~220) with rounded corners
  • Bullet points + rating text

3. Verdict/Score Slide

  • Gradient background
  • Circular photo with colored border
  • Large score text (e.g., "9.5/10")
  • Verdict text + CTA

Key Techniques

Gradient Background

def gradient_bg(w, h, c1, c2):
    img = Image.new("RGB", (w, h))
    px = img.load()
    for y in range(h):
        r = y / h
        for x in range(w):
            px[x, y] = (int(c1[0]*(1-r)+c2[0]*r), ...)
    return img

Photo with Rounded/Circular Mask

mask = Image.new("L", (size, size), 0)
ImageDraw.Draw(mask).rounded_rectangle([0, 0, size, size], radius=35, fill=255)
# or .ellipse([0, 0, size, size], fill=255) for circular
frame.paste(photo, (x, y), mask)

Colored Border Around Photo

bdr = 8
border_img = Image.new("RGB", (size+bdr*2, size+bdr*2), border_color)
border_mask = Image.new("L", border_img.size, 0)
ImageDraw.Draw(border_mask).rounded_rectangle([0,0,...], radius=40, fill=255)
frame.paste(border_img, (x-bdr, y-bdr), border_mask)
frame.paste(photo, (x, y), photo_mask)  # photo on top

Semi-Transparent Card Overlay

card = Image.new("RGBA", (cw, ch), (255, 248, 240, 220))
cmask = Image.new("L", (cw, ch), 0)
ImageDraw.Draw(cmask).rounded_rectangle([0,0,cw,ch], radius=25, fill=220)
frame_rgba = frame.convert("RGBA")
frame_rgba.paste(card, (x, y), cmask)
frame = frame_rgba.convert("RGB")

Blurred Photo Background

bg = prepare_photo(WIDTH, HEIGHT, zoom=1.5)
bg = bg.filter(ImageFilter.GaussianBlur(radius=20))
dark = Image.new("RGB", (WIDTH, HEIGHT), (40, 30, 30))
frame = Image.blend(bg, dark, 0.55)

Gradient Fade Mask (photo fading to transparent at bottom)

gmask = Image.new("L", (w, h), 255)
gd = ImageDraw.Draw(gmask)
for y in range(h - fade_height, h):
    alpha = int(255 * (1 - (y - (h - fade_height)) / fade_height))
    gd.rectangle([(0, y), (w, y)], fill=alpha)
frame.paste(photo, (0, 0), gmask)

Fade Transitions Between Slides

black = Image.new("RGB", (WIDTH, HEIGHT), (0, 0, 0))
if frame_idx < TRANSITION_FRAMES:
    alpha = frame_idx / TRANSITION_FRAMES
    out = Image.blend(black, slide_img, alpha)
elif frame_idx > total - TRANSITION_FRAMES:
    alpha = (total - frame_idx) / TRANSITION_FRAMES
    out = Image.blend(black, slide_img, alpha)

ffmpeg Encoding Command

cmd = [
    "ffmpeg", "-y",
    "-framerate", str(FPS),
    "-i", os.path.join(tmpdir, "frame_%05d.png"),
    "-c:v", "libx264",
    "-preset", "fast",
    "-crf", "23",
    "-pix_fmt", "yuv420p",
    "-movflags", "+faststart",
    output_path,
]
subprocess.run(cmd, capture_output=True, text=True, timeout=300)

Font Handling

def get_font(size, bold=False):
    fp = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" if bold \
         else "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
    if os.path.exists(fp):
        return ImageFont.truetype(fp, size)
    return ImageFont.load_default()

Center text: bbox = draw.textbbox((0,0), text, font=f); x = (WIDTH - (bbox[2]-bbox[0])) // 2

Typical Duration & Pacing

Slide typeDurationTransition
Title3-4s0.3s fade
Detail3-3.5s0.3s fade
Verdict3.5-4s0.3s fade
Total15-20s—

Pitfalls

  1. OOM Kill: Never accumulate all frames as numpy arrays. Use file-based pipeline.
  2. ffmpeg stdin pipe: Deadlocks on long videos. Use PNG sequence input instead.
  3. pip on Ubuntu 24.04+: Needs --break-system-packages flag.
  4. Emoji/Unicode in text: DejaVu fonts don't render emoji. Use text descriptions or install emoji fonts.
  5. Color matching: Extract dominant color from product photo to build cohesive palette.
  6. Text centering: Always use textbbox() for accurate width measurement before centering.

Verification

After generating, extract mid-slide frames to verify (not transition frames):

# Extract frame from middle of each slide (not transitions which are black)
ffmpeg -i output.mp4 -vf "select='eq(n\,36)+eq(n\,108)...'" -vsync vfr preview_%d.jpg
ffprobe -v quiet -print_format json -show_format -show_streams output.mp4

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Drives development with tests. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

airtable

무료

Airtable REST API via curl. Records CRUD, filters, upserts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

Build monitoring bots that poll APIs and send notifications on state changes (new listings, price alerts, status updates)

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

REST/GraphQL API testing with automated validation — test endpoints, validate responses, check status codes, and ensure API contracts

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

Manage Apple Notes via memo CLI: create, search, edit.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kevinnft/ai-agent-skills142026년 8월 1일 업데이트

kevinnft의 스킬 모두 보기

이 스킬의 문제 신고