V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
IgniteWhite
V2EX  ›  macOS

求解 mpv 播放网页视频问题

  •  
  •   IgniteWhite · 2016-02-13 17:42:35 +08:00 · 4454 次点击
    这是一个创建于 3213 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用 mpv 播放网页视频。在终端输入:
    mpv www...(网址)

    可以正常播放,但是有以下警告:
    Option icc-cache was removed: see icc-cache-dir
    Error parsing option icc-cache (option not found)
    Option vo: Error while parsing opengl-hq parameter icc-cache (~/.config/mpv/tmp/icc-cache)

    看起来是语法解析问题,但是我的配置文件中并没有写 icc-cache 这个选项(手册里并没有这个选项,只有指定 icc-profile 的选项,通过缓存来加速播放)。于是我大概无法启用 icc 这个功能……怎样消除这个问题?

    我的 mpv.conf 如下:
    # Video
    vo=opengl-hq:interpolation:icc-profile-auto
    video-sync=display-resample
    hwdec=auto
    display-fps=60

    # force starting with centered window
    geometry=50%:50%

    # don't allow a new window to have a size larger than 90% of the screen size
    autofit-larger=90%x90%
    autofit-smaller=30%x30%

    # Volume
    volume=100
    af=drc

    # OSD
    osd-bar-h=2.8
    osd-border-size=2
    osd-color='#CCFFFFFF'
    osd-border-color='#99000000'
    osd-duration=2000
    osd-font='STZhongsong'
    osd-font-size=28

    # Screenshots file name
    screenshot-template=~/Desktop/mpv-screenshot-%n

    # Save the current playback position on quit and resume on next run.
    save-position-on-quit

    # load config file from file directory, useful for overriding ass styles for entire series
    use-filedir-conf=yes

    # Subtitles
    sub-auto=fuzzy
    sub-text-font-size=32
    sub-text-font='STZhongsong'

    # Languages
    alang=en,eng,zh,cmn,chi,zho
    slang=cmn,chi,zho,zh,eng,en

    # Change subtitle encoding.
    # For Arabic subtitles use 'cp1256'.
    # For Chinese subtitles use 'gb2312'.
    # For Western Europe(including German) subtitles use 'iso8859'.
    # If the file seems to be valid UTF-8, prefer UTF-8.
    sub-codepage=utf8:gb2312
    7 条回复    2016-02-14 21:56:37 +08:00
    IgniteWhite
        1
    IgniteWhite  
    OP
       2016-02-13 23:17:18 +08:00
    也不是什么问题了……分享我注释过的配置,这是 mpv.conf :
    # You can also write file-specific configuration files
    # You can also put the configuration file in the same directory as the file to be played
    # Both require you to set the --use-filedir-conf option (either on the command line or in your global config file)
    use-filedir-conf=yes
    # If a file-specific configuration file is found in the same directory,
    # no file-specific configuration is loaded from ~/.config/mpv.
    # In addition, the --use-filedir-conf option enables directory-specific configuration files.
    # For this, mpv first tries to load a mpv.conf from the same directory as the file played
    # and then tries to load any file-specific configuration.

    # Track Selection
    # Specify a priority list of audio languages to use
    alang=en,eng,zh,cmn,chi,zho
    # Specify a priority list of subtitle languages to use
    slang=cmn,chi,zho,zh,eng,en

    # Program Behavior
    # Always save the current playback position on quit
    save-position-on-quit

    # Video
    # Specify a priority list of video output drivers to be used
    vo=opengl-hq:interpolation:icc-profile-auto
    # Set the display FPS used with the --video-sync=display-* modes
    display-fps=60
    # Specify the hardware video decoding API that should be used if possible
    hwdec=auto

    # Audio
    # Specify a list of audio filters to apply to the audio stream
    af=drc
    # Set the startup volume
    # 0 means silence, 100 means no volume reduction or amplification
    # A value of -1 (the default) will not change the volume
    volume=100

    # Subtitles
    # If your system supports iconv(3), you can use this option to specify the subtitle codepage
    # For Arabic subtitles use 'cp1256'.
    # For Chinese subtitles use 'gb2312'.
    # For Western Europe(including German) subtitles use 'iso8859'.
    # If the file seems to be valid UTF-8, prefer UTF-8.
    sub-codepage=utf8:gb2312
    # Load additional subtitle files matching the video filename
    sub-auto=fuzzy

    # Window
    # Play video with window border and decorations
    # Since this is on by default, use --no-border to disable the standard window decorations
    border
    # Adjust the initial window position or size
    # If a percentage sign (%) is given after the argument, it turns the value into a percentage of the screen size in that direction
    geometry=50%:50%
    # Set the initial window size
    # This option behaves exactly like --autofit,
    # except the window size is only changed if the window would be larger than the specified size
    autofit-larger=90%x90%
    # This option behaves exactly like --autofit,
    # except that it sets the minimum size of the window (just as --autofit-larger sets the maximum)
    autofit-smaller=30%x30%

    # OSD, On Screen Display
    # Set the duration of the OSD messages in ms (default: 1000)
    osd-duration=2000
    # Specify font to use for OSD and for subtitles that do not themselves specify a particular font
    # The default is sans-serif
    osd-font='STZhongsong'
    sub-text-font='STZhongsong'
    # Specify the OSD/sub font size
    # The unit is the size in scaled pixels at a window height of 720
    osd-font-size=28
    sub-text-font-size=32
    # Height of the OSD bar, in percentage of the screen height (default: 3.125)
    osd-bar-h=2.8
    # See --osd-color. Color used for the OSD/sub font border
    osd-border-color='#99000000'
    # Size of the OSD/sub font border in scaled pixels (see --osd-font-size for details)
    osd-border-size=2
    sub-text-border-size=3
    # Specify the color used for OSD
    osd-color='#CCFFFFFF'

    # Screenshot
    # Specify the filename template used to save screenshots
    screenshot-template=~/Pictures/mpv/%F_%p

    # Miscellaneous
    # How the player synchronizes audio and video
    video-sync=display-resample
    IgniteWhite
        2
    IgniteWhite  
    OP
       2016-02-13 23:18:29 +08:00
    这是 lua-settings/osc.conf :
    # When to enable the OSC
    showwindowed=yes
    showfullscreen=yes

    # OSC scale
    scalewindowed=2
    scalefullscreen=1

    # Scale the OSC with the video
    # no tries to keep the OSC size constant as much as the window size allows
    vidscale=yes

    # Duration in ms until the OSC hides if no mouse movement, negative value disables auto-hide
    hidetimeout=500

    # Duration of fade out in ms, 0 = no fade
    fadeduration=200

    # Size of the deadzone. Values between 0 and 1
    deadzonesize=1

    # The layout for the OSC. Currently available are: box, slimbox, bottombar and topbar
    layout=topbar

    # Sets the style of the seekbar, slider (diamond marker) or bar (fill)
    seekbarstyle=bar
    IgniteWhite
        3
    IgniteWhite  
    OP
       2016-02-13 23:20:30 +08:00
    为了看带德语的字幕(比如《国土安全》最新季),我在 codepage 里加了 iso8859 ,但是会使得中文乱码。各位知道如何解决吗?
    squid157
        4
    squid157  
       2016-02-14 19:51:09 +08:00
    @IgniteWhite 你把那个调整成 sub-codepage=utf8:gb2312:iso8859 和 sub-codepage=utf8:iso8859:gb2312 都不行?
    IgniteWhite
        5
    IgniteWhite  
    OP
       2016-02-14 20:52:30 +08:00
    @squid157 我大概是在两个月前,用打包好的 mpv 看的,遇到的问题是无论怎么写配置文件,中文德文必有一者不能显示。前两天换成了 Homebrew 编译版,我刚刚看了一下,写成 sub-codepage=gb2312 就好了,中文没问题,德文üß之类的字母也可以显示。

    看了一下文档,里面说:
    By default, uchardet will be used to guess the charset. If mpv is not compiled with uchardet, enca will be used. If mpv is compiled with neither uchardet nor enca, UTF-8:UTF-8-BROKEN is the default, which means it will try to use UTF-8, otherwise the UTF-8-BROKEN pseudo codepage.

    看来 Homebrew 编译版本应该是有 uchardet 或者 enca 的。但是要正确显示中文 srt 字幕,必须标明 gb2312 。
    squid157
        6
    squid157  
       2016-02-14 21:49:51 +08:00 via iPhone
    @IgniteWhite 那个不是按顺序猜?

    感谢你的配置文件 我把 OSD 和 OSC 调整了一番
    IgniteWhite
        7
    IgniteWhite  
    OP
       2016-02-14 21:56:37 +08:00   ❤️ 1
    @squid157 好像是按照顺序的……我没了解 enca 是什么东西。配置文件的注释是我从文档里抄来的,顺序也和文档一样,方便改动~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2642 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:05 · PVG 15:05 · LAX 23:05 · JFK 02:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.