A lightweight Windows live-wallpaper prototype written in C++ with DirectX 11, DirectComposition, and FFmpeg hardware decode (D3D11VA).
This app creates a borderless composition window, attaches it to the desktop WorkerW, decodes video with FFmpeg on the GPU, and renders frames to the desktop background.
Early-stage prototype focused on performance and core rendering pipeline.
Implemented:
WorkerWdesktop attachment- DirectX 11 device + composition swap chain
- DirectComposition visual pipeline
- FFmpeg video decode with D3D11 hardware frames
- Frame queue/pool with a dedicated decoder thread
- Basic PTS-based playback timing and loop-at-EOF behavior
- First-run video picker using the Windows file dialog
- Last selected wallpaper path is saved to
wallpaper_path.txtand auto-loaded on the next launch
New in v0.08:
- Startup flow no longer depends on
-f- <video_path>command-line arguments - Better startup usability: if no saved path exists, the app asks you to choose a video file
- README run/build notes updated to match the current executable flow
Not implemented yet (as of v0.08):
- In-app UI/settings
- Dynamic wallpaper selection
- Audio playback
- Full process lifecycle polish (startup/service UX, tray controls, etc.)
- C++17
- Win32 API
- Direct3D 11 (
d3d11) - DXGI (
dxgi) - DirectComposition (
dcomp) - FFmpeg shared build (
avcodec,avformat,avutil,swscale)
- Windows 10/11
- Visual Studio 2022 (MSVC toolset
v145) - Windows SDK (
10.0target in project) - FFmpeg shared build with headers/libs/dlls available locally
- CMake 3.10+ if you want to build with the included
CMakeLists.txt
main.cpp: app entry, saved-path loading, and first-run file picker flowEngine.*: high-level app orchestrationWorkerW.*: desktopWorkerWdiscovery/attachment logicWindow.*: wallpaper window creation + message loopDXDevice.*,SwapChain.*,DComp.*: rendering/composition setupFFmpeg.*,DecoderLoop.inl: decode pipeline + hardware context setupFrameQueue.cpp,FramePool.cpp: producer/consumer bufferingDXVA.*: video processor path from decoded NV12 frames to backbufferRender.*: frame presentation and playback timing
- Configure FFmpeg include path:
- Project Properties ->
C/C++->General->Additional Include Directories
- Project Properties ->
- Configure FFmpeg library path:
- Project Properties ->
Linker->General->Additional Library Directories
- Project Properties ->
- Ensure these linker inputs are present:
avcodec.libavformat.libavutil.libswscale.lib
- Make FFmpeg runtime DLLs available to the executable:
- Copy FFmpeg
bin/*.dllnext to the built.exe, or - Add FFmpeg
bindirectory to your system/userPATH.
- Copy FFmpeg
- Update the FFmpeg include/library paths inside
CMakeLists.txtif your FFmpeg folder is in a different location. - Configure the project:
cmake -S . -B build
- Build the project:
cmake --build build --config Release
- The generated executable is:
build\Release\AliveWallpaperEngine.exe
- Build and run from Visual Studio or CMake.
- On first launch, the app opens a file picker so you can choose a wallpaper video.
- After you choose a file once, the path is saved to
wallpaper_path.txt. - On later launches, the app loads that saved path automatically and starts rendering without extra command-line arguments.
- The app attaches to desktop
WorkerWand starts rendering as wallpaper.
- Queue size is currently passed from
main.cpp:engine.MakeWindowRunwhitWorkerWandRunDXandswapchinWhitFFmpeg(..., buffersize);- Current default:
int buffersize = 3;
- Frame queue clamps buffer size to
[3, 18]. - Current startup flow:
- Try loading the video path from
wallpaper_path.txt - If the file is missing or empty, open the Windows file picker
- Save the selected path for the next run
- Try loading the video path from
- The app sets
PER_MONITOR_AWARE_V2DPI awareness on startup. - Debug console logging is currently disabled in the default startup flow.
- FFmpeg include/lib path errors:
- Re-check project property paths for the active configuration (
x64 Debugvsx64 Release).
- Re-check project property paths for the active configuration (
- Missing DLL errors on launch:
- Ensure FFmpeg runtime DLLs are in the executable directory or
PATH.
- Ensure FFmpeg runtime DLLs are in the executable directory or
- No video appears on first launch:
- Make sure you selected a supported video file in the picker.
- Wrong video keeps loading:
- Delete
wallpaper_path.txtand launch again to pick a different file.
- Delete
- Black/green output:
- Validate that decode is running and frames are being pushed/popped (watch debug console).
- WorkerW attach failure:
- The app currently exits with an error dialog if suitable
WorkerWis not found.
- The app currently exits with an error dialog if suitable
This project is licensed under the GNU Affero General Public License v3.0.
See LICENSE for full text. (This README update was written by Codex because iam lazy) (and also iam not good whit license stuff but i try to understand as much iam)
This project dynamically links against FFmpeg shared libraries.
The distributed FFmpeg build used by this project is GPL-enabled
(--enable-gpl) and licensed under the GNU General Public License
subject to FFmpeg's own licensing terms.
See:
- https://ffmpeg.org/legal.html
- Included third-party license files