Skip to content

AgriciDaniel/claude-shorts

shorts

Verified

Interactive longform-to-shortform video creator. Extracts viral-ready short clips from long videos using Claude as the orchestrator. Transcribes with faster-whisper (GPU), Claude scores and presents candidate segments interactively, user picks and adjusts, Remotion renders premium animated captions (Bold/Bounce/Clean styles), FFmpeg exports platform-optimized files (YouTube Shorts, TikTok, Instagram Reels). Use when user says "shorts", "short clips", "shortform", "extract clips", "tiktok from video", "reels from video", "vertical clips", or "create shorts".

FileKindSize
SKILL.mdskill md12.5 KB
references/caption-styles.mdmarkdown3.5 KB
references/platform-specs.mdmarkdown4.3 KB
references/remotion-patterns.mdmarkdown5.0 KB
references/scoring-rubric.mdmarkdown4.2 KB
scripts/compute_reframe.pyexecutablescript14.4 KB
scripts/detect_content.pyexecutablescript6.8 KB
scripts/detect_gpu.shexecutablescript1.9 KB
scripts/export.shexecutablescript5.5 KB
scripts/preflight.shexecutablescript3.4 KB
scripts/snap_boundaries.pyexecutablescript9.4 KB
scripts/transcribe.pyexecutablescript6.7 KB
scripts/validate.shexecutablescript4.6 KB

scripts/export.sh

View on GitHub
#!/usr/bin/env bash
# Platform-specific FFmpeg encoding for exported shorts
# Usage: bash scripts/export.sh --input-dir DIR --platform PLATFORM --output-dir DIR
set -euo pipefail

INPUT_DIR=""
PLATFORM="all"
OUTPUT_DIR="./shorts"
FORCE="false"

while [[ $# -gt 0 ]]; do
    case "$1" in
        --input-dir) INPUT_DIR="$2"; shift 2 ;;
        --platform) PLATFORM="$2"; shift 2 ;;
        --output-dir) OUTPUT_DIR="$2"; shift 2 ;;
        --force) FORCE="true"; shift ;;
        *) echo "Unknown option: $1" >&2; exit 1 ;;
    esac
done

if [ -z "$INPUT_DIR" ]; then
    echo '{"error":"Usage: export.sh --input-dir DIR [--platform youtube|tiktok|instagram|all] [--output-dir DIR]"}'
    exit 1
fi

if [ ! -d "$INPUT_DIR" ]; then
    echo "{\"error\":\"Input directory not found: $INPUT_DIR\"}"
    exit 1
fi

mkdir -p "$OUTPUT_DIR"

# Detect GPU for NVENC
HAS_NVENC="false"
if command -v nvidia-smi &>/dev/null && command -v ffmpeg &>/dev/null; then
    if ffmpeg -hide_banner -encoders 2>/dev/null | grep -q "h264_nvenc"; then
        HAS_NVENC="true"
    fi
fi

# Platform encoding functions
encode_youtube() {
    local input="$1" output="$2"
    if [ "$HAS_NVENC" = "true" ]; then
        ffmpeg -y -i "$input" \
            -c:v h264_nvenc -preset p5 -tune hq \
            -b:v 12M -maxrate 14M -bufsize 24M \
            -profile:v high -level 4.2 \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 192k -ar 48000 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    else
        ffmpeg -y -i "$input" \
            -c:v libx264 -preset slow \
            -b:v 12M -maxrate 14M -bufsize 24M \
            -profile:v high -level 4.2 \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 192k -ar 48000 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    fi
}

encode_tiktok() {
    local input="$1" output="$2"
    if [ "$HAS_NVENC" = "true" ]; then
        ffmpeg -y -i "$input" \
            -c:v h264_nvenc -preset p5 -tune hq \
            -cq 18 -maxrate 10M -bufsize 20M \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 128k -ar 44100 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    else
        ffmpeg -y -i "$input" \
            -c:v libx264 -preset slow -crf 18 \
            -maxrate 10M -bufsize 20M \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 128k -ar 44100 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    fi
}

encode_instagram() {
    local input="$1" output="$2"
    if [ "$HAS_NVENC" = "true" ]; then
        ffmpeg -y -i "$input" \
            -c:v h264_nvenc -preset p5 -tune hq \
            -b:v 4500k -maxrate 5000k -bufsize 10M \
            -profile:v high -level 4.2 \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 128k -ar 44100 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    else
        ffmpeg -y -i "$input" \
            -c:v libx264 -preset slow \
            -b:v 4500k -maxrate 5000k -bufsize 10M \
            -profile:v high -level 4.2 \
            -af loudnorm=I=-14:TP=-1:LRA=11 \
            -c:a aac -b:a 128k -ar 44100 \
            -pix_fmt yuv420p -movflags +faststart \
            "$output" 2>/dev/null
    fi
}

# Process each rendered short
RESULTS=()
COUNT=0

for input_file in "$INPUT_DIR"/short_*.mp4; do
    [ -f "$input_file" ] || continue
    COUNT=$((COUNT + 1))

    base=$(basename "$input_file" .mp4)
    num="${base#short_}"

    platforms=()
    if [ "$PLATFORM" = "all" ]; then
        platforms=("youtube" "tiktok" "instagram")
    else
        platforms=("$PLATFORM")
    fi

    for plat in "${platforms[@]}"; do
        case "$plat" in
            youtube)  suffix="_yt"; encode_func="encode_youtube" ;;
            tiktok)   suffix="_tt"; encode_func="encode_tiktok" ;;
            instagram) suffix="_ig"; encode_func="encode_instagram" ;;
            *) echo "Unknown platform: $plat" >&2; continue ;;
        esac

        output_file="$OUTPUT_DIR/short_${num}${suffix}.mp4"

        # Skip if output already exists (use --force to overwrite)
        if [ -f "$output_file" ] && [ "$FORCE" != "true" ]; then
            size=$(du -k "$output_file" | cut -f1)
            size_mb=$(echo "scale=1; $size / 1024" | bc)
            duration=$(ffprobe -v quiet -show_entries format=duration -of csv=p=0 "$output_file" 2>/dev/null)
            duration_int=$(printf "%.0f" "$duration" 2>/dev/null || echo "0")
            RESULTS+=("{\"file\":\"$output_file\",\"platform\":\"$plat\",\"duration\":\"${duration_int}s\",\"size_mb\":$size_mb,\"skipped\":true}")
            continue
        fi

        $encode_func "$input_file" "$output_file"

        # Get file info
        size=$(du -k "$output_file" | cut -f1)
        size_mb=$(echo "scale=1; $size / 1024" | bc)
        duration=$(ffprobe -v quiet -show_entries format=duration -of csv=p=0 "$output_file" 2>/dev/null)
        duration_int=$(printf "%.0f" "$duration" 2>/dev/null || echo "0")

        RESULTS+=("{\"file\":\"$output_file\",\"platform\":\"$plat\",\"duration\":\"${duration_int}s\",\"size_mb\":$size_mb}")
    done
done

# Build JSON output
RESULTS_JSON=$(printf '%s\n' "${RESULTS[@]}" | paste -sd ',' | sed 's/^/[/' | sed 's/$/]/')

cat <<EOF
{
  "action": "export",
  "platform": "$PLATFORM",
  "nvenc": $HAS_NVENC,
  "shorts_exported": $COUNT,
  "output_dir": "$OUTPUT_DIR",
  "files": $RESULTS_JSON
}
EOF
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall