Skip to content

About

Play an edge-detected video inside the Windows Task Manager performance chart — FFmpeg decode + Direct2D overlay

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TaskmgrVideo

Play a video inside the Windows Task Manager performance chart — FFmpeg decodes the frames, an edge pass turns them into neon line art, and a click-through overlay paints them on top of the live CPU graph.

Task Manager → Performance → CPU
┌───────────────────────────────────────────────┐
│  %  Utilization                                │
│  100 ┤                                         │
│      │      ╱╲    ┌─┐   ╱╲        ← your video │
│   50 ┤  ╱╲ ╱  ╲   │ │  ╱  ╲   ╱╲    as edges  │
│      │ ╱  V    ╲__╱ ╲_╱    ╲_╱  ╲             │
│    0 ┴──────────────────────────────────────   │
└───────────────────────────────────────────────┘
  • FFmpeg does the decoding through a rawvideo pipe (-re, so playback is real time).
  • edgedetect + eq run inside the filter graph, the player only uploads the mask.
  • Direct2D turns the mask into premultiplied pixels, tinted with the Task Manager blue.
  • The overlay never takes focus and never eats clicks — Task Manager keeps working.

What it looks like

Frame decoded by FFmpeg Same frame after the edge pass
source edges

The right image is the actual player output (edge mask tinted with the Task Manager blue and composited over a dark background). Sample frame: picsum.photos.

Requirements

  • Windows 10 2004 (20H1) / Windows 11, x64

  • FFmpeg — ffmpeg.exe (and optionally ffprobe.exe)

  • One of the two release zips:

    • TaskmgrVideo-<ver>-win-x64.zip — ~1 MB, needs the .NET 8 Desktop Runtime
    • TaskmgrVideo-<ver>-win-x64-with-ffmpeg.zip — ~70 MB, the same plus a bundled FFmpeg (LGPL shared build)
    • TaskmgrVideo-<ver>-win-x64-standalone.zip — ~66 MB, self-contained, no runtime install
    • TaskmgrVideo-<ver>-win-x64-standalone-with-ffmpeg.zip — ~135 MB, the same plus bundled FFmpeg

    Pick a with-ffmpeg package if you do not have FFmpeg on PATH; otherwise the smaller package plus your own FFmpeg works. Bundled binaries live in ffmpeg\ next to the exe and are used automatically; most of that download is libavcodec, not the player.

Put ffmpeg.exe… anywhere findable:

  1. TaskmgrVideo.exe folder, or an ffmpeg\ / ffmpeg\bin\ / tools\ subfolder
  2. anywhere on PATH
  3. or point Advanced → Set ffmpeg path… at it

Use

  1. Unzip, run TaskmgrVideo.exe (it lives in the tray).
  2. Open Task Manager → Performance → CPU.
  3. Tray → Choose video…, then Play video (or double-click the tray icon).
  4. Switch to Task Manager: the video starts playing the moment the chart is in front, and it hides itself when Task Manager loses focus.

Tray menu:

Item What it does
Play video / Stop Start or stop the decode session
Choose video… Pick the source file (mp4/mkv/mov/webm/avi/gif/…)
Loop Loop the clip (default on)
Fit Cover (fill + crop, default) · Contain (letterbox) · Stretch
Style Edge outline only (default) · Plain video
Edge color Task Manager blue (default) · White · Amber
Edge strength Low · Medium · High — how many edges survive
Backdrop Darken the chart behind the video: Off · Light · Strong
Advanced Status, FFmpeg path, debug border, debug log window, language (English / 简体中文)

Settings live in %APPDATA%\TaskmgrVideo\settings.json.

Renderers

The video is painted by an external overlay window that is a direct port of CS-LX/CPURacer's NativeExternalOverlay:

  • a WS_POPUP window with WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOPMOST | WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW,
  • DwmExtendFrameIntoClientArea(hwnd, -1, -1, -1, -1) so the client area is glass and per-pixel alpha shows,
  • SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA) instead of an UpdateLayeredWindow DIB blit,
  • a Direct2D ID2D1HwndRenderTarget cleared to transparent every frame.

That is the configuration known to draw on the Windows 10 builds where every earlier backend (UpdateLayeredWindow DIB, chart child window, ...) produced nothing.

Backend How it draws Notes
External overlay (default) CPURacer's topmost layered window + DWM glass + Direct2D The reference implementation
GDI layered (legacy) Topmost layered window, UpdateLayeredWindow Kept only because it can export the composed frame as PNG

Settings written by 1.x store a Backend the current build no longer honours; they are migrated to the external overlay on load.

How it works

TaskmgrTracker ──chart rect──▶ LayoutMath ──decode size──▶ FfmpegDecoder
      │                            │                            │
      │                       destination rect          premultiplied BGRA
      │                            ▼                            ▼
      └──────────────────────▶ VideoOverlay ◀──── newest frame ┘
  • TaskmgrTracker finds TaskManagerWindow → the largest visible CvChartWindow, caches both handles and re-discovers only when one goes away. Per tick it costs four cheap queries.
  • LayoutMath maps the chart rectangle onto the video aspect ratio and caps the decode at ~1280×720 pixels; Direct2D scales the bitmap up, so a maximized window does not push a 4K frame through the pipe 30 times a second.
  • FfmpegDecoder owns one FFmpeg process per session and a reader thread. Frames are converted to premultiplied BGRA with a 256-entry lookup table and published under a lock, so the renderer always gets the newest complete frame — slow renders drop frames instead of queueing them.
  • Resizing Task Manager rebuilds the pipeline only after the geometry stays stable for ~0.5 s, and resumes at the current play head.

Build

.\build.cmd                 # Debug
.\build.cmd Release         # Release
.\test.cmd                  # unit + FFmpeg decode tests
.\pack-release.cmd          # all four zips in dist\ (set FFMPEG_DIR to include the bundled ones)

Requires the .NET 8 SDK. The App project is net8.0-windows (WinForms + Direct2D via Vortice); TaskmgrVideo.Logic is plain net8.0 so the decode pipeline, filter graph and layout math are testable on any OS — the test suite runs a real FFmpeg decode when one is installed.

Known limits

  • The overlay follows whichever performance chart is visible (CPU, Memory, …), not only CPU.
  • Hiding the window does not stop decoding; stop the playback from the tray to free the CPU.
  • Task Manager running elevated does not block anything here (the overlay only reads geometry).
  • Audio is ignored (-an).

Credits

The overlay-on-Taskmgr idea and the layered/Direct2D window recipe come from CS-LX/CPURacer (a lunar-lander on the CPU graph) and svr2kos2/TaskmgrPlayer. This project keeps the window plumbing and replaces the game with an FFmpeg edge-video pipeline.

MIT licensed.

About

Play an edge-detected video inside the Windows Task Manager performance chart — FFmpeg decode + Direct2D overlay

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages