Skip to content

Interactive Pre-Filter Zoom (VLC-style) with Script Control #17799

@mstreurman

Description

@mstreurman

Expected behavior of the wanted feature

Summary

Request for a true source-region zoom mechanism in mpv that operates before the video filter chain, enabling interactive zoom/pan that behaves like VLC’s “interactive zoom” while remaining fully compatible with mpv’s advanced rendering pipeline (HDR, shaders, VPP, etc.).


Problem

Current mpv zoom mechanisms:

  • video-zoom
  • video-pan-x/y
  • video-crop

all operate at the VO/display stage, not on the source frame before filtering.

This leads to:

  • zoom being applied after scaling, filtering, and shader processing
  • effectively magnifying an already processed frame
  • visible quality degradation compared to crop + resample approaches

Desired Behavior

Introduce a zoom system that behaves as:

decode
→ select source region (interactive crop)
→ apply video filters (e.g. d3d11vpp, scaling)
→ apply shaders (libplacebo)
→ display

Instead of current behavior:

decode
→ filters
→ shaders
→ display
→ then zoom/pan (display transform)

Key Requirements

1. Pre-filter crop/zoom stage

  • Ability to define a dynamic crop region of the source frame
  • This crop should occur before vf filters, including:
    • d3d11vpp
    • scaling filters
    • tone mapping / HDR processing

2. Interactive control (scriptable)

Expose the crop/zoom region via properties accessible from Lua.

Example (conceptual):

video-source-crop-x
video-source-crop-y
video-source-crop-w
video-source-crop-h

or normalized:

video-source-center-x
video-source-center-y
video-source-zoom

These should be:

  • writable at runtime
  • fast enough for continuous updates (mouse drag)

3. GPU-friendly implementation

  • Should integrate cleanly with hardware paths:

    • d3d11vpp
    • vaapi
    • nvdec / CUDA
    • vo=gpu-next / libplacebo
  • Must avoid:

    • full filter graph rebuilds per frame
    • expensive CPU-side reconfiguration

4. Maintain full pipeline compatibility

Must work correctly with:

  • HDR tone mapping
  • custom shaders (glsl-shaders)
  • scaling algorithms
  • existing vf chains

Motivation / Use Case

Modern mpv setups often include:

  • hardware scaling (e.g. Intel VPP)
  • multi-pass shader pipelines
  • HDR processing
  • advanced playback (streams, URLs, capture)

In these setups, current zoom:

  • breaks visual fidelity
  • feels inferior to VLC’s interactive zoom
  • cannot leverage the existing high-quality pipeline

VLC’s zoom works because it:

  • crops source region
  • resamples it through its pipeline
  • keeps interaction smooth and visually consistent

mpv currently lacks an equivalent mechanism.


Why existing solutions are insufficient

video-zoom

  • display-space scaling only
  • does not re-run filters on the selected region

video-crop

  • VO-side crop, not pre-filter
  • not suitable for interactive updates

dynamic vf=crop

  • requires filter chain updates
  • too heavy for real-time interaction

shaders

  • operate post-filter
  • cannot move processing earlier in the pipeline

Proposed Direction (non-binding)

Any of the following would satisfy the requirement:

  • a dedicated pre-filter crop stage
  • a hardware-accelerated crop region selection
  • a libplacebo-integrated source-region sampling control

As long as:

  • it happens before filters
  • it is scriptable
  • it supports real-time interaction

Additional Notes

This feature would enable:

  • true VLC-style zoom in mpv
  • higher-quality inspection workflows
  • better usability for high-resolution content
  • improved integration with advanced pipelines already present in mpv

Conclusion

mpv already provides one of the most powerful playback pipelines available.

This feature would fill a key gap by enabling interactive source-region zoom that fully leverages that pipeline instead of bypassing it.

Alternative behavior of the wanted feature

No response

Log File

No response

Sample Files

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions