0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

sub: merge vsfilter-aspect and vsfilter-blur-compat options

The naming for "blur-compat" was misleading since the setting
actually affects more than just blur affects. Additionally
forwarding storage resolution but forcing an aspect ratio
of 1.0 for the video is likely to result in odd rendering
and there’s no known usecase for it.

Both options control which video properties are exposed to libass
so to fix the aforementioned issues merge these settings into one
tri-state sub-ass-use-video-data.

The default V keybind now cycles through all states of
use-video-data instead of toggling vsfilter-aspect-compat.

Resolves: https://github.com/mpv-player/mpv/issues/10680
This commit is contained in:
Oneric 2024-08-23 22:47:53 +02:00 committed by sfan5
parent f6d931301b
commit 207b1a2c91
8 changed files with 31 additions and 35 deletions

View File

@ -0,0 +1,5 @@
Remove sub-ass-vsfilter-aspect-compat.
Remove sub-ass-vsfilter-blur-compat.
Add sub-ass-use-video-data.
Change default V keybind to cycle sub-ass-use-video-data
instead of toggling the now removed sub-ass-vsfilter-aspect-compat.

View File

@ -181,8 +181,8 @@ u
style. See ``--sub-ass-override`` for more info.
V
Toggle subtitle VSFilter aspect compatibility mode. See
``--sub-ass-vsfilter-aspect-compat`` for more info.
Cycle through which video data gets used for ASS rendering.
See ``--sub-ass-use-video-data`` for more info.
r and R
Move subtitles up/down. The ``t`` key does the same as ``R`` currently, but

View File

@ -2568,31 +2568,22 @@ Subtitles
Default: yes.
``--sub-ass-vsfilter-aspect-compat=<yes|no>``
Stretch SSA/ASS subtitles when playing anamorphic videos for compatibility
with traditional VSFilter behavior. This switch has no effect when the
video is stored with square pixels.
``--sub-ass-use-video-data=<none|aspect-ratio|all>``
Controls which information about the video stream is passed to libass.
Any option but ``all`` is incompatible with standard ASS and VSFilters.
The renderer historically most commonly used for the SSA/ASS subtitle
formats, VSFilter, had questionable behavior that resulted in subtitles
being stretched too if the video was stored in anamorphic format that
required scaling for display. This behavior is usually undesirable and
newer VSFilter versions may behave differently. However, many existing
scripts compensate for the stretching by modifying things in the opposite
direction. Thus, if such scripts are displayed "correctly", they will not
appear as intended. This switch enables emulation of the old VSFilter
behavior (undesirable but expected by many existing scripts).
For certain kinds of broken ASS files which got repurposed across
several video resolutions without either setting ``LayoutRes`` headers
or adjusting affected effects, it may be desirable to withhold storage resolution
information from libass to ensure consistent rendering across resolutions.
Among others this affects 3D rotations and blurs.
When encountering such files, try setting ``aspect-ratio``.
Enabled by default.
Even more broken files on anamorphic video might also exhibit stretching
unless aspect ratio information is also faked, in this case you can try
using ``none``. This has never an effect on non-anamorphic video.
``--sub-ass-vsfilter-blur-compat=<yes|no>``
Scale ``\blur`` tags by video resolution instead of script resolution
(enabled by default). This is bug in VSFilter, which according to some,
can't be fixed anymore in the name of compatibility.
Note that this uses the actual video resolution for calculating the
offset scale factor, not what the video filter chain or the video output
use.
Default: ``all``
``--sub-vsfilter-bidi-compat=<yes|no>``
Set implicit bidi detection to ``ltr`` instead of ``auto`` to match ASS'

View File

@ -129,7 +129,7 @@
#t add sub-pos +1 # move subtitles down
#v cycle sub-visibility # hide or show the subtitles
#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
#V cycle sub-ass-use-video-data # cycle which video data gets used in ASS rendering to fix broken files
#u cycle-values sub-ass-override "force" "scale" # toggle overriding SSA/ASS subtitle styles with the normal styles
#j cycle sub # switch subtitle track
#J cycle sub down # switch subtitle track backwards

View File

