opencode Skill

muapi-youtube-shorts

Auto-generate viral 9:16 YouTube Shorts (or TikTok / Reels clips) from a long-form video. Thin platform-aware wrapper around the AI Clipping skill — picks sensible defaults for short-form social platforms (9:16, 30–60s sweet spot) and delegates the actual highlight extraction + c

LLM Mart · 0 points · 11 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download samuraigpt-generative-media-skills-library_social_youtube-shorts-74df8cb.zip · 4 KB
Part of samuraigpt/generative-media-skills — 72 skills

Install

skills CLI npx skills add https://github.com/SamurAIGPT/Generative-Media-Skills/tree/main/library/social/youtube-shorts
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install samuraigpt-generative-media-skills@llmmart
Git git clone https://github.com/SamurAIGPT/Generative-Media-Skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole samuraigpt/generative-media-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

YouTube Shorts Generator

Long video → ranked vertical short clips, tuned for short-form social.

This skill is a platform-aware preset over the AI Clipping primitive. It picks the right aspect ratio and clip count for the target platform and delegates highlight extraction, dedupe, and face-tracked auto-crop to muapi.ai's managed /ai-clipping endpoint.

Reference implementation: https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator Underlying API: https://muapi.ai/playground/ai-clipping


When to Use This vs. AI Clipping

Use this skill when… Use AI Clipping directly when…
Target is YouTube Shorts / TikTok / Reels You want full control over aspect / count
You want platform-tuned defaults You want raw timestamps (--coords-only)
You'd rather pass --platform tiktok than think about ratios You're integrating into a custom renderer

Agent Execution Protocol

Step 1 — Collect Inputs

Input Default Notes
--source — YouTube URL, hosted mp4 URL, or local file
--platform shorts shorts | tiktok | reels | feed (sets ratio + count defaults)
--num-clips platform default Override clip count
--aspect-ratio platform default Override aspect ratio

If the user gave only a URL, run with platform defaults — don't block.


Step 2 — Verify Prerequisites

  • muapi-cli installed and authed (muapi auth configure)
  • MUAPI_API_KEY available

That's it. Transcription, highlight ranking, dedupe, and cropping all run server-side — no ffmpeg, no Python, no Whisper, no LLM keys needed locally.


Step 3 — Run the Pipeline

bash library/social/youtube-shorts/scripts/run-youtube-shorts.sh \
  --source "<YOUTUBE_URL>" \
  --platform shorts \
  --num-clips 5 \
  --view

The script:

  1. Resolves the source (uploads local files to muapi CDN if needed).
  2. Picks platform defaults if --aspect-ratio / --num-clips aren't passed.
  3. Calls muapi edit clipping (the /ai-clipping endpoint) with the chosen params.
  4. Polls until done, prints a ranked summary, optionally downloads / opens clips.

What Happens Server-Side

The /ai-clipping endpoint runs the full pipeline:

  • Transcribes the audio.
  • Ranks highlights through a virality framework — hook moments, emotional peaks, opinion bombs, revelation moments, conflict, quotable lines, story peaks, practical value.
  • Dedupes overlapping candidates by score.
  • Top-N selects and face-tracks vertical crops.

Each clip ships with score (0–100), opening hook line, and a one-sentence "why it works" reason.


Platform Defaults

Platform Flag Aspect Default clips Notes
YouTube Shorts --platform shorts 9:16 3 Hook in first 1s
TikTok --platform tiktok 9:16 5 Higher energy, longer ok
Instagram Reels --platform reels 9:16 3 Hook in first 1s
Instagram Feed --platform feed 1:1 3 Static-feel works well

Override any default with --aspect-ratio / --num-clips.


Quick Invocation Patterns

Single video, defaults:

bash run-youtube-shorts.sh --source "https://youtube.com/watch?v=VIDEO_ID"

TikTok preset — 5 clips, view in player:

bash run-youtube-shorts.sh --source "<URL>" --platform tiktok --view

Square Instagram feed clips:

bash run-youtube-shorts.sh --source "<URL>" --platform feed --num-clips 3

Batch — urls.txt with one URL per line:

xargs -a urls.txt -I{} bash run-youtube-shorts.sh --source "{}"

Async submit (returns request_id, poll later):

REQUEST_ID=$(bash run-youtube-shorts.sh --source "<URL>" --async --output-json - | jq -r '.request_id')
muapi predict wait "$REQUEST_ID" --download ./outputs

Output Schema

{
  "source_video_url": "...",
  "shorts": [
    {
      "title": "The one mistake that cost me $50K",
      "start_time": 124.3,
      "end_time": 187.6,
      "score": 92,
      "hook_sentence": "Nobody talks about this, but it killed my first startup...",
      "virality_reason": "Opens with a number + regret, peaks on a contrarian lesson",
      "clip_url": "https://.../short_1.mp4"
    }
  ]
}

