local-video-tools

Public

Inspect, trim, convert, and manage FFmpeg video jobs locally from LM Studio.

459 Downloads

5 stars

2 forks

README

🎬 Local Video Tools for LM Studio

Reliable video processing for your local AI.

Inspect, trim, convert, and manage long-running FFmpeg jobs directly from LM Studio — locally, with hardware acceleration, and without holding one AI tool call open for the duration of a video encode.

Release
CI
License
LM Studio
FFmpeg

Add to LM Studio

Try the prompts · Install · How it works · Latest release · Roadmap

v0.1.3 Early Preview is out. This presentation-focused release adds a clearer plugin icon, direct LM Studio Hub installation guidance, and sharper positioning around reliable background video processing. Runtime behavior is unchanged from v0.1.2.

What this is: a reliable local execution layer for concrete video operations. The model decides what operation to request; FFmpeg does the actual media processing locally.


💬 Try these prompts

Attach a video in LM Studio and talk to it naturally:

What you wantAsk your local model
🎥 Inspect a videoInspect this video and tell me its codec, resolution, duration and frame rate.
✂️ Cut without quality lossCut seconds 2 through 10 from this video without changing quality. Use the fastest lossless method available.
🎯 Make an exact cutCreate an accurate clip from exactly 2.0 seconds to 10.0 seconds.
⚡ Convert with hardware accelerationConvert this video to a 1920px-wide H.264 MP4 using hardware acceleration if available.
📈 Check a long-running encodeCheck the status of that video conversion.
🛑 Cancel a jobCancel that video conversion.

No FFmpeg command memorization. No separate MCP configuration. The model chooses the right native tool and FFmpeg does the work locally.


🚀 What it can do

  • 🎬 Inspect video — codec, resolution, duration, frame rate, bitrate, audio metadata, and encoder capabilities.
  • ✂️ Fast lossless trimming — stream copy with -c copy when re-encoding is unnecessary.
  • 🎯 Accurate clipping — precise boundaries using background re-encoding.
  • 🔄 Convert & resize — H.264 or HEVC with optional aspect-ratio-preserving resize.
  • ⚡ Use hardware encoders — Apple VideoToolbox, NVIDIA NVENC, and Intel Quick Sync when available.
  • 📎 Use LM Studio attachments — attached videos are staged safely into the plugin working directory.
  • 📈 Track long jobs — progress, processed time, speed, output path, and completion state.
  • 🛑 Cancel processing — stop a running FFmpeg job cleanly.
  • 💾 Recover job state — persisted jobs are visible after a plugin restart.
  • 🧯 Avoid accidental overwrites — generated outputs fail safely when the target filename already exists.
  • 🔒 Stay local-first — Local Video Tools itself does not upload your video to a remote processing service.

🎯 Why this exists

A local model can understand what you want to do with a video, but synchronous AI tool calls are a poor fit for real media-processing workloads.

A short metadata lookup or stream-copy trim can finish quickly. A 4K HEVC transcode can take much longer than the tool call is allowed to stay open, even though FFmpeg itself is still doing perfectly valid work on the local machine.

Local Video Tools is built around that concrete execution problem. Short operations run directly; expensive operations become background FFmpeg jobs that return a job ID immediately so the model can check progress, cancel work, and retrieve the result later.

Short / cheap operation
        ↓
run immediately
        ↓
return the output path

Long / expensive operation
        ↓
start background FFmpeg job
        ↓
return a job ID immediately
        ↓
model checks progress later

The result is a video tool surface designed for local models, not just a thin FFmpeg wrapper.


✅ Tested on a real 4K HEVC workflow

The v0.1 release series was exercised against real 3840×2160 HEVC/H.265 MOV media on Apple Silicon.

WorkflowResult
Inspect 4K HEVC metadata with ffprobe✅ Validated
Lossless stream-copy clip✅ Validated
Accurate background clip✅ Validated
4K HEVC → 1080p H.264✅ Validated
Apple h264_videotoolbox acceleration✅ Validated
Background job progress/status✅ Validated
Job cancellation and process cleanup✅ Validated

One of the key tests was simply asking:

Convert this video to a 1920px-wide H.264 MP4 using hardware acceleration if available.

Local Video Tools detected h264_videotoolbox, started FFmpeg as a background job, returned control to the model immediately, and let the model check the conversion until it completed.

That workflow is the core reason this project exists.


⚡ Quick start

Install from LM Studio Hub

  • Install FFmpeg and ffprobe locally. On macOS:

    brew install ffmpeg
    
  • Open Local Video Tools on LM Studio Hub and select Run in LM Studio.

  • Enable Local Video Tools under LM Studio Integrations.

Local Video Tools is a native LM Studio plugin. You do not need to clone the repository, install Node.js, or add it to mcp.json when installing from the Hub.

Develop from source

Requirements

  • LM Studio with native TypeScript plugin support
  • Node.js 22 or newer
  • The LM Studio lms CLI available on your PATH
  • FFmpeg and ffprobe installed locally

Clone and test:

git clone https://github.com/sahansera/lmstudio-local-video-tools.git
cd lmstudio-local-video-tools
npm ci
npm run typecheck
npm test

Install/run the development build in LM Studio:

lms dev --install

Then enable Local Video Tools under LM Studio Integrations.


🧰 Model-visible tools

The tool surface is deliberately small so local models have fewer overlapping choices.

ToolPurposeExecution
inspect_videoRead video/audio metadata and FFmpeg capabilitiesForeground
clip_videoFast lossless or accurate clippingForeground or background
convert_videoConvert to H.264/HEVC and optionally resizeBackground
video_job_statusRead progress, speed, result, and errorsForeground
cancel_video_jobCancel a running FFmpeg jobForeground

🧠 How it works

LM Studio conversation
        │
        ├── attached video
        │       ↓
        │  prompt preprocessor
        │       ↓
        │  safe local staging
        │
        └── native tool call
                ↓
        Local Video Tools
                ↓
          ffprobe / FFmpeg
                ↓
      local CPU / GPU / media engine
                ↓
          local output file

The language model does not encode the video itself. The model decides what operation to request; FFmpeg does the actual media processing locally.


⚡ Hardware acceleration

When hardware acceleration is enabled, Local Video Tools probes the local FFmpeg build and prefers a supported hardware encoder.

Platform / hardwarePreferred path
Apple Silicon / macOSVideoToolbox
NVIDIA GPUNVENC
IntelQuick Sync Video
Other / unsupportedCPU fallback

Supported encoder detection includes h264_videotoolbox, hevc_videotoolbox, h264_nvenc, hevc_nvenc, h264_qsv, and hevc_qsv.

Software encoding is selected when the FFmpeg build does not advertise a suitable hardware encoder. If an advertised encoder fails at runtime because the hardware or driver is unavailable, the job reports the FFmpeg error; automatic software retry is planned.


🔒 Local-first by design

Local Video Tools is designed for local media workflows:

  • FFmpeg and ffprobe run on your machine.
  • The plugin itself does not upload videos to a remote video-processing service.
  • Attached videos are staged inside the LM Studio working directory.
  • Arbitrary external filesystem paths are disabled by default.
  • Input paths are canonicalized, and symlinks cannot escape the working-directory boundary.
  • Runtime input, output, and job directories reject symlinked path segments.
  • FFmpeg will not overwrite an existing output file or follow an existing output symlink.
  • External path access must be explicitly enabled.
  • FFmpeg is spawned with argument arrays instead of shell command strings.
  • Subprocess output is bounded.
  • Long-running processes support timeout cleanup and cancellation.

Your chosen language model, LM Studio configuration, and other integrations can have their own privacy characteristics. These guarantees apply specifically to Local Video Tools' video-processing behavior.


⚙️ Configuration

SettingDefaultPurpose
FFmpeg pathAuto-detectOverride the ffmpeg executable
ffprobe pathAuto-detectOverride the ffprobe executable
Output directorylocal-video-tools/outputsWorking-directory-relative output location
Hardware accelerationautoPrefer supported hardware encoders
External pathsDisabledAllow files outside the LM Studio working directory
Maximum job duration2 hoursUpper bound for long-running FFmpeg work

🖥️ Platform status

macOS / Apple Silicon is the best-tested environment for the v0.1 release series.

Windows/Linux discovery and NVIDIA/Intel hardware encoder support are implemented, but they need broader real-world testing across different FFmpeg builds and hardware configurations.

If you test Local Video Tools on another platform, bug reports and validation feedback are very welcome.


🗺️ What's next

Potential next steps include:

  • batch video inspection
  • frame extraction
  • audio extraction
  • dedicated resize workflows
  • video concatenation
  • overlays and subtitles
  • better keyframe-aware clipping guidance
  • broader acceleration testing
  • expanded integration coverage

See the full roadmap.


🤝 Contributing

Contributions, focused feature proposals, and reproducible bug reports are welcome.

Please read CONTRIBUTING.md before opening a pull request. Security-sensitive issues should follow SECURITY.md rather than being reported publicly.


🎬 Reliable video processing for your local AI.

Download the latest release · Report a bug · Request a feature

MIT licensed.