@ -319,11 +319,13 @@ const struct m_sub_options mp_subtitle_sub_opts = {
M_RANGE(-1000, 1000)},
{"sub-use-margins", OPT_BOOL(sub_use_margins)},
{"sub-ass-force-margins", OPT_BOOL(ass_use_margins)},
{"sub-ass-vsfilter-aspect-compat", OPT_BOOL(ass_vsfilter_aspect_compat)},
{"sub-ass-vsfilter-color-compat", OPT_CHOICE(ass_vsfilter_color_compat,
{"no", 0}, {"basic", 1}, {"full", 2}, {"force-601", 3})},
{"sub-ass-vsfilter-blur-compat", OPT_BOOL(ass_vsfilter_blur_compat)},
{"sub-vsfilter-bidi-compat", OPT_BOOL(sub_vsfilter_bidi_compat)},
{"sub-ass-vsfilter-aspect-compat", OPT_REMOVED("replaced by sub-ass-use-video-data=aspect-ratio")},
{"sub-ass-vsfilter-blur-compat", OPT_REMOVED("replaced by sub-ass-use-video-data=all")},
{"sub-ass-use-video-data", OPT_CHOICE(ass_use_video_data,
{"none", 0}, {"aspect-ratio", 1}, {"all", 2})},
{"embeddedfonts", OPT_BOOL(use_embedded_fonts), .flags = UPDATE_SUB_HARD},
{"sub-ass-style-overrides", OPT_STRINGLIST(ass_style_override_list),
.flags = UPDATE_SUB_HARD},
@ -354,9 +356,8 @@ const struct m_sub_options mp_subtitle_sub_opts = {
.sub_scale_with_window = true,
.teletext_page = 0,
.sub_scale = 1,
.ass_vsfilter_aspect_compat = true,
.ass_vsfilter_color_compat = 1,
.ass_vsfilter_blur_compat = true,
.ass_use_video_data = 2,
.ass_shaper = 1,
.use_embedded_fonts = true,
},
@ -1137,7 +1138,7 @@ static const struct MPOpts mp_default_opts = {
"sub-scale",
"sub-use-margins",
"sub-ass-force-margins",
"sub-ass-vsfilter-aspect-compat",
"sub-ass-use-video-data"
"sub-ass-override",
"secondary-sid",
"secondary-sub-delay",

View File

@ -109,10 +109,9 @@ struct mp_subtitle_opts {
float ass_line_spacing;
bool ass_use_margins;
bool sub_use_margins;
bool ass_vsfilter_aspect_compat;
int ass_vsfilter_color_compat;
bool ass_vsfilter_blur_compat;
bool sub_vsfilter_bidi_compat;
int ass_use_video_data;
bool use_embedded_fonts;
char **ass_style_override_list;
char *ass_styles_file;

View File

@ -4464,7 +4464,7 @@ static const struct property_osd_display {
"${?secondary-sub-visibility==yes:visible${?secondary-sid==no: (but no secondary subtitles selected)}}"},
{"sub-forced-events-only", "Forced sub only"},
{"sub-scale", "Sub Scale"},
{"sub-ass-vsfilter-aspect-compat", "Subtitle VSFilter aspect compat"},
{"sub-ass-use-video-data", "Subtitle using video properties"},
{"sub-ass-override", "ASS subtitle style override"},
{"secondary-sub-ass-override", "Secondary sub ASS subtitle style override"},
{"vf", "Video filters", .msg = "Video filters:\n${vf}"},

View File

@ -704,7 +704,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
double scale = dim.display_par;
if (!converted && (!shared_opts->ass_style_override[sd->order] ||
opts->ass_vsfilter_aspect_compat))
opts->ass_use_video_data >= 1))
{
// Let's use the original video PAR for vsfilter compatibility:
double par = ctx->video_params.p_w / (double)ctx->video_params.p_h;
@ -717,7 +717,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
}
ass_set_pixel_aspect(renderer, scale);
if (!converted && (!shared_opts->ass_style_override[sd->order] ||
opts->ass_vsfilter_blur_compat))
opts->ass_use_video_data >= 2))
{
ass_set_storage_size(renderer, ctx->video_params.w, ctx->video_params.h);
} else {