When reporting back, surface for each clip: rank, score, time range, title, hook, and clip URL.


Common Mistakes to Avoid

  1. Wrong aspect ratio for the platform — Shorts / TikTok / Reels are 9:16. The platform preset handles this; only override if you know why.
  2. Padding to hit --num-clips — if the API returns fewer survivors, return what you have. Don't ship low-score filler.
  3. Re-running on a 404'd clip URL — re-fetch the same request_id with muapi predict wait <id> rather than re-clipping.

Failure Modes

  • API key missing or rejected — surface the error; don't fabricate a key.
  • Job timed out — bump --poll-timeout and retry.
  • Source URL not reachable — upload the file via muapi upload file and pass the returned URL.
  • Fewer clips returned than requested — source had fewer rankable highlights. Return what came back with a note.

Done Criteria

The skill is done when:

  1. result.shorts has up to num_clips entries, each with a working clip_url.
  2. The user has been shown the ranked list (score, time range, title, hook, URL).
  3. If --output-json was set, the file exists and parses.
Files (generative-media-skills)
  • scripts
    • run-youtube-shorts.sh 4.9 KB
      #!/bin/bash
      # YouTube Shorts Generator — Platform-aware preset over the AI Clipping primitive.
      #
      # Picks platform-specific defaults (aspect ratio + clip count) for short-form
      # social and delegates to muapi.ai's /ai-clipping endpoint, which handles
      # transcription, highlight ranking, dedupe, and face-tracked auto-crop server-side.
      #
      # Usage:
      #   bash run-youtube-shorts.sh --source "<URL>" [options]
      #
      # Requires: bash 3.2+, jq, muapi-cli
      
      set -euo pipefail
      
      # ============================================================
      # Locate skills root
      # ============================================================
      SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
      SKILLS_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
      AI_CLIPPING_SCRIPT="$SKILLS_ROOT/library/edit/ai-clipping/scripts/run-ai-clipping.sh"
      
      if [ -f "$SKILLS_ROOT/.env" ]; then
          set +u; source "$SKILLS_ROOT/.env" 2>/dev/null || true; set -u
      fi
      
      # ============================================================
      # Defaults
      # ============================================================
      SOURCE=""
      PLATFORM="shorts"
      NUM_CLIPS=""
      ASPECT_RATIO=""
      OUTPUT_JSON=""
      VIEW=false
      ASYNC=false
      POLL_INTERVAL="${MUAPI_POLL_INTERVAL:-5}"
      POLL_TIMEOUT="${MUAPI_POLL_TIMEOUT:-1800}"
      
      # ============================================================
      # Argument parsing
      # ============================================================
      while [[ $# -gt 0 ]]; do
          case $1 in
              --source|-s)        SOURCE="$2";        shift 2 ;;
              --platform|-p)      PLATFORM="$2";      shift 2 ;;
              --num-clips|-n)     NUM_CLIPS="$2";     shift 2 ;;
              --aspect-ratio|-a)  ASPECT_RATIO="$2";  shift 2 ;;
              --output-json|-o)   OUTPUT_JSON="$2";   shift 2 ;;
              --view)             VIEW=true;          shift   ;;
              --async)            ASYNC=true;         shift   ;;
              --poll-interval)    POLL_INTERVAL="$2"; shift 2 ;;
              --poll-timeout)     POLL_TIMEOUT="$2";  shift 2 ;;
              --help|-h)
                  cat <<'HELP'
      YouTube Shorts Generator — platform-aware preset over AI Clipping
      Usage: bash run-youtube-shorts.sh --source "<URL>" [options]
      
      REQUIRED
        --source, -s URL          YouTube URL, hosted mp4 URL, or local file path
      
      PLATFORM PRESETS  (sets ratio + clip-count defaults)
        --platform shorts         9:16, 3 clips    (YouTube Shorts — default)
        --platform tiktok         9:16, 5 clips    (TikTok)
        --platform reels          9:16, 3 clips    (Instagram Reels)
        --platform feed           1:1,  3 clips    (Instagram Feed)
      
      OVERRIDES
        --num-clips, -n N         Override clip count
        --aspect-ratio, -a RATIO  Override ratio: 9:16 | 1:1 | 4:5
      
      OUTPUT
        --output-json, -o PATH    Dump full result here (use "-" for stdout)
        --view                    Download clips and open in system viewer (macOS)
        --async                   Return request_id immediately without polling
      
      POLLING
        --poll-interval SEC       Seconds between job-status polls (default: 5)
        --poll-timeout SEC        Give up after this long (default: 1800)
      
      EXAMPLES
        # Defaults — three 9:16 YouTube Shorts
        bash run-youtube-shorts.sh --source "https://youtube.com/watch?v=VIDEO_ID"
      
        # TikTok — 5 clips, view in player
        bash run-youtube-shorts.sh -s "<URL>" -p tiktok --view
      
        # Instagram Feed — square clips
        bash run-youtube-shorts.sh -s "<URL>" -p feed -n 3
      HELP
                  exit 0
                  ;;
              *)  echo "Unknown flag: $1" >&2; exit 2 ;;
          esac
      done
      
      # ============================================================
      # Validation
      # ============================================================
      if [[ -z "$SOURCE" ]]; then
          echo "ERROR: --source is required" >&2
          exit 2
      fi
      if [[ ! -f "$AI_CLIPPING_SCRIPT" ]]; then
          echo "ERROR: ai-clipping primitive not found at $AI_CLIPPING_SCRIPT" >&2
          exit 3
      fi
      
      # ============================================================
      # Platform preset → defaults
      # ============================================================
      case "$PLATFORM" in
          shorts)  PLATFORM_RATIO="9:16"; PLATFORM_NUM=3 ;;
          tiktok)  PLATFORM_RATIO="9:16"; PLATFORM_NUM=5 ;;
          reels)   PLATFORM_RATIO="9:16"; PLATFORM_NUM=3 ;;
          feed)    PLATFORM_RATIO="1:1";  PLATFORM_NUM=3 ;;
          *)
              echo "ERROR: --platform must be one of: shorts, tiktok, reels, feed (got: $PLATFORM)" >&2
              exit 2
              ;;
      esac
      
      [[ -z "$ASPECT_RATIO" ]] && ASPECT_RATIO="$PLATFORM_RATIO"
      [[ -z "$NUM_CLIPS"    ]] && NUM_CLIPS="$PLATFORM_NUM"
      
      # ============================================================
      # Delegate to AI Clipping primitive
      # ============================================================
      echo ">> Platform: $PLATFORM (ratio=$ASPECT_RATIO, num=$NUM_CLIPS)"
      
      ARGS=(
          --video "$SOURCE"
          --num-clips "$NUM_CLIPS"
          --aspect-ratio "$ASPECT_RATIO"
          --poll-interval "$POLL_INTERVAL"
          --poll-timeout "$POLL_TIMEOUT"
      )
      [[ -n "$OUTPUT_JSON" ]] && ARGS+=(--output-json "$OUTPUT_JSON")
      [[ "$VIEW"  == true  ]] && ARGS+=(--view)
      [[ "$ASYNC" == true  ]] && ARGS+=(--async)
      
      exec bash "$AI_CLIPPING_SCRIPT" "${ARGS[@]}"
      
  • SKILL.md 5.9 KB
    ---
    slug: muapi-youtube-shorts
    name: muapi-youtube-shorts
    version: "2.0.0"
    description: Auto-generate viral 9:16 YouTube Shorts (or TikTok / Reels clips) from a long-form video. Thin platform-aware wrapper around the AI Clipping skill — picks sensible defaults for short-form social platforms (9:16, 30–60s sweet spot) and delegates the actual highlight extraction + crop to muapi.ai's `/ai-clipping` endpoint.
    acceptLicenseTerms: true
    ---
    
    # YouTube Shorts Generator
    
    **Long video → ranked vertical short clips, tuned for short-form social.**
    
    This skill is a platform-aware preset over the [AI Clipping](../../edit/ai-clipping/) primitive. It picks the right aspect ratio and clip count for the target platform and delegates highlight extraction, dedupe, and face-tracked auto-crop to muapi.ai's managed `/ai-clipping` endpoint.
    
    Reference implementation: https://github.com/SamurAIGPT/AI-Youtube-Shorts-Generator
    Underlying API: https://muapi.ai/playground/ai-clipping
    
    ---
    
    ## When to Use This vs. AI Clipping
    
    | Use this skill when… | Use [AI Clipping](../../edit/ai-clipping/) directly when… |
    |:---|:---|
    | Target is YouTube Shorts / TikTok / Reels | You want full control over aspect / count |
    | You want platform-tuned defaults | You want raw timestamps (`--coords-only`) |
    | You'd rather pass `--platform tiktok` than think about ratios | You're integrating into a custom renderer |
    
    ---
    
    ## Agent Execution Protocol
    
    ### Step 1 — Collect Inputs
    
    | Input | Default | Notes |
    |:---|:---|:---|
    | `--source` | — | YouTube URL, hosted mp4 URL, or local file |
    | `--platform` | `shorts` | `shorts` \| `tiktok` \| `reels` \| `feed` (sets ratio + count defaults) |
    | `--num-clips` | platform default | Override clip count |
    | `--aspect-ratio` | platform default | Override aspect ratio |
    
    If the user gave only a URL, run with platform defaults — don't block.
    
    ---
    
    ### Step 2 — Verify Prerequisites
    
    - `muapi-cli` installed and authed (`muapi auth configure`)
    - `MUAPI_API_KEY` available
    
    That's it. Transcription, highlight ranking, dedupe, and cropping all run server-side — no `ffmpeg`, no Python, no Whisper, no LLM keys needed locally.
    
    ---
    
    ### Step 3 — Run the Pipeline
    
    ```bash
    bash library/social/youtube-shorts/scripts/run-youtube-shorts.sh \
      --source "<YOUTUBE_URL>" \
      --platform shorts \
      --num-clips 5 \
      --view
    ```
    
    The script:
    1. Resolves the source (uploads local files to muapi CDN if needed).
    2. Picks platform defaults if `--aspect-ratio` / `--num-clips` aren't passed.
    3. Calls `muapi edit clipping` (the `/ai-clipping` endpoint) with the chosen params.
    4. Polls until done, prints a ranked summary, optionally downloads / opens clips.
    
    ---
    
    ## What Happens Server-Side
    
    The `/ai-clipping` endpoint runs the full pipeline:
    
    - **Transcribes** the audio.
    - **Ranks highlights** through a virality framework — hook moments, emotional peaks, opinion bombs, revelation moments, conflict, quotable lines, story peaks, practical value.
    - **Dedupes** overlapping candidates by score.
    - **Top-N selects** and **face-tracks** vertical crops.
    
    Each clip ships with score (0–100), opening hook line, and a one-sentence "why it works" reason.
    
    ---
    
    ## Platform Defaults
    
    | Platform | Flag | Aspect | Default clips | Notes |
    |:---|:---|:---|:---|:---|
    | YouTube Shorts | `--platform shorts` | `9:16` | 3 | Hook in first 1s |
    | TikTok | `--platform tiktok` | `9:16` | 5 | Higher energy, longer ok |
    | Instagram Reels | `--platform reels` | `9:16` | 3 | Hook in first 1s |
    | Instagram Feed | `--platform feed` | `1:1` | 3 | Static-feel works well |
    
    Override any default with `--aspect-ratio` / `--num-clips`.
    
    ---
    
    ## Quick Invocation Patterns
    
    **Single video, defaults:**
    ```bash
    bash run-youtube-shorts.sh --source "https://youtube.com/watch?v=VIDEO_ID"
    ```
    
    **TikTok preset — 5 clips, view in player:**
    ```bash
    bash run-youtube-shorts.sh --source "<URL>" --platform tiktok --view
    ```
    
    **Square Instagram feed clips:**
    ```bash
    bash run-youtube-shorts.sh --source "<URL>" --platform feed --num-clips 3
    ```
    
    **Batch — `urls.txt` with one URL per line:**
    ```bash
    xargs -a urls.txt -I{} bash run-youtube-shorts.sh --source "{}"
    ```
    
    **Async submit (returns request_id, poll later):**
    ```bash
    REQUEST_ID=$(bash run-youtube-shorts.sh --source "<URL>" --async --output-json - | jq -r '.request_id')
    muapi predict wait "$REQUEST_ID" --download ./outputs
    ```
    
    ---
    
    ## Output Schema
    
    ```json
    {
      "source_video_url": "...",
      "shorts": [
        {
          "title": "The one mistake that cost me $50K",
          "start_time": 124.3,
          "end_time": 187.6,
          "score": 92,
          "hook_sentence": "Nobody talks about this, but it killed my first startup...",
          "virality_reason": "Opens with a number + regret, peaks on a contrarian lesson",
          "clip_url": "https://.../short_1.mp4"
        }
      ]
    }
    ```
    
    When reporting back, surface for each clip: rank, score, time range, title, hook, and clip URL.
    
    ---
    
    ## Common Mistakes to Avoid
    
    1. **Wrong aspect ratio for the platform** — Shorts / TikTok / Reels are `9:16`. The platform preset handles this; only override if you know why.
    2. **Padding to hit `--num-clips`** — if the API returns fewer survivors, return what you have. Don't ship low-score filler.
    3. **Re-running on a 404'd clip URL** — re-fetch the same `request_id` with `muapi predict wait <id>` rather than re-clipping.
    
    ---
    
    ## Failure Modes
    
    - **API key missing or rejected** — surface the error; don't fabricate a key.
    - **Job timed out** — bump `--poll-timeout` and retry.
    - **Source URL not reachable** — upload the file via `muapi upload file` and pass the returned URL.
    - **Fewer clips returned than requested** — source had fewer rankable highlights. Return what came back with a note.
    
    ---
    
    ## Done Criteria
    
    The skill is done when:
    1. `result.shorts` has up to `num_clips` entries, each with a working `clip_url`.
    2. The user has been shown the ranked list (score, time range, title, hook, URL).
    3. If `--output-json` was set, the file exists and parses.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related