Transform Your Automation with Our FFmpeg Library for AutoHotkey v2

FFmpeg Library for AutoHotkey v2


Stop wrestling with raw ffmpeg command lines. This drop-in AutoHotkey v2 class wraps the power of FFmpeg behind clean, readable method calls — convert video to audio, trim and split media, hard-burn or soft-mux subtitles, add fades, concatenate clips, probe file info, and even record from a microphone. One #Include and you’re processing media from your own scripts.

Updated on 2026/07/01 to Version: 1.3.3

Note: This is a developer library (an AHK v2 class you include in your own scripts) — not a standalone app. No license key or activation required. Windows only.

Intro to our FFMPEG Class
Intro to our FFMPEG Class

What It Does


  • Convert video to audio — extract a clean, speech-optimized track (VideoToAudio()) with noise-friendly filtering, output as ogg / mp3 / mp4.
  • Trim & split — cut a clip by start/end seconds (Trim()) or auto-chop a long file into fixed-length sections (CreateSections()).
  • Add subtitles — soft-mux (toggleable) or hard-burn subtitles directly into the video (AddSubtitles()).
  • Fades & concatenation — add fade in/out/inout (Fading()) and stitch multiple clips into one normalized file (Concat()).
  • Probe media info — pull resolution, duration, framerate, and stream details (Getinfo(), GetType(), GetVersion()).
  • Microphone recording — enumerate audio devices/mics and record with pause/resume/stop control (GetMicrophones(), SetupRecording()).
  • Automatic GPU acceleration — detects NVIDIA NVENC, AMD AMF, or Intel QSV and uses hardware encoding when available, falling back to CPU (libx264) automatically.
  • Self-installing — if ffmpeg isn’t found on your PATH, the library offers to download and set it up for you.

Requirements


  • AutoHotkey v2 (v2.0 or newer) — Windows.
  • FFmpeg on your system PATH — or let the library download it for you on first run.
  • Basic familiarity with AutoHotkey v2 scripting.

Quick Start


Drop FFmpeg.ahk into your project and include it. Every method is static — call it straight off the FFMPEG class, no instance needed.

#Requires AutoHotkey v2.0
#Include FFmpeg.ahk
; Extract the audio track from a video
audio := FFMPEG.VideoToAudio("C:\clips\lecture.mp4", "mp3")
; Trim seconds 30 through 90 into a new file
FFMPEG.Trim("C:\clips\lecture.mp4", "C:\clips\highlight.mp4", 30, 90)
; Probe media info (resolution, duration, framerate...)
info := FFMPEG.Getinfo("C:\clips\lecture.mp4")
MsgBox "Resolution: " info["Resolution"] "  Length: " info["Length"]
; Burn subtitles into the video (hardcode := true)
FFMPEG.AddSubtitles("C:\clips\lecture.mp4", "C:\clips\lecture.srt", true)
; Stitch several clips into one normalized file
FFMPEG.Concat(["part1.mp4", "part2.mp4", "part3.mp4"], "full.mp4")
Tip: The first time an encode runs, the library quietly tests your GPU and caches the result — so NVENC/QSV/AMF acceleration “just works” on later runs with zero extra code.

Method Reference


MethodWhat it does
VideoToAudio(path, format)Extract an audio track (ogg/mp3/mp4), speech-optimized.
Trim(in, out, start, end)Cut a clip between two second markers (stream copy, fast).
CreateSections(path, folder, mins)Split a long file into fixed-length sections.
AddSubtitles(video, srt, hardcode)Soft-mux or hard-burn subtitles into a video.
Fading(path, secs, type)Add fade in / out / inout to a clip.
Concat(paths[], out)Concatenate multiple clips into one normalized file (cancelable).
Getinfo(path)Return a Map of resolution, duration, framerate, streams.
GetType(path) / GetVersion()Detect Video/Audio type; read installed FFmpeg version.
GetMicrophones() / SetupRecording()List mics and record audio with pause/resume/stop.

Get the Library


Grab the single-file FFmpeg.ahk class and start automating media today — just $7.99, no license activation, use it in as many of your own scripts as you like.

Brought to you by the-Automator.com — learn AutoHotkey the easy way. Licensed CC BY 4.0.

Comments are closed.