mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.19k stars 2.89k forks source link

There is no font substitution for missing symbols in OSD #2947

Closed v-fox closed 4 years ago

v-fox commented 8 years ago

mpv does not use automatic substitution for missing symbols if selected font doesn't have them which is quite an issue if you, like me, would use some stylized fonts (like Joystix) which, with >90% probability, are latin-only and then try to see Russian or Korean filename in OSD. It's a common and old issue which is fixed by automatic substitution of missing symbols from fonts with lower priority (which, as far as I remember, is somehow implemented in Bomi, the mpv fork). This is why in Linux distributions there are settings for global fontconfig priorities of "font families" but, ideally, all installed fonts are searched to leave no symbol undrawn.

grigorig commented 8 years ago

The OSD uses libass, which has fairly advanced mechanism for fallbacks. What's your platform? You may be using a libass library compiled without support for the relevant OS-specific backends that allow substitution to work.

v-fox commented 8 years ago

The OSD uses libass, which has fairly advanced mechanism for fallbacks. What's your platform? You may be using a libass library compiled without support for the relevant OS-specific backends that allow substitution to work.

I use openSUSE "Tumbleweed" GNU/Linux. Here's its libass build and its build log says:

…
[   79s] checking for FREETYPE... yes
[   79s] checking for FRIBIDI... yes
[   79s] checking for FONTCONFIG... yes
[   79s] checking for CORETEXT... no
[   79s] checking for DIRECTWRITE... no
[   79s] checking for HARFBUZZ... yes
…

I've noticed a suspicious line in man mpv at "--osd-font=": This used to support fontconfig patterns. Starting with libass 0.13.0, this stopped working.

grigorig commented 8 years ago

Can you please provide more details, e.g. mpv version, libass version, mpv configuration, verbose mpv/libass output or anything else that could help to see what's going on.

v-fox commented 8 years ago

Can you please provide more details, e.g. mpv version, libass version, mpv configuration, verbose mpv/libass output or anything else that could help to see what's going on.

I'll try. Here some data from opening a Korean movie with English, Russian and Korean symbols in its name in Xt7/mpv-0.16.0 (see build details here): 복수 삼부작 (Трилогия Мести) II - 올드보이 (Oldboy) [2003 h264 720p Kor Rus].mkv.

To my surprise, it finds substitutions for Korean and Chinese and not for Russian/Cyrillic but at the same time Russian subtitles are rendered fine here with the same Google Noto font family used for Korean.

screen - 2016-03-18_18 31 03

mpv log:

Options:
  --config=no
  --load-scripts=no
  --osc=no
  --dvbin-file=/home/fox/.config/mpv/channels.conf.ter
  --wid=138412633
  --cursor-autohide=no
  --cursor-autohide-fs-only=no
  --audio-pitch-correction=no
  --audio-display=no
  --input-cursor=no
  --input-vo-keyboard=no
  --cache=51200
  --cache-initial=5120
  --cache-seek-min=500
  --vo=opengl-hq=scale=ewa_lanczossharp:deband-iterations=2:deband-range=64:scale-antiring=0.2:backend=x11:alpha=blend:icc-profile-auto:interpolation:interpolation-threshold=-1:tscale=robidouxsharp:tscale-radius=3:prescale=superxbr:prescale-passes=4:prescale-downscaling-threshold=1.5,opengl:backend=x11:scale=spline36:cscale=spline36:dscale=mitchell:dither-depth=auto:correct-downscaling:sigmoid-upscaling:pbo:interpolation:scale=ewa_lanczossharp:alpha=blend:icc-profile-auto,xv
  --ao=jack:port=jamin,pulse:latency-hacks=yes
  --af-add=scaletempo,lavfi=[dynaudnorm=1000:3:1:10:0:1:1:1:0]
  --framedrop=decoder+vo
  --field-dominance=auto
  --audio-device=jack
  --ad-lavc-ac3drc=0.5
  --audio-channels=2
  --softvol=yes
  --softvol-max=300
  --autosync=1
  --vd-lavc-threads=0
  --hwdec=no
  --dvbin-card=1
  --dvbin-timeout=10
  --ass-force-margins=
  --initial-audio-sync=
  --sub-text-margin-y=2
  --sub-text-bold=yes
  --sub-text-font="Noto Sans"
  --sub-text-font-size=48
  --sub-text-border-size=5
  --sub-text-border-color=#EB050505
  --sub-text-color=#F5A6A650
  --osd-font="Joystix"
  --osd-font-size=30
  --osd-color=#EBAAFF7F
  --osd-border-size=2
  --osd-border-color=#F5000000
  --sub-auto=fuzzy
  --sub-codepage=utf-8
  --alang=jap,ind,spa,fra,kor,chi,en,eng
  --slang=en,eng
  --volume=100
  --input-file=/home/fox/.config/gambas3/xt7-Player-mpv/.InputPipes/Xt7Input-60381
  --msg-color=no
  --msg-level=all=v,cplayer=status,dvdnav=no,disc=no
  --input-default-bindings=no
  --term-status-msg=MPV_PLAY_IS_FULLY_INITIALIZED
  --force-seekable=yes
  --video-sync=display-vdrop
…
[sub/ass] fontselect: (Cronos Pro Light, 400, 0) -> CronosPro-Semibold, 0, CronosPro-Semibold
[vo/opengl-hq] recompiling a shader program:
[vo/opengl-hq] [ 1] // OSD (libass)
[vo/opengl-hq] [ 2] color = vec4(ass_color.rgb, ass_color.a * texture(osdtex, texcoord).r);
[vo/opengl-hq] [ 3] // color management
[vo/opengl-hq] [ 4] color.rgb = clamp(color.rgb, 0.0, 1.0);
[vo/opengl-hq] [ 5] color.rgb = mix(color.rgb / vec3(12.92), pow((color.rgb + vec3(0.055))/vec3(1.055), vec3(2.4)), lessThan(vec3(0.04045), color.rgb));
[vo/opengl-hq] [ 6] color.rgb = cms_matrix * color.rgb;
[vo/opengl-hq] [ 7] color.rgb = clamp(color.rgb, 0.0, 1.0);
[vo/opengl-hq] [ 8] color.rgb = pow(color.rgb, vec3(1.0/2.4));
[vo/opengl-hq] [ 9] color.rgb = texture3D(lut_3d, color.rgb).rgb;
[vo/opengl-hq/x11] Enabling screensaver.
[vo/opengl-hq/x11] Disabling screensaver.
[osd/libass] Shaper: FriBidi 0.19.6 (SIMPLE) HarfBuzz-ng 1.1.3 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[osd/libass] fontselect: (Joystix, 400, 0) -> /usr/share/fonts/truetype/joystix.ttf, 0, Joystix
[osd/libass] Glyph 0xBCF5 not found, selecting one more font for (Joystix, 400, 0)
[osd/libass] fontselect: (Joystix, 400, 0) -> /usr/share/fonts/truetype/NotoSansCJK.ttc, 8, NotoSansCJKjp-DemiLight
[mkv] Seeking to 7774890324 to read header element 0x1c53bb6b.
[cache] Dropping cache at pos 7774890324, cached range: 388139-98461349.
[cache] Seeking underlying stream: 98461349 -> 7774890324
[mkv] Parsing cues...
[sub/ass] Shaper: FriBidi 0.19.6 (SIMPLE) HarfBuzz-ng 1.1.3 (COMPLEX)
[sub/ass] Setting up fonts...
[cache] Dropping cache at pos 388139, cached range: 7774890324-7775004126.
[cache] Seeking underlying stream: 7775004126 -> 388139
[sub/ass] Using font provider fontconfig
[sub/ass] Done.
[sub/ass] fontselect: (Noto Sans, 700, 0) -> /usr/share/fonts/truetype/NotoSans-Bold.ttf, 0, NotoSans-Bold
…

mpv build log:

