diff --git a/DOCS/interface-changes/sub-ass-use-video-data.txt b/DOCS/interface-changes/sub-ass-use-video-data.txt new file mode 100644 index 0000000000..8779658b25 --- /dev/null +++ b/DOCS/interface-changes/sub-ass-use-video-data.txt @@ -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. diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index 4b72ac13f3..3d0ab65140 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -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 diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 8ebbcd9a70..f0595fd894 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2568,31 +2568,22 @@ Subtitles Default: yes. -``--sub-ass-vsfilter-aspect-compat=`` - 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=`` + 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=`` - 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=`` Set implicit bidi detection to ``ltr`` instead of ``auto`` to match ASS' diff --git a/etc/input.conf b/etc/input.conf index 87a8420bcc..bc5ff27e30 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -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 diff --git a/options/options.c b/options/options.c index ecab0c4880..c863ea0686 100644 --- a/options/options.c +++ b/options/options.c @@ -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", diff --git a/options/options.h b/options/options.h index 8fde7f210f..e2f7746055 100644 --- a/options/options.h +++ b/options/options.h @@ -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; diff --git a/player/command.c b/player/command.c index 40e667aaf4..50accfdc25 100644 --- a/player/command.c +++ b/player/command.c @@ -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}"}, diff --git a/sub/sd_ass.c b/sub/sd_ass.c index c32e339a50..d3b2e9272e 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -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 {