Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vidkit

A thin, sane PowerShell layer over ffmpeg for the video chores you actually do.

ffmpeg can do everything, which is exactly the problem — every task means re-deriving a filtergraph from a Stack Overflow answer. vidkit wraps the handful of operations that come up constantly into real PowerShell cmdlets with tab completion, pipeline support and -WhatIf.

Pairs nicely with obs-4k60-recorder — record at native res, then trim and shrink the result here.

Install

Requires PowerShell 5.1+ and ffmpeg on your PATH.

winget install Gyan.FFmpeg   # restart your shell afterwards
git clone https://github.com/appsmypass/vidkit
Import-Module .\vidkit\VidKit.psd1

To load it in every session, add that Import-Module line to your $PROFILE.

vidkit also looks in the usual install locations (Program Files, winget links, Chocolatey, C:\ffmpeg\bin) if ffmpeg is not on PATH.

Commands

Cmdlet What it does
Get-VidInfo Duration, resolution, fps, codecs, bitrate, size
Export-VidClip Trim a section out — lossless and instant by default
Compress-Vid Shrink with a quality target, hardware-accelerated when possible
Convert-VidToGif Two-pass palette GIF that does not look muddy
Export-VidAudio Pull the audio track out
Resize-Vid Rescale to a target height or explicit dimensions

Examples

Inspect a file, or a whole folder:

Get-VidInfo .\clip.mp4
Get-ChildItem *.mp4 | Get-VidInfo | Format-Table Name, Duration, Width, Height, Fps, Size

Trim without re-encoding. This is near-instant because it stream-copies, but cuts land on the nearest keyframe — add -Reencode when you need frame accuracy:

Export-VidClip .\gameplay.mp4 -Start 1:30 -End 2:15
Export-VidClip .\gameplay.mp4 -Start 90 -Duration 45 -Reencode

Compress with a quality target instead of guessing at bitrates. Lower is better quality and bigger files; 18 is visually lossless, 23 is a good default, 28 is small and noticeably soft:

Compress-Vid .\raw-4k.mp4 -Quality 23
Get-ChildItem *.mkv | Compress-Vid -Destination .\compressed -Codec hevc

NVENC is used automatically when your GPU supports it. Pass -Software to force libx264 — slower, but usually a slightly smaller file at the same quality.

Make a GIF worth posting:

Convert-VidToGif .\clip.mp4 -Start 5 -Duration 6 -Width 640 -Fps 15

This runs the two-pass palette workflow — generate an optimal palette for the clip, then map frames onto it. Most one-liner GIF recipes skip this and dither against a fixed 216-colour palette, which is why they come out muddy.

Extract audio:

Export-VidAudio .\lecture.mp4 -Format mp3 -Bitrate 192
Export-VidAudio .\clip.mp4 -Format copy     # no re-encode, lossless

Resize:

Resize-Vid .\4k.mp4 -Height 1080
Get-ChildItem *.mov | Resize-Vid -Height 720 -Destination .\web

Without importing the module

vidkit.ps1 is a passthrough front end — every parameter of the underlying cmdlet still works:

.\vidkit.ps1 info .\clip.mp4
.\vidkit.ps1 trim .\clip.mp4 -Start 1:30 -End 2:15
.\vidkit.ps1 gif .\clip.mp4 -Start 5 -Duration 6 -Width 640

Notes

  • Nothing is overwritten unless you pass -Force, and output defaults to a suffixed sibling of the input (clip.mp4clip.small.mp4).
  • Every cmdlet that writes a file supports -WhatIf.
  • Times accept seconds (90), mm:ss (1:30) or hh:mm:ss.ms (00:01:30.5).
  • Passing a directory to -Destination keeps the generated filename and just puts it there.

License

MIT

About

A thin, sane PowerShell layer over ffmpeg: trim, compress, GIF, extract audio, resize and inspect video without memorising filtergraphs.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages