Skip to content

Commit

Permalink
vf_gpu: add video filter using vo_gpu's renderer
Browse files Browse the repository at this point in the history
Probably pretty useless in this form (see: the wall of warnings), but
someone wanted this.

I think this should be useful to perform some automated tests, maybe.

Fixes: #7194
  • Loading branch information
wm4 committed Nov 29, 2019
1 parent 053297b commit 90df6c7
Show file tree
Hide file tree
Showing 5 changed files with 405 additions and 0 deletions.
36 changes: 36 additions & 0 deletions DOCS/man/vf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,39 @@ Available mpv-only filters are:
Print computed fingerprints the the terminal (default: no). This is
mostly for testing and such. Scripts should use ``vf-metadata`` to
read information from this filter instead.

``gpu=...``
Convert video to RGB using the OpenGL renderer normally used with
``--vo=gpu``. This requires that the EGL implementation supports off-screen
rendering on the default display. (This is the case with Mesa.)

Sub-options:

``w=<pixels>``, ``h=<pixels>``
Size of the output in pixels (default: 0). If not positive, this will
use the size of the first filtered input frame.

.. warning::

This is highly experimental. Performance is bad, and it will not work
everywhere in the first place. Some features are not supported.

.. warning::

This does not do OSD rendering. If you see OSD or subtitles, then these
have been renderer by the VO backend (or the ``sub`` video filter). This
is normally done in software, and potentially questionable quality.

.. warning::

If you use this with encoding mode, keep in mind that encoding mode will
convert the RGB filter's output back to yuv420p in software, using the
configured software scaler. Using ``zimg`` might improve this, but in
any case it might go against your goals when using this filter.

.. warning::

Do not use this with ``--vo=gpu``. It will apply filtering twice, since
most ``--vo=gpu`` options are unconditionally applied to the ``gpu``
filter. There is no mechanism in mpv to prevent this.

3 changes: 3 additions & 0 deletions filters/user_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ const struct mp_user_filter_entry *vf_list[] = {
#if HAVE_D3D_HWACCEL
&vf_d3d11vpp,
#endif
#if HAVE_EGL_X11
&vf_gpu,
#endif
};

static bool get_vf_desc(struct m_obj_desc *dst, int index)
Expand Down
1 change: 1 addition & 0 deletions filters/user_filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ extern const struct mp_user_filter_entry vf_vdpaupp;
extern const struct mp_user_filter_entry vf_vavpp;
extern const struct mp_user_filter_entry vf_d3d11vpp;
extern const struct mp_user_filter_entry vf_fingerprint;
extern const struct mp_user_filter_entry vf_gpu;
Loading

0 comments on commit 90df6c7

Please sign in to comment.