assemble-media
БесплатноБез исполняемых скриптовНе проверенUse to join, trim, mix, subtitle or inspect generated media, make frames and masks for the next generation, or make a simple video from pictures, text or a…
от mudler★ 50 644 звезды на GitHubОб этом скилле
Assemble generated media
Generate the pieces with the LocalAI tools, then rework them with the shell tools of the media sandbox: ffmpeg, ffprobe, sox, magick and Python with Pillow. There is no network. Work in the folder where the pieces are.
Find the files
A generation tool returns a ref, a path such as /workspace/home/generated/clip-1a2b3c4d.mp4. Use that exact path; do not guess names. List what exists with ls -lt /workspace/home/generated | head. Write results next to the inputs, with new names (never overwrite a piece), then give the user the output path. A file in that folder can be passed to a tool as an argument (start_image, image, mask, audio).
Loop
- Generate one piece. Do not generate all pieces before checking the first.
- Inspect it:
ffprobefor the facts, one frame grab for the picture (below). Look at the PNG. - If it is wrong (size, length, no audio, bad frame), say so and fix the prompt or the command. Do not retry in a cycle.
- Assemble with the recipes below, then inspect the result the same way.
Inspect
cd /workspace/home/generated
ffprobe -v error -show_entries format=duration:stream=index,codec_type,codec_name,width,height,r_frame_rate,sample_rate,channels -of default=nw=1 a.mp4
ffmpeg -y -v error -ss 1 -i a.mp4 -frames:v 1 a-frame.png
ffmpeg -hide_banner -nostats -i voice.wav -af volumedetect -f null - 2>&1 | grep -E 'mean_volume|max_volume'
Look at a frame PNG with the file tools, or describe it with describe_image.
Join clips
Same codec, size and frame rate (clips of one model and settings), no re-encode:
printf "file '%s'\n" a.mp4 a.mp4 > list.txt
ffmpeg -y -v error -f concat -safe 0 -i list.txt -c copy joined.mp4
Different size, frame rate, codec, or some clips without audio: write this script once, then run sh /tmp/vconcat.sh out.mp4 1280 720 24 a.mp4 b.mp4. It scales each clip to fit with black bars, adds silence to clips with no audio, and joins them.
cat > /tmp/vconcat.sh <<'EOF2'
#!/bin/sh
# usage: vconcat.sh out.mp4 WIDTH HEIGHT FPS clip...
set -e
out=$1; w=$2; h=$3; fps=$4; shift 4
vf="scale=$w:$h:force_original_aspect_ratio=decrease,pad=$w:$h:(ow-iw)/2:(oh-ih)/2,setsar=1,fps=$fps,format=yuv420p"
enc="-c:v libx264 -preset veryfast -crf 20 -c:a aac -ar 48000 -ac 2"
dir=$(mktemp -d); : > "$dir/list.txt"; i=0
for f in "$@"; do
i=$((i+1)); n="$dir/$i.mp4"
if [ -n "$(ffprobe -v error -select_streams a -show_entries stream=index -of csv=p=0 "$f")" ]; then
ffmpeg -y -v error -i "$f" -vf "$vf" $enc "$n"
else
ffmpeg -y -v error -i "$f" -f lavfi -i anullsrc=r=48000:cl=stereo -map 0:v -map 1:a -shortest -vf "$vf" $enc "$n"
fi
echo "file '$n'" >> "$dir/list.txt"
done
ffmpeg -y -v error -f concat -safe 0 -i "$dir/list.txt" -c copy "$out"
rm -rf "$dir"
EOF2
sh /tmp/vconcat.sh joined2.mp4 1280 720 24 a.mp4 b.mp4
Audio track
# replace or add the audio of a video; the result ends with the shorter input
ffmpeg -y -v error -i a.mp4 -i music.wav -map 0:v -map 1:a -c:v copy -c:a aac -shortest withaudio.mp4
# audio shorter than the video: pad it with silence to the video length
ffmpeg -y -v error -i a.mp4 -i voice.wav -map 0:v -map 1:a -c:v copy -c:a aac -af apad -shortest withvoice.mp4
Voice over music: the music ducks under the voice. To start the voice later, write [1:a]adelay=1500|1500,apad,... (milliseconds). apad keeps the music playing after the voice ends.
ffmpeg -y -v error -i music.wav -i voice.wav -filter_complex \
"[1:a]apad,asplit=2[v][sc];[0:a][sc]sidechaincompress=threshold=0.03:ratio=8:attack=20:release=400[d];[d][v]amix=inputs=2:duration=first:normalize=0[a]" \
-map "[a]" mix-raw.wav
Normalise loudness to -16 LUFS in two passes. A single loudnorm pass levels quiet parts up and undoes the ducking. Save this script once, then run sh /tmp/lnorm.sh mix-raw.wav mix.wav:
cat > /tmp/lnorm.sh <<'EOF2'
#!/bin/sh
# usage: lnorm.sh in out (audio or video with audio in; wav out)
set -e
t="I=-16:TP=-1.5:LRA=11"
m=$(ffmpeg -hide_banner -nostats -i "$1" -af "loudnorm=$t:print_format=json" -f null - 2>&1)
g() { echo "$m" | grep "\"$1\"" | sed 's/.*: "\(.*\)".*/\1/'; }
ffmpeg -y -v error -i "$1" -af "loudnorm=$t:measured_I=$(g input_i):measured_TP=$(g input_tp):measured_LRA=$(g input_lra):measured_thresh=$(g input_thresh):offset=$(g target_offset):linear=true" -ar 44100 "$2"
EOF2
sh /tmp/lnorm.sh mix-raw.wav mix.wav
Put the mix on a video with the first command of this section. sox is shorter for plain audio work:
sox voice.wav music.wav both.wav # one after the other
sox voice.wav fast.wav tempo 1.25 # faster, same pitch
sox voice.wav quiet.wav norm -3 # peak at -3 dB
Convert: ffmpeg -y -v error -i voice.wav -c:a libmp3lame -q:a 2 voice.mp3, or -c:a libopus voice.opus, or -ar 16000 -ac 1 voice16k.wav for speech models.
Trim, fade, speed
# seconds 1 to 4, with 0.5 s fades in and o
Установить assemble-media в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл assemble-media?
Use to join, trim, mix, subtitle or inspect generated media, make frames and masks for the next generation, or make a simple video from pictures, text or a chart, with ffmpeg, sox, ImageMagick or Pillow.
Как установить скилл assemble-media?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл assemble-media запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic