Dream Machine – Shortcuts and Features
Shortcuts
- p / Space: Start/Stop preview
- c: Start conversion
- d: Diagnostics dialog
- t: Cycle theme (Day → Night → Nacht → Robot → Ocean → Forest → Purple → HiContrast → picture themes → User slots)
- m: Toggle Mirror (Source Video panel)
- f: Toggle Flip
- r: Toggle Rotate 90° clockwise
- Reverse button in Source Video panel: play/export backward with reversed audio
- o: Open last rendered file
- Ctrl+S / Ctrl+Shift+S: Save project
- Ctrl+O: Load project
- Ctrl+Shift+F / Ctrl+Shift+P: Auto Face/Person ROI
- Ctrl+M: Import music track
- Left/Right: Move timeline by 1 frame
- Shift+Left/Shift+Right: Move timeline by 10 frames
- Home/End: Jump to start/end
- Ctrl+Alt+1..0 / Ctrl+Alt+P: Collapse or expand Source → Convert panels and Preview
Timeline
- Scrub bar under preview shows 0..100% and current frame position.
- Scrubbing seeks preview live.
- Option “Start at current timeline position” renders from the selected frame.
Engine and Styles
- Engine=OpenCV: Classic OpenCV styles
- Engine=Torch: Torch: … styles, including Neon Flow and many others
- Use VRAM: utilizes GPU for Torch if installed with CUDA
System Info
- Optional compact system info line above preview (toggleable)
- Shows engine, VRAM, torch/cuda, OpenCV/cuda, and CPU/MEM (psutil)
Presets and Output
- Save Preset / Load Preset: Save/load parameters per style
- Open last output: Opens the last rendered video file
Notes
- For Torch GPU: install CUDA-enabled torch wheels (cu118/cu121)
- For OpenCV CUDA: use a CUDA-built OpenCV (pip wheels are typically CPU-only)
DreamMachine is a tkinter-based video effect tool with live preview, batch conversion, ROI masking, and multiple export formats. It supports both OpenCV-based filters and a Torch engine for GPU-friendly effects.
- Project save/load with crash-safe autosave (restores the last session automatically)
- Dual-track audio panel: original track + imported music with per-track volume and offset
- Preview transport controls (Start/Back 10%/Play/Pause/Skip 10%/End) and scale slider for lighter playback
- Collapsible sidebar/preview panels with quick hotkeys (Ctrl+Alt+1..0/P) to declutter the workspace
- Picture-driven themes with animated backgrounds (Space + auto-detected
assets/theme_<name>_background.*) and custom uploads for User 1/2/3 - Reverse playback/export: frames rendered back-to-front with optional audio reversal
- Adjustable theme animation speed slider in the Theme section (0.1x–3x)
- ROI upgrades: animated rectangle keyframes, polyline masks with per-shape feather, auto Face/Person detection, live mask overlay
- New optical-flow styles (Farneback, DIS) alongside existing OpenCV/Torch effects
- Working timeline with scrubbing and keyboard shortcuts (Left/Right, Shift+Arrows, Home/End)
- Batch queue with optional preset/engine per item and multiple export formats (MP4, AVI, PNG frames, GIF)
- Optional FFmpeg muxing with volume mixing into MP4 outputs
- Python 3.9+
- pip install:
opencv-python,Pillow,imageio,imageio-ffmpeg(recommended), optionallytorchfor Torch engine
python main.py
- Load a source video.
- Choose an engine (OpenCV or Torch). Torch uses GPU if available; export uses imageio (libx264) for reliable .mp4.
- Pick a style and adjust parameters.
- Set ROI (optional):
- Mode "Mask": load PNG grayscale mask. White = effect; black = original.
- Mode "Rectangle": x, y, w, h with feather.
- Mode "VideoMask": select an .mp4; the first frame is extracted to PNG and used as grayscale mask. The mask is auto-resized to match the video frames.
- Mode "ColorKey": specify R,G,B and Tolerance to create a mask from pixel color similarity; optional Invert and Feather.
- Preview (Start Preview). Scrub the timeline to seek.
- Choose Export Format (MP4, AVI, PNG Frames, or GIF) and Output directory.
- Convert.
- Torch -> NumPy conversion is strictly clamped/rounded to 8-bit BGR for writing.
- MP4: imageio (libx264) is preferred for Torch; OpenCV writers (mp4v/avc1) are used as fallback.
- AVI: uses OpenCV MJPG.
- PNG Frames: each frame -> PNG in a
_framesfolder, named likebasename_style__frame<pos>.png.
- Add multiple videos, optionally choose a preset (
Save Preset/Load Presetin the Parameters panel). You can also request to use the preset's engine. - Run Batch processes items sequentially. Overall batch progress updates the main progress bar.
- Auto-versioning prevents overwriting outputs by adding
_1,_2, ... to file or folder names.
- Video Mask (MP4): the first frame of the mask video is extracted (to PNG) and used as a grayscale mask. The mask is resized to match the source video frames. White areas receive the effect; black areas keep the original.
- Color Key: choose a target color (R,G,B) and Tolerance; builds a mask where pixels are within tolerance of the target color. Optional Invert toggles inside/outside. Feather softens edges.
- If FFmpeg is installed, you can mux the original audio track into the rendered MP4 (
Mux audio). For AVI/PNG this is skipped.
- Space/
p: Start/Stop preview c: Convertt: Cycle themem/f/r: Mirror/Flip/Rotate- Timeline: Left/Right (±1), Shift+Left/Right (±10), Home/End
k/K: Add/Delete keyframe at current frameg: Save snapshotb: Run batchs/l: Save/Load Preset
- If the Torch engine is selected but PyTorch is not available, the UI falls back and informs you.
- Some effects require assets (Face Overlay → PNG overlays, Style Transfer → template image).
- Drop additional picture themes into
assets/orthemes/using the patterntheme_<name>_background.(png/jpg/jpeg/bmp/gif); they appear automatically in the theme selector. - Built-in animated themes: Space (nebula sweep), Breathing Gradient, Hue Drift, Noise Overlay—adjust speed via Theme slider.