/media-os:ffmpeg-capture [source] [output]from media-os
Records screen, webcam, microphone, and system audio using ffmpeg. Lists available devices and supports platform-specific capture methods (avfoundation, gdigrab, v4l2, etc.).
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
webcam subcommand--crop (mac/linux) or -offset_x/-offset_y/-video_size (Windows gdigrab)python3 scripts/capture.py list-devicesDo NOT use for: streaming to RTMP/HLS (use ffmpeg-streaming), applying filters/effects (use ffmpeg-video-filter), or converting an existing file (use ffmpeg-transcode).
Always list devices first. Names and indices are shown in the format ffmpeg expects them.
macOS (avfoundation):
ffmpeg -f avfoundation -list_devices true -i ""
Output has two sections: AVFoundation video devices: (cameras + screens, screen is usually the last one with Capture screen 0) and AVFoundation audio devices:. Indices reset between the two lists — video 1 and audio 0 are unrelated.
Windows (dshow for camera/mic, gdigrab for desktop):
ffmpeg -list_devices true -f dshow -i dummy
ffmpeg -list_options true -f dshow -i video="HD Webcam"
gdigrab needs no enumeration — input name is always desktop (or title=Window Name).
Linux:
# Cameras
v4l2-ctl --list-devices
ffmpeg -f v4l2 -list_formats all -i /dev/video0
# Audio (Pulse)
pactl list sources short
# Audio (ALSA)
arecord -L
# Display (X11)
echo "$DISPLAY" # usually :0.0 or :1.0
Or run the helper: python3 scripts/capture.py list-devices (auto-detects platform).
Decide:
libx264 -preset ultrafast -pix_fmt yuv420p for CPU; platform HW encoder for 60fps+ (see references/devices.md).System audio notes:
-i ":<blackhole_index>". To hear it too, build a Multi-Output Device in Audio MIDI Setup.-f dshow -i audio="Stereo Mix" (if enabled) or VB-Cable.pactl list sources short shows a *.monitor source for each sink — that's system audio.ffmpeg -f avfoundation -framerate 30 -capture_cursor 1 -i "1:0" \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac -b:a 160k out.mp4
"1:0" = video device index 1 (screen), audio device index 0 (default mic). Replace with your actual indices from Step 1.
ffmpeg -f avfoundation -framerate 60 -capture_cursor 1 -i "1" \
-c:v h264_videotoolbox -b:v 8M -pix_fmt yuv420p out.mp4
ffmpeg -f avfoundation -framerate 30 -i "1" \
-vf "crop=1280:720:100:100" -c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
avfoundation has no native region mode; always full-screen then crop via -vf crop=W:H:X:Y.
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i "0:0" \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac out.mp4
Assume BlackHole is audio index 2, mic is index 0:
ffmpeg -f avfoundation -framerate 30 -capture_cursor 1 -i "1:0" \
-f avfoundation -i ":2" \
-filter_complex "[0:a][1:a]amix=inputs=2:duration=longest[a]" \
-map 0:v -map "[a]" -c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac out.mp4
ffmpeg -f gdigrab -framerate 30 -i desktop \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
ffmpeg -f gdigrab -framerate 30 -offset_x 100 -offset_y 100 \
-video_size 1280x720 -i desktop -c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
ffmpeg -f gdigrab -framerate 30 -i title="Mozilla Firefox" -c:v libx264 out.mp4
ffmpeg -f dshow -framerate 30 -video_size 1280x720 \
-i video="HD Pro Webcam C920":audio="Microphone (Realtek)" \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac out.mp4
ffmpeg -f x11grab -framerate 30 -video_size 1920x1080 -i :0.0 \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
ffmpeg -f x11grab -framerate 30 -video_size 1280x720 -i :0.0+100,100 out.mp4
ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 \
-i /dev/video0 -c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
ffmpeg -f pulse -i default out.wav # Pulse default mic
ffmpeg -f pulse -i alsa_output.monitor out.wav # system audio (monitor)
ffmpeg -f alsa -i hw:0 out.wav
sudo ffmpeg -device /dev/dri/card0 -f kmsgrab -i - \
-vf 'hwdownload,format=bgr0' -c:v libx264 -preset ultrafast -pix_fmt yuv420p out.mp4
Requires root or sudo setcap cap_sys_admin+ep $(which ffmpeg).
q in the ffmpeg terminal. ffmpeg flushes the mux and finalizes the MOOV atom for MP4.ffmpeg -i recording.mkv -c copy recording.mp4.-t 60 (stop after 60s) rather than killing the process.-f segment -segment_time 600 -reset_timestamps 1 out_%03d.mkv so crashes cost at most one segment.scripts/capture.py — cross-platform wrapper: list-devices, screen, webcam, audio-only. Auto-detects the platform and builds the right ffmpeg command. --dry-run prints the command without running it.# 1. What devices exist?
python3 ${CLAUDE_SKILL_DIR}/scripts/capture.py list-devices
# 2. Dry-run to confirm the command
python3 ${CLAUDE_SKILL_DIR}/scripts/capture.py screen --output out.mp4 --fps 30 --dry-run
# 3. Record
python3 ${CLAUDE_SKILL_DIR}/scripts/capture.py screen --output out.mp4 --fps 30 --audio auto
references/devices.md for the full per-platform option tables (avfoundation, gdigrab, dshow, x11grab, kmsgrab, v4l2, alsa, pulse, decklink), virtual-audio devices, TCC/permission reset, crash-safe recording, and bitrate/FPS recommendations.EAGAIN capture — grant permission to the parent terminal/IDE (Terminal.app, iTerm, VS Code) and re-run. Permission is per-binary-path: reinstalling ffmpeg to a new location re-prompts."1:0" means "video device 1, audio device 0" exactly as listed by -list_devices true. Video and audio lists are numbered independently.-f avfoundation -i ":N" input, then -filter_complex amix or -map to combine.video="HD Webcam" (curly-quote will break). Audio and video are separate arguments in the same -i: video="X":audio="Y".-pix_fmt yuv420p is required for libx264 output that plays in QuickTime/Safari/iOS. Leave it off and you get yuv444p, which many players refuse.h264_videotoolbox (mac), h264_nvenc (NVIDIA), h264_qsv (Intel), h264_amf (AMD) — see ffmpeg-hwaccel.-draw_mouse 1 (default on). Some builds ignore it; cursor overlay is unreliable in virtual display setups (RDP).:0.0 must match the running $DISPLAY. On multi-monitor X, use :0.0+X,Y to pick the origin.-input_format mjpeg is required for most UVC webcams at 720p/1080p 30fps. Raw YUYV falls back to 5–10fps at full res.setcap cap_sys_admin+ep. Outputs DRM prime frames — always chain hwdownload,format=bgr0 before encoding on CPU.pactl list sources short each session.q in terminal = clean shutdown. Ctrl+C on MP4 = corrupted file. Record MKV for anything over a minute, remux after.-async 1 or record audio to a separate file and mux after.# List devices
ffmpeg -f avfoundation -list_devices true -i ""
# → video index 1 = "Capture screen 0", audio index 0 = "MacBook Pro Microphone"
ffmpeg -f avfoundation -framerate 30 -capture_cursor 1 -i "1:0" \
-t 30 -c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac demo.mp4
ffmpeg -f gdigrab -framerate 30 -i desktop \
-f dshow -i audio="Microphone (USB Audio)" \
-c:v libx264 -preset veryfast -crf 23 -pix_fmt yuv420p -c:a aac \
-f segment -segment_time 600 -reset_timestamps 1 tutorial_%03d.mkv
# Press q to stop. Then remux:
ffmpeg -f concat -safe 0 -i <(for f in tutorial_*.mkv; do echo "file '$PWD/$f'"; done) -c copy tutorial.mp4
ffmpeg -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 30 -i /dev/video0 \
-f pulse -i default \
-c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac call.mp4
Input/output error or zero bytes (macOS)Cause: Screen Recording permission not granted to the parent terminal.
Solution: System Settings → Privacy & Security → Screen Recording → enable Terminal/iTerm/VS Code. Fully quit and relaunch the terminal (not just re-run). If still failing, reset TCC: tccutil reset ScreenCapture.
Could not find video device with name [...] (Windows dshow)Cause: Device name mismatch (case, trailing spaces, truncated).
Solution: Run ffmpeg -list_devices true -f dshow -i dummy and copy the name verbatim, including spaces. Wrap in double quotes.
x11grab ... BadMatch or black frameCause: $DISPLAY doesn't match, or running over SSH without -Y.
Solution: export DISPLAY=:0.0 locally, or use ssh -Y and target the remote display.
kmsgrab: Permission deniedCause: kmsgrab requires CAP_SYS_ADMIN.
Solution: sudo ffmpeg ... or sudo setcap cap_sys_admin+ep $(which ffmpeg).
Cause: ffmpeg was killed with SIGKILL / Ctrl+C mid-recording; MOOV never written.
Solution: Always press q to stop. For future recordings use MKV, then ffmpeg -i in.mkv -c copy out.mp4. Try recovery: untrunc or ffmpeg -err_detect ignore_err -i broken.mp4 -c copy fixed.mp4.
Cause: v4l2 defaulted to raw YUYV; USB 2.0 bandwidth cap.
Solution: Add -input_format mjpeg before -i /dev/video0.
Cause: Clock drift between capture devices.
Solution: Add -use_wallclock_as_timestamps 1 on each input, or record audio separately and mux after with -itsoffset to align.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub damionrashford/media-os --plugin media-os110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
/audio-pipewireRoute and introspect Linux audio/video/MIDI graphs with PipeWire: pw-cli (interactive object/module control), pw-dump (full graph JSON with --monitor), pw-link (list/create/destroy port links), pw-cat / pw-play / pw-record (playback+record), pw-top (real-time DSP load + xrun viewer), pw-metadata (shared metadata store), pw-loopback (source/sink bridges), pw-midiplay/pw-midirecord, pw-jack (JACK client compat shim), pw-mon, pw-profiler. WirePlumber session manager handles routing/defaults/profiles. Replaces PulseAudio (via pipewire-pulse) and JACK (via libjack.so shim) simultaneously. Use when the user asks to route Linux audio, link two apps, list audio devices on Linux, create a loopback, record system audio, monitor the audio graph, or set up a virtual audio device on modern Linux.
/audio-wasapiManipulate Windows audio via WASAPI (learn.microsoft.com/coreaudio): SoundVolumeView + svcl.exe (NirSoft — set default device, per-app volumes, save/load profiles), AudioDeviceCmdlets PowerShell module (Get-AudioDevice, Set-AudioDevice, Get-AudioDevicePlaybackMute), nircmd setdefaultsounddevice. Shared mode (Windows engine resamples all streams to endpoint fixed format) vs Exclusive mode (bit-perfect, audiophile, ~sub-3ms latency with IAudioClient3 + event-driven callbacks). WASAPI then MMDevice then Audio Engine (audiodg.exe) then WDM/KS. ASIO is Steinberg's parallel stack bypassing Windows audio. Virtual audio devices: VB-Audio Virtual Cable, VoiceMeeter/Banana/Potato. Use when the user asks to change Windows default audio device, route app audio, use VoiceMeeter, install VB-Cable, set a specific device from PowerShell, or enable exclusive-mode low-latency output.
/cv-mediapipeGoogle MediaPipe Tasks API (current supported, NOT legacy mediapipe.solutions): Vision Tasks (Face Detector, Face Landmarker, Face Stylizer, Hand Landmarker, Gesture Recognizer, Pose Landmarker, Holistic Landmarker, Object Detector, Image Classifier, Image Segmenter, Interactive Segmenter, Image Embedder, Image Generator), Audio Tasks (Audio Classifier), Text Tasks (Text Classifier, Text Embedder, Language Detector), GenAI Tasks (LLM Inference — on-device Gemma/Phi-2/Falcon/StableLM). Three run modes: IMAGE, VIDEO, LIVE_STREAM (async). Python: mediapipe.tasks.python.vision/audio/text/genai. Docs at ai.google.dev/edge/mediapipe/solutions. Model Maker for transfer learning. Use when the user asks to detect pose/face/hand landmarks, classify an image, run a body-pose model, segment people, recognize gestures, do on-device LLM inference via MediaPipe, or build a mobile/embedded CV pipeline.
/cv-opencvComputer vision on images + video with OpenCV (docs.opencv.org/4.x/): core (Mat / ndarray, linalg), imgproc (filtering, morphology, geometric transforms, color conv, histograms, contours), imgcodecs (imread/imwrite — PNG, JPEG, TIFF, WebP, EXR), videoio (VideoCapture / VideoWriter — FFMPEG, GStreamer, V4L2, AVFoundation, MSMF backends), calib3d (camera calibration, stereo, solvePnP, homography), features2d (ORB, AKAZE, BRISK, KAZE, SIFT), objdetect (FaceDetectorYN, FaceRecognizerSF, HOG, ArUco, QRCode), dnn (ONNX/TF/Caffe/Darknet, CUDA + OpenVINO + Vulkan backends, model zoo at github.com/opencv/opencv_zoo), photo (inpainting, denoising, HDR Debevec/Robertson), stitching (panorama), video (optical flow Farneback/LK/DIS, BackgroundSubtractorMOG2/KNN, tracking KCF/CSRT/MIL/Nano/Vit/DaSiamRPN). Python-first via cv2. Use when the user asks to detect faces, track objects, run YOLO inference, capture + process webcam frames, calibrate a camera, stitch a panorama, or use OpenCV from Python/C++.
Other plugins' skills for the same job