Skip to content

Slash command

Media tools

Real ffmpeg commands for the jobs you actually hit: a screen recording that is too big to send, a clip that needs to be a GIF, audio pulled out of a video.

About

Real ffmpeg commands for the jobs you actually hit: a screen recording that is too big to send, a clip that needs to be a GIF, audio pulled out of a video.

Files in v1.0.0

  • replicamd.plugin.json4515 B
  • skills/shipping-media.md2202 B

Contributes

{
  "commands": [
    {
      "id": "shrink-video",
      "title": "Compress videos here for sharing",
      "run": "command -v ffmpeg >/dev/null 2>&1 || { echo 'ffmpeg is not installed. Arch: sudo pacman -S ffmpeg · macOS: brew install ffmpeg'; exit 1; }; mkdir -p compressed; n=0; skipped=0; saved=0; for f in *.mp4 *.MP4 *.mov *.MOV *.mkv *.webm; do [ -e \"$f\" ] || continue; out=\"compressed/${f%.*}.mp4\"; before=$(wc -c <\"$f\"); ffmpeg -nostdin -loglevel error -y -i \"$f\" -vcodec libx264 -crf 28 -preset veryfast -vf \"scale='min(1920,iw)':-2\" -acodec aac -b:a 128k \"$out\" || continue; after=$(wc -c <\"$out\"); if [ \"$after\" -lt \"$before\" ]; then echo \"$f  $before -> $after bytes\"; saved=$((saved + before - after)); n=$((n+1)); else rm -f \"$out\"; echo \"$f  already well encoded ($before bytes), left alone\"; skipped=$((skipped+1)); fi; done; rmdir compressed 2>/dev/null; [ \"$n\" -eq 0 ] && [ \"$skipped\" -eq 0 ] && echo 'No video files here.' || echo \"Compressed $n file(s) into ./compressed, saved $saved bytes; $skipped were already smaller than a re-encode. Originals untouched.\""
    },
    {
      "id": "to-gif",
      "title": "Turn a video into a good GIF (two-pass palette)",
      "run": "command -v ffmpeg >/dev/null 2>&1 || { echo 'ffmpeg is not installed.'; exit 1; }; src=$(ls -1t *.mp4 *.MP4 *.mov *.MOV *.webm *.mkv 2>/dev/null | head -1); [ -n \"$src\" ] || { echo 'No video here.'; exit 1; }; out=\"${src%.*}.gif\"; ffmpeg -nostdin -loglevel error -y -i \"$src\" -vf 'fps=15,scale=800:-1:flags=lanczos,palettegen=stats_mode=diff' -f image2 -update 1 /tmp/rmd-palette.png && ffmpeg -nostdin -loglevel error -y -i \"$src\" -i /tmp/rmd-palette.png -lavfi 'fps=15,scale=800:-1:flags=lanczos[v];[v][1:v]paletteuse=dither=bayer:bayer_scale=3' \"$out\" && echo \"$src -> $out ($(wc -c <\"$out\") bytes). A generated palette beats ffmpeg's default by a long way.\"; rm -f /tmp/rmd-palette.png"
    },
    {
      "id": "extract-audio",
      "title": "Pull the audio out of every video here",
      "run": "command -v ffmpeg >/dev/null 2>&1 || { echo 'ffmpeg is not installed.'; exit 1; }; n=0; for f in *.mp4 *.MP4 *.mov *.MOV *.mkv *.webm; do [ -e \"$f\" ] || continue; out=\"${f%.*}.m4a\"; [ -e \"$out\" ] && { echo \"skip $f (audio exists)\"; continue; }; ffmpeg -nostdin -loglevel error -y -i \"$f\" -vn -acodec copy \"$out\" 2>/dev/null || ffmpeg -nostdin -loglevel error -y -i \"$f\" -vn -acodec aac -b:a 192k \"$out\" || continue; echo \"$f -> $out\"; n=$((n+1)); done; [ \"$n\" -eq 0 ] && echo 'No video files here.' || echo \"Extracted audio from $n file(s). Copied the stream where possible, re-encoded only where it was not.\""
    },
    {
      "id": "thumbnail",
      "title": "Grab a poster frame from each video",
      "run": "command -v ffmpeg >/dev/null 2>&1 || { echo 'ffmpeg is not installed.'; exit 1; }; n=0; for f in *.mp4 *.MP4 *.mov *.MOV *.mkv *.webm; do [ -e \"$f\" ] || continue; out=\"${f%.*}-poster.jpg\"; ffmpeg -nostdin -loglevel error -y -ss 00:00:01 -i \"$f\" -frames:v 1 -q:v 3 \"$out\" && { echo \"$out\"; n=$((n+1)); }; done; [ \"$n\" -eq 0 ] && echo 'No video files here.' || echo \"Wrote $n poster frame(s), taken one second in so you do not get a black frame.\""
    },
    {
      "id": "inspect",
      "title": "Report on the media files here",
      "prompt": "Run `ffprobe -v error -show_entries format=duration,size,bit_rate:stream=codec_name,codec_type,width,height,r_frame_rate -of default=noprint_wrappers=1 <file>` for each video and audio file in this folder.\n\nThen tell me which ones are a problem and why - a bitrate far above what the resolution needs, a codec that will not play in a browser (anything not H.264/VP9/AV1 video with AAC/Opus audio), a resolution above what it will ever be displayed at, an animated GIF that should be a video. Give the exact ffmpeg command that fixes each one, and say roughly what it will save. If they are all fine, say so."
    }
  ],
  "skills": [
    "skills/shipping-media.md"
  ]
}

Versions

  • v1.0.07/26/2026 · 2 files

Install

Install in ReplicaMD

Nothing happened? ReplicaMD may not be installed yet - or open it first, then Settings → Plugins and install by id.

Plugin id:

media-tools

Bundle endpoint:

https://replicamd.nl/api/registry/plugins/media-tools/download
Author
Ardjun Debi - Tewarie @ardjun
Latest
v1.0.0
License
MIT
Installs
0
mediavideoffmpegconvertshell