Skill: jilanfang/bilibili-video-prompt-analyzer (version 1.1.1)

--- name: bilibili-video-prompt-analyzer description: Analyze Bilibili AI-generated videos to extract/reverse-engineer prompts for imitation and replication. Extracts frames, extracts subtitles, generates detailed ComfyUI/Seedance-format prompts with keyframe and scene breakdown ready for direct use. Use when you have a Bilibili AI video link and want production-ready prompts to generate similar videos. author: jilanfang license: MIT tags: [bilibili, video, ai, prompt, reverse-engineering, analysis, frames, subtitle-extraction, comfyui, seedance, kling, runway, storyboard, keyframe] version: 1.1.1 --- # Bilibili AI Video Prompt Analyzer Extract/reverse-engineer **production-ready prompts** from Bilibili AI-generated videos for imitation. Outputs detailed prompts in ComfyUI/Seedance format that can be used directly with minimal edits. ## Workflow 1. **Download video**: Get video from Bilibili URL using yt-dlp 2. **Extract subtitles**: Extract soft or hard subtitles for voiceover reference/rewrite 3. **Extract frames**: Extract frames at configurable FPS (default: 1 frame/second) 4. **Visual analysis**: Analyze frame-by-frame to identify style, subjects, colors, composition, motion changes 5. **Structure output** (ready for direct use): - Technical metadata (aspect ratio, duration, fps, model recommendation) - 2-3 keyframe prompts (most distinct compositions, ComfyUI comma format) - Scene sequence by story beat (timeline + prompt evolution) - Full video master prompt (overall style + theme) - Extracted subtitle text (for voiceover reference) ## When to Use ✅ **Use this skill when:** - You have a Bilibili link to an AI-generated video - You want to imitate the style and generate similar videos - You need production-ready prompts that work directly in Seedance/ComfyUI/Kling - You want to extract subtitles to reuse or rewrite the voiceover - You want keyframe + scene breakdown for multi-step generation ❌ **Don't use when:** - The prompt is already in the video description (use agent-reach to extract directly) - It's a human-shot video not generated by AI ## Sampling Strategy | FPS | Use Case | Recommendation | |-----|----------|----------------| | 0.2 | Long video (>5min), big scene changes | Only key frames | | 1 | Short video (<1min) | **Default**, one frame per second | | 2-5 | Detailed motion analysis | Slow morphing animations | **Best practice**: 1fps for short videos (<1min) gives good granularity without redundancy. Most AI video evolution changes gradually, 1s interval captures the arc well. ## Requirements - `ffmpeg` installed (for frame extraction and subtitle extraction) - `yt-dlp` installed (for video download) - Multimodal LLM support (for visual frame analysis) ## Scripts - `scripts/download-bilibili.sh <url> <output-dir>` - Download video from Bilibili URL - `scripts/extract-frames.sh <video-file> <output-dir> [fps]` - Extract frames from video - `scripts/extract-subtitles.sh <video-file> <output-path>` - Extract subtitles to text file (supports soft and hardsubs) ## Output Format (Production-Ready) ### 1. Technical Metadata ``` Aspect Ratio: 9:16 (1080x1440) Duration: 35 seconds Frame Rate: 30 fps Recommended Model: Seedance 2.0 / Kling AI / Runway Gen-3 Motion Type: Slow fluid morphing, seamless transformation ``` ### 2. Keyframe Prompts (ComfyUI Format, comma-separated) One detailed prompt for each most distinct keyframe: ``` masterpiece, best quality, 8k, ultra detailed, tiny glowing point of light in deep indigo mist, volumetric godray, soft atmospheric haze, vertical composition 9:16, surreal abstract, mindscape, glowing particles, deep blue purple color palette, ethereal, dreamlike, cinematic lighting ``` ### 3. Scene Sequence Breakdown (by timeline beat) | Time | Visual Description | Prompt Addition | |------|-------------------|-----------------| | 0s-8s | Origin in void | glowing point, mist, void | | 8s-18s | Network growth | fibers spreading, interconnected thought network | ### 4. Full Video Master Prompt Complete cohesive prompt capturing overall style, theme, pacing that can be used directly. ### 5. Extracted Subtitles Clean text extracted for voiceover reference or rewrite. ## Prompt Quality Guidelines Output prompts follow Seedance/ComfyUI best practices: - Start with quality tokens: `masterpiece, best quality, 8k, ultra detailed` - Describe composition before style - Specify exact colors and lighting - Include aspect ratio and motion characteristics - Keep comma-separated format for direct copy-paste

path: scripts/download-bilibili.sh
content: #!/bin/bash
# download-bilibili.sh - Download video from Bilibili URL
# Usage: ./download-bilibili.sh <bilibili-url> <output-directory>

set -euo pipefail

if [ $# -lt 2 ]; then
    echo "Usage: $0 <bilibili-url> <output-directory>"
    exit 1
fi

URL="$1"
OUT_DIR="$2"

mkdir -p "$OUT_DIR"

echo "Downloading from Bilibili: $URL"
echo "Output directory: $OUT_DIR"

# Use yt-dlp to download the best quality available
# For Bilibili, we get 720p by default unless cookies are provided for higher quality
yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]' \
    --yes-playlist \
    -o "$OUT_DIR/%(title)s.%(ext)s" \
    "$URL"

echo "Download completed"
ls -lh "$OUT_DIR"


path: scripts/extract-frames.sh
content: #!/bin/bash
# extract-frames.sh - Extract frames from video for analysis
# Usage: ./extract-frames.sh <video-file> <output-dir> [fps]
# Default fps: 1 (one frame per second)

set -euo pipefail

if [ $# -lt 2 ]; then
    echo "Usage: $0 <video-file> <output-dir> [fps]"
    echo "Default fps: 1"
    exit 1
fi

VIDEO_FILE="$1"
OUT_DIR="$2"
FPS="${3:-1}"

mkdir -p "$OUT_DIR"

echo "Extracting frames from: $VIDEO_FILE"
echo "Output directory: $OUT_DIR"
echo "FPS: $FPS"

# Get video info
ffmpeg -i "$VIDEO_FILE" 2>&1 | grep -E "Duration|Input #|Stream #.*Video"

# Extract frames
# Output as JPEG with quality 2, scaled to max width 1280px
ffmpeg -y -i "$VIDEO_FILE" -vf "fps=$FPS,scale='min(1280,iw)':-2" -q:v 2 "$OUT_DIR/frame%04d.jpg"

FRAME_COUNT=$(ls -1 "$OUT_DIR"/frame*.jpg 2>/dev/null | wc -l)
echo "Extraction completed: $FRAME_COUNT frames extracted"


path: scripts/extract-subtitles.sh
content: #!/bin/bash
# extract-subtitles.sh - Extract subtitles from Bilibili video
# Usage: ./extract-subtitles.sh <video-file> <output-text-file>
# Supports: soft subs (embedded in video) and hard subs (TODO: OCR not implemented yet)

set -euo pipefail

if [ $# -lt 2 ]; then
    echo "Usage: $0 <video-file> <output-text-file>"
    exit 1
fi

VIDEO_FILE="$1"
OUTPUT_FILE="$2"

echo "Extracting subtitles from: $VIDEO_FILE"
echo "Output to: $OUTPUT_FILE"

# Check if there are subtitle streams
SUB_STREAMS=$(ffprobe -v error -select_streams s -show_entries stream=index:stream_tags=language -of csv=p=0 "$VIDEO_FILE" || true)

if [ -z "$SUB_STREAMS" ]; then
    echo "No embedded subtitle streams found."
    echo "For hardsubs (subtitles burned into video), OCR extraction is not implemented in this version."
    echo "Creating empty output file..."
    touch "$OUTPUT_FILE"
    exit 0
fi

echo "Found subtitle streams:"
echo "$SUB_STREAMS"

# Get first subtitle stream (usually Chinese)
FIRST_SUB=$(echo "$SUB_STREAMS" | head -1 | cut -d',' -f1)

# Extract subtitles to SRT
ffmpeg -y -i "$VIDEO_FILE" -map 0:s:"$FIRST_SUB" "$OUTPUT_FILE.srt"

# Convert SRT to plain text
# Remove sequence numbers, timestamps, and empty lines
grep -v -E '^[0-9]+$|^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{2}:[0-9]{2}:[0-9]{2} -->|^$' "$OUTPUT_FILE.srt" > "$OUTPUT_FILE"

# Cleanup
rm -f "$OUTPUT_FILE.srt"

LINE_COUNT=$(wc -l < "$OUTPUT_FILE")
echo "Subtitle extraction completed: $LINE_COUNT lines extracted to $OUTPUT_FILE"


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)