Skip to content
Back to skills

Video Add Music

ASecurity

Mux a song under a video with ffmpeg, keeping its chapters and copying the picture. Use when adding music or a soundtrack to an MP4 without re-encoding video.

  • 60 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 9, 2026
ai-agentsbash

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 25, 2026

npx -y skills add laurigates/claude-plugins --skill video-add-music --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Video Add Music?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Video Add Music
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/laurigates-video-add-music/badge)](https://www.skillsdirectory.com/skills/laurigates-video-add-music)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: video-add-music
description: Mux a song under a video with ffmpeg, keeping its chapters and copying the picture. Use when adding music or a soundtrack to an MP4 without re-encoding video.
allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/add-music.sh *), Bash(ffmpeg *), Bash(ffprobe *), Bash(wc *), Read
created: 2026-10-29
modified: 2026-11-14
reviewed: 2026-10-29
---

# Add Music Under a Video

Put a song under a video: the video stream is copied, the song encoded as AAC,
and the video's chapters kept. The script runs the mux and then checks the
result, because the obvious command produces a file that plays fine and is
still wrong.

## When to Use This Skill

| Use this skill when... | Use something else when... |
|---|---|
| A finished video needs a song under it and its chapters must survive | Lyrics should be burned in as well — `video-karaoke` muxes the song itself |
| Previewing a beat glow with the song | Rendering the glow itself — `video-beat-glow` (`--with-song`) |

## Execution

```bash
"${CLAUDE_SKILL_DIR}/scripts/add-music.sh" video.mp4 song.m4a out.mp4
```

It runs, then verifies:

```bash
ffmpeg -i video.mp4 -i song.m4a -map 0:v -map 1:a -c copy -c:a aac -b:a 192k -map_chapters 0 -movflags +faststart out.mp4
```

| Option | Effect |
|---|---|
| `--bitrate 192k` | AAC bitrate |
| `--shortest` | Cut the output at the shorter of song and video |

Output is `KEY=VALUE` lines (`STREAMS`, `CHAPTERS_IN`, `CHAPTERS_OUT`,
`VIDEO_S`, `SONG_S`, `OUT_S`) and `STATUS=OK|WARN|ERROR` with a `REASON`.

## The `-map 0` Trap

`-map 0` instead of `-map 0:v` copies the input's chapter **text track**, and
the mp4 muxer also writes a new one from `-map_chapters`. The output then has
two `bin_data` streams (observed: `av1 video, bin_data data, aac audio, bin_data
data`). The script fails on more than one data stream, and on a chapter count
that differs from the input's. To check a file by hand:

```bash
ffprobe -v error -show_entries stream=codec_type,codec_name -of csv=p=0 out.mp4
ffprobe -v error -show_chapters -of csv=p=0 out.mp4 | wc -l
```

The input video's own audio track is dropped.

## Length Mismatch

A song shorter than the video leaves a silent tail; a longer one runs past the
last frame. Either way the script reports `STATUS=WARN` with the gap and does
not pad. Tell the user and let them choose to trim the video, use `--shortest`,
or leave it. Real case: a 231.44 s song under a 234 s video left a 2.56 s silent
tail.

Files in this skill

  • SKILL.md2.3 KB
  • scripts/add-music.sh3.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.