…
[   46s] [389/435] cumulate libass5-0.13.2-1.1
…
[   47s] [411/435] cumulate libass-devel-0.13.2-1.1
…
[   96s] + CCFLAGS='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables'
[   96s] + ./waf configure --prefix=/usr --bindir=/usr/bin --mandir=/usr/share/man --libdir=/usr/lib64 --docdir=/usr/share/doc/packages/mpv --confdir=/etc/mpv --enable-openal --enable-cdda --enable-libmpv-shared --enable-zsh-comp --enable-manpage-build --enable-pdf-build --disable-sdl1 --disable-sdl2 --disable-build-date --disable-debug --enable-gpl3
[   96s] Setting top to                           : /home/abuild/rpmbuild/BUILD/mpv-0.16.0 
[   96s] Setting out to                           : /home/abuild/rpmbuild/BUILD/mpv-0.16.0/build 
[   96s] Checking for waf version in 1.8.4-1.9.0  : ok 
[   96s] Checking for program 'cc'                : /usr/bin/cc 
[   96s] Checking for program 'pkg-config'        : /usr/bin/pkg-config 
[   96s] Checking for program 'ar'                : /usr/bin/ar 
[   96s] Checking for program 'perl'              : /usr/bin/perl 
[   96s] Checking for program 'rst2html'          : /usr/bin/rst2html 
[   96s] Checking for program 'rst2man'           : /usr/bin/rst2man 
[   96s] Checking for program 'rst2pdf'           : /usr/bin/rst2pdf 
[   96s] Checking for program 'windres'           : not found 
[   96s] Checking for 'gcc' (C compiler)          : /usr/bin/cc 
[   97s] Detected target OS:                      : os-linux 
[   97s] Checking for compiler flags -Werror=implicit-function-declaration : yes 
[   97s] Checking for compiler flags -Wno-error=deprecated-declarations    : yes 
[   97s] Checking for compiler flags -Wno-error=unused-function            : yes 
[   97s] Checking for compiler flags -Wempty-body                          : yes 
[   97s] Checking for compiler flags -Wdisabled-optimization               : yes 
[   97s] Checking for compiler flags -Wstrict-prototypes                   : yes 
[   97s] Checking for compiler flags -Wno-format-zero-length               : yes 
[   97s] Checking for compiler flags -Werror=format-security               : yes 
[   97s] Checking for compiler flags -Wno-redundant-decls                  : yes 
[   97s] Checking for GPL3 license                                         : yes 
[   97s] Checking for mpv CLI player                                       : yes 
[   97s] Checking for shared library                                       : yes 
[   97s] Checking for static library                                       : disabled 
[   97s] Checking for static build                                         : disabled 
[   97s] Checking for whether to include binary compile time               : disabled 
[   97s] Checking for whether to optimize                                  : yes 
[   97s] Checking for whether to compile-in debugging information          : disabled 
[   97s] Checking for manpage generation                                   : yes 
[   97s] Checking for html manual generation                               : disabled 
[   97s] Checking for pdf manual generation                                : yes 
[   98s] Checking for dynamic loader                                       : yes 
[   98s] Checking for dlopen                                               : yes 
[   98s] Checking for compilation of default filters for vf_dlopen         : disabled 
[   98s] Checking for zsh completion                                       : yes 
[   98s] Checking for inline assembly (currently without effect)           : yes 
[   98s] Checking for test suite (using cmocka)                            : disabled 
[   98s] Checking for generate a clang compilation database                : disabled 
[   98s] Checking for compiler support for noexecstack                     : yes 
[   98s] Checking for linker support for --nxcompat --no-seh --dynamicbase : no 
[   98s] Checking for -lm                                                  : yes 
[   98s] Checking for MinGW                                                : os-win32 not found 
[   98s] Checking for POSIX environment                                    : yes 
[   98s] Checking for development environment                              : yes 
[   98s] Checking for win32                                                : not found any of os-win32, os-cygwin 
[   98s] Checking for internal pthread wrapper for win32 (Vista+)          : win32 not found 
[   99s] Checking for POSIX threads                                        : yes 
[   99s] Checking for stdatomic.h                                          : yes 
[   99s] Checking for compiler support for __atomic built-ins              : stdatomic found 
[   99s] Checking for compiler support for __sync built-ins                : stdatomic found 
[   99s] Checking for compiler support for usable thread synchronization built-ins : yes 
[   99s] Checking for C11 TLS support                                              : yes 
[   99s] Checking for linking with -lrt                                            : yes 
[   99s] Checking for iconv                                                        : yes 
[   99s] Checking for w32/dos paths                                                : not found any of os-win32, os-cygwin 
[   99s] Checking for termios                                                      : yes 
[   99s] Checking for shm                                                          : yes 
[   99s] Checking for nanosleep                                                    : yes 
[   99s] Checking for POSIX spawnp()/kill()                                        : yes 
[   99s] Checking for posix_spawnp() or MinGW                                      : yes 
[  100s] Checking for glob()                                                       : yes 
[  100s] Checking for glob() win32 replacement                                     : not found any of os-win32, os-cygwin 
[  100s] Checking for fchmod()                                                     : yes 
[  100s] Checking for vt.h                                                         : yes 
[  100s] Checking for gbm.h                                                        : no 
[  100s] Checking for GLIBC API for setting thread name                            : yes 
[  100s] Checking for OSX API for setting thread name                              : glibc-thread-name found 
[  100s] Checking for BSD API for setting thread name                              : glibc-thread-name found 
[  100s] Checking for NetBSD API for setting thread name                           : glibc-thread-name found 
[  100s] Checking for BSD's fstatfs()                                              : no 
[  100s] Checking for Linux's fstatfs()                                            : yes 
[  100s] Checking for Samba support                                                : yes 
[  100s] Checking for Lua                                                          : yes (version found: luajit) 
[  100s] Checking for SSA/ASS support                                              : yes 
[  100s] Checking for libass OSD support                                           : yes 
[  100s] Checking for dummy OSD support                                            : libass-osd found 
[  101s] Checking for zlib                                                         : yes 
[  101s] Checking for Encoding                                                     : yes 
[  101s] Checking for Bluray support                                               : yes 
[  101s] Checking for dvdread support                                              : yes 
[  101s] Checking for dvdnav support                                               : yes 
[  101s] Checking for cdda support (libcdio)                                       : yes 
[  101s] Checking for ENCA support                                                 : yes 
[  101s] Checking for libguess support                                             : yes 
[  101s] Checking for uchardet support                                             : no ('uchardet' not found) 
[  101s] Checking for librubberband support                                        : no ('rubberband >= 1.8.0' not found) 
[  101s] Checking for LCMS2 support                                                : yes 
[  101s] Checking for VapourSynth filter bridge (Python)                           : yes 
[  101s] Checking for VapourSynth filter bridge (Lazy Lua)                         : yes 
[  101s] Checking for VapourSynth filter bridge (core)                             : yes 
[  101s] Checking for libarchive wrapper for reading zip files and more            : disabled 
[  101s] Checking for SDL2                                                         : disabled 
[  101s] Checking for SDL (1.x)                                                    : disabled 
[  101s] Checking for OSS (implementation from opensound.com)                      : no 
[  101s] Checking for OSS (platform-specific OSS implementation)                   : yes 
[  101s] Checking for OSS (emulation on top of SunAudio)                           : oss-audio-native found 
[  101s] Checking for OSS audio output                                             : yes 
[  101s] Checking for RSound audio output                                          : no 
[  101s] Checking for sndio audio input/output                                     : disabled 
[  101s] Checking for PulseAudio audio output                                      : yes 
[  101s] Checking for JACK audio output                                            : yes 
[  101s] Checking for OpenAL audio output                                          : yes 
[  101s] Checking for OpenSL ES audio output                                       : no 
[  101s] Checking for ALSA audio output                                            : yes 
[  101s] Checking for CoreAudio audio output                                       : no 
[  101s] Checking for WASAPI audio output                                          : win32 not found 
[  101s] Checking for Cocoa                                                        : no 
[  101s] Checking for DRM                                                          : yes 
[  101s] Checking for GBM                                                          : gbm.h not found 
[  101s] Checking for Wayland                                                      : yes 
[  101s] Checking for X11                                                          : yes 
[  101s] Checking for Xss screensaver extensions                                   : yes 
[  101s] Checking for X extensions                                                 : yes 
[  101s] Checking for Xv video output                                              : yes 
[  101s] Checking for Xinerama                                                     : yes 
[  101s] Checking for Xrandr                                                       : yes 
[  101s] Checking for OpenGL Cocoa Backend                                         : cocoa not found 
[  102s] Checking for OpenGL X11 Backend                                           : yes 
[  102s] Checking for OpenGL X11 EGL Backend                                       : yes 
[  102s] Checking for OpenGL DRM EGL Backend                                       : gbm not found 
[  102s] Checking for OpenGL Wayland Backend                                       : yes 
[  102s] Checking for OpenGL Win32 Backend                                         : win32 not found 
[  102s] Checking for OpenGL/DirectX Interop Backend                               : gl-win32 not found 
[  102s] Checking for OpenGL Win32 ANGLE Backend                                   : not found any of os-win32, os-cygwin 
[  102s] Checking for VDPAU acceleration                                           : yes 
[  102s] Checking for VDPAU with OpenGL/X11                                        : yes 
[  102s] Checking for VAAPI acceleration                                           : yes 
[  102s] Checking for VAAPI (X11 support)                                          : yes 
[  102s] Checking for VAAPI (Wayland support)                                      : yes 
[  102s] Checking for VAAPI (DRM/EGL support)                                      : egl-drm not found 
[  102s] Checking for VAAPI GLX                                                    : yes 
[  102s] Checking for VAAPI EGL on X11                                             : yes 
[  102s] Checking for VAAPI EGL                                                    : yes 
[  102s] Checking for CACA                                                         : yes 
[  102s] Checking for JPEG support                                                 : yes 
[  102s] Checking for Direct3D support                                             : win32 not found 
[  102s] Checking for Android support                                              : no 
[  102s] Checking for Raspberry Pi support                                         : no 
[  103s] Checking for Desktop OpengGL support                                      : yes 
[  103s] Checking for Android OpenGL ES support                                    : android not found 
[  103s] Checking for Any OpenGL (ES) support                                      : yes 
[  103s] Checking for OpenGL without platform-specific code (e.g. for libmpv)      : yes 
[  103s] Checking for OpenGL video outputs                                         : yes 
[  103s] Checking for EGL helper functions                                         : yes 
[  103s] Checking for libav/ffmpeg                                                 : yes 
[  103s] Checking for libswresample                                                : yes 
[  103s] Checking for libavresample                                                : libswresample found 
[  103s] Checking for usable resampler found                                       : yes 
[  103s] Checking for libavfilter                                                  : yes 
[  103s] Checking for libavdevice                                                  : yes 
[  103s] Checking for libavcodec avcodec_enum_to_chroma_pos API                    : yes 
[  103s] Checking for libavutil AVFrame metadata                                   : yes 
[  103s] Checking for libavutil AVFrame skip samples metadata                      : yes 
[  103s] Checking for libavutil AV_PIX_FMT_MMAL                                    : yes 
[  104s] Checking for libavtuil av_version_info()                                  : yes 
[  104s] Checking for libavutil new pixdesc fields                                 : no 
[  104s] Checking for libavcodec 64 bit AVPacket.duration                          : no 
[  104s] Checking for libavcodec AVSubtitleRect AVPicture removal                  : no 
[  104s] Checking for libavcodec avcodec_profile_name()                            : no 
[  104s] Checking for libavcodec VAAPI hwaccel                                     : yes 
[  104s] Checking for libavcodec videotoolbox hwaccel                              : no 
[  104s] Checking for Videotoolbox with OpenGL                                     : videotoolbox-hwaccel, gl-cocoa not found 
[  105s] Checking for libavcodec VDPAU hwaccel                                     : yes 
[  105s] Checking for libavcodec DXVA2 hwaccel                                     : win32 not found 
[  105s] Checking for GCC SSE4 intrinsics for GPU memcpy                           : yes 
[  105s] Checking for TV interface                                                 : yes 
[  105s] Checking for videoio.h                                                    : no 
[  105s] Checking for videodev2.h                                                  : yes 
[  105s] Checking for Video4Linux2 TV interface                                    : yes 
[  105s] Checking for libv4l2 support                                              : yes 
[  105s] Checking for audio input support                                          : yes 
[  105s] Checking for DVB input module                                             : yes 
[  105s] Checking for w32 executable                                               : not found any of os-win32, os-cygwin 
[  105s] Checking for Apple Remote support                                         : cocoa not found 
[  105s] Writing configuration header:                                             : config.h 
[  105s] 'configure' finished successfully (8.599s)
…
Akemi commented 4 years ago

stale and was brought up upstream