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

mpv + you-get 是在线看视频的神器

  •  
  •   83f420984 · 2015-12-29 18:27:51 +08:00 · 37876 次点击
    这是一个创建于 3012 天前的主题,其中的信息可能已经有所发展或是发生改变。
    话不多说,直接上图





    国内视频网站支持比较完整,基本满足了我在线看的需求,而且看到喜欢的还能直接下载,最主要的是不发热啊.... :-)
    第 1 条附言  ·  2015-12-30 11:03:37 +08:00
    安装教程:
    mpv : http://songchenwen.com/tech/2015/05/09/mpv-player/

    you-get : https://you-get.org/

    简单说下用法:

    mpv http://www.douyutv.com/56040

    这种情况下是直接调用的 youtube-dl 来观看在线视频(这个是在使用 brew 安装 mpv 时就已经安装好了)

    you-get -p mpv http://www.bilibili.com/video/av3458634/

    这种情况是调用 you-get 来观看在线视频
    52 条回复    2019-01-10 11:40:10 +08:00
    lotux
        1
    lotux  
       2015-12-29 18:45:54 +08:00 via iPad
    不知道为啥,我的 mpv 一直闪退,不论是官方编译好的安装包,还是自己 brew install 的,随便播一个 mp4 文件一分钟之内都闪退…
    而且原版 mpv 界面略简陋,暂停按钮播放按钮都好大,长宽比例失调…貌似还不是 Retina …
    不知道是不是我打开方式有问题…😂
    Owenjia
        2
    Owenjia  
       2015-12-29 19:27:38 +08:00 via Android
    mpv 编译的时候如果开了 lua 参数是会自动调用 youtube-dl (如果装了)的。
    Tink
        3
    Tink  
       2015-12-29 19:44:49 +08:00
    我是自己写了个脚本 you-get 下完之后用 ffmpeg 转成 mp4 然后在浏览器里看,也并不发热,而且手机也能看
    83f420984
        4
    83f420984  
    OP
       2015-12-29 20:03:04 +08:00
    @Tink cool :-)
    miniers
        5
    miniers  
       2015-12-29 20:17:29 +08:00
    好东西,又 get 到新玩意了
    mhqschen
        6
    mhqschen  
       2015-12-29 20:35:31 +08:00
    哈哈给这歌点赞~
    ivanchou
        7
    ivanchou  
       2015-12-29 20:40:33 +08:00 via Android
    前几天为了下载优酷视频知道了 you-get 原来还可以有这种玩法~
    TheCure
        8
    TheCure  
       2015-12-29 20:43:08 +08:00 via Android
    少女时代。。。
    Owenjia
        9
    Owenjia  
       2015-12-29 21:00:04 +08:00
    @Owenjia 手机上没看清图,忽略掉这条回复吧……
    binux
        10
    binux  
       2015-12-29 21:11:51 +08:00
    斗鱼无效, 秘钥改了
    83f420984
        11
    83f420984  
    OP
       2015-12-29 21:31:21 +08:00
    @binux 在使用 brew 安装 mpv 时,会自动安装 youtube-dl ,目前 youtube-dl 可在线斗看鱼视频,我是在 youtube-dl 与 you-get 之间切换使用的
    tuimaochang
        12
    tuimaochang  
       2015-12-29 21:46:41 +08:00
    厉害
    binux
        13
    binux  
       2015-12-29 21:50:37 +08:00
    @83f420984 youtube-dl http://www.douyu.com/58428 2 ↵
    [generic] 58428: Requesting header
    WARNING: Falling back on generic information extractor.
    [generic] 58428: Downloading webpage
    [generic] 58428: Extracting information
    ERROR: Unsupported URL: http://www.douyu.com/58428
    USCONAN
        14
    USCONAN  
       2015-12-29 21:53:47 +08:00
    @binux douyu.com 的影片只要直接 mpv http://www.douyu.com/xxxxx 就可以啦。。。
    binux
        15
    binux  
       2015-12-29 21:55:00 +08:00
    @USCONAN youtube-dl 都不支持,直接 mpv 当然直接
    Playing: http://www.douyu.com/58428
    [ytdl_hook] ERROR: Unsupported URL: http://www.douyu.com/58428
    [ytdl_hook] youtube-dl failed, trying to play URL directly ...
    Failed to recognize file format.
    binux
        16
    binux  
       2015-12-29 21:57:50 +08:00
    @USCONAN 而且 you-get 和 youtube-dl 用的 KEY 是一样的
    USCONAN
        17
    USCONAN  
       2015-12-29 22:02:46 +08:00
    @binux ! WHAT ?

    我這沒問題啊。。。

    mpv http://www.douyutv.com/338769
    Playing: http://www.douyutv.com/338769
    (+) Video --vid=1 (h264)
    (+) Audio --aid=1 (aac)
    Using hardware decoding (videotoolbox).
    VO: [opengl-hq] 1280x720 videotoolbox
    AO: [coreaudio] 44100Hz stereo 2ch floatp
    (Paused) AV: 00:00:00 A-V: 0.000 Cache: 3s+0KB
    [+-------------------------------------------------------------------------------------------------]
    yangff
        18
    yangff  
       2015-12-29 22:16:48 +08:00
    @binux 你版本低了吧
    binux
        19
    binux  
       2015-12-29 22:44:38 +08:00
    @yangff 我知道为什么了, 我都是用 douyu.com 的, 而它只支持 douyutv.com
    lululau
        20
    lululau  
       2015-12-29 23:22:41 +08:00
    大赞
    ahu
        21
    ahu  
       2015-12-30 10:29:36 +08:00
    @83f420984 请教如何使用 mpv 我在 mac 下载了 64-bit binary (by ChrisK) [OS X 10.8+]版,解压缩后得到一个 mpv.app 然后要如何使用呢?
    ahu
        22
    ahu  
       2015-12-30 10:33:07 +08:00
    @83f420984 额,补充一句,我意思是说像你一样在命令符下使用
    83f420984
        23
    83f420984  
    OP
       2015-12-30 10:59:20 +08:00
    @ahu 忘记了说,在 OS X 如果直接下载打包好的版本是没有办法使用这些功能的,只能使用 brew mpv 安装才行。
    贴个安装 mpv 的教程: http://songchenwen.com/tech/2015/05/09/mpv-player/
    ahu
        24
    ahu  
       2015-12-30 13:04:51 +08:00
    @83f420984 感谢,我研究研究
    cyberdaemon
        25
    cyberdaemon  
       2015-12-31 11:07:36 +08:00
    话说这个到底有毛用?就是为了不用 safari 看视频吗????我装过一个 B 站的客户端,可以通过 quicktime 打开在线视频资源后 airplay 至 apple tv ,在这个情况下,我就放弃了 safari ,当然用客户端的话一点都不热,所以这个东西能 airplay 吗?
    salary123
        26
    salary123  
       2016-01-02 14:29:05 +08:00
    小白,看不懂,这是什么东西啊。
    myth
        27
    myth  
       2016-01-04 09:33:56 +08:00
    试了下,的确不错,就是不大方便,有什么基于 you-get 的可以方便看视频的插件或者软件吗? 不用每次都到命令行去粘贴 url
    pinkman
        28
    pinkman  
       2016-01-12 21:05:02 +08:00
    请问楼主,我用 mpv http://www.douyutv.com/56040 命令调出 mpv 看视频,播放完毕后缓存会自动被删除吗?可以将缓存的视频文件保存下来吗
    coolzilj
        29
    coolzilj  
       2016-01-13 03:12:25 +08:00   ❤️ 1
    Ken_Adams
        30
    Ken_Adams  
       2016-01-13 11:15:13 +08:00   ❤️ 3
    @myth
    我是这么办的:
    用 iTerm 2 新建一个 Profile ,分配一个快捷键 Y ,在 Command 一栏写 you-get -p mpv `pbpaste`



    复制 URL 之后到 iTerm 2 按快捷键 Ctrl + Cmd + Y 就可以直接播放了。
    myth
        31
    myth  
       2016-01-13 11:49:40 +08:00
    @coolzilj
    @Ken_Adams

    我后来也弄了简单的系统托盘程序通过监听系统剪切板来调用 you-get 播放视频

    ```python
    import sys
    import subprocess
    import urllib.request

    from PyQt4 import QtGui


    class YouGetPlay(QtGui.QWidget):

    def __init__(self, parent):
    super(YouGetPlay, self).__init__(parent)

    self.tray = QtGui.QSystemTrayIcon(QtGui.QIcon('icon.png'), self)
    self.menu = QtGui.QMenu(self)

    exitAction = QtGui.QAction(
    "E&xit", self, shortcut="Ctrl+Q",
    statusTip="Exit the application", triggered=self.close)

    self.enableAction = QtGui.QAction(
    "&Enable", self, shortcut='Ctrl+E',
    statusTip='Enable monitor the clipboard', checkable=True)

    self.enableAction.setChecked(True)

    self.menu.addAction(self.enableAction)
    self.menu.addAction(exitAction)

    self.tray.setContextMenu(self.menu)
    self.tray.setToolTip('you-get play')

    def play(self, url):
    p = subprocess.Popen(['you-get', '-p', 'mpv', url])
    p.wait()

    def onClipChanged(self):
    if(QtGui.QApplication.clipboard().mimeData().hasText()):
    text = QtGui.QApplication.clipboard().text()
    print(text)
    if self.enableAction.isChecked():
    try:
    urllib.request.urlopen(text)
    print('Playing ... ')
    if QtGui.QSystemTrayIcon.supportsMessages():
    self.tray.showMessage('Now Playing ...', text)
    self.play(text)
    print('End')
    except Exception as e:
    print(e)

    if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    frame = YouGetPlay(None)
    frame.tray.show()
    app.clipboard().dataChanged.connect(frame.onClipChanged)
    sys.exit(app.exec_())
    ```
    coolzilj
        32
    coolzilj  
       2016-01-13 11:55:19 +08:00
    @Ken_Adams
    @myth
    哈哈,都是懒人,又学到了新姿势
    myth
        33
    myth  
       2016-01-13 12:39:27 +08:00
    代码显示太难看了,贴个链接吧:
    https://github.com/xmyth/you_get_play/blob/master/you_get_play.py

    (话说现在回复的时候可以支持格式化代码吗?)
    abao00001
        34
    abao00001  
       2016-03-27 08:41:00 +08:00
    能不能看百度云的视频呢?
    abao00001
        35
    abao00001  
       2016-03-27 08:46:57 +08:00
    @myth 不太明白,这个怎么使用呢?粘贴到 you-get 文件夹里吗?
    myth
        36
    myth  
       2016-03-28 09:34:23 +08:00
    @abao00001

    1. 安装 you-get 和 mpv , 并将这两个程序的运行路径都加到系统或者用户 path 中
    2. 运行 python you_get_play.py
    3. 然后 copy 你想要看到的视频的链接就会自动调用 you-get -p mpv <URL>播放
    abao00001
        37
    abao00001  
       2016-03-28 20:24:05 +08:00 via iPhone
    @myth 看其他网站视频没有问题,可是粘贴百度云视频无法看。是不支持百度云视频吗?
    abao00001
        38
    abao00001  
       2016-03-28 20:35:47 +08:00 via iPhone
    @myth 懒人一枚,表示非常感谢。
    myth
        39
    myth  
       2016-03-29 09:06:54 +08:00
    @abao00001 具体支持哪些网站,请查看 you-get 项目, https://github.com/soimort/you-get/#supported-sites
    abao00001
        40
    abao00001  
       2016-03-30 01:45:22 +08:00
    @myth 感谢,已经配置好,看电影很爽。
    zhanglistar
        41
    zhanglistar  
       2016-09-29 13:47:57 +08:00
    百度云上的视频可以看吗?用 mpv 或者 you-get
    dotpig
        42
    dotpig  
       2016-10-26 10:48:38 +08:00
    @Ken_Adams 我直接 Alfred 设置快捷键 workflow ,也很方便:

    Mana
        43
    Mana  
       2016-11-30 12:16:46 +08:00
    @dotpig 这个是怎么弄的
    MrJiren
        44
    MrJiren  
       2016-12-13 19:33:39 +08:00
    如果想看 youtube 视频需要设置一下代理吗?
    exxfzc
        45
    exxfzc  
       2017-06-10 01:51:18 +08:00
    @dotpig 大神,你这个是怎样弄的?
    dotpig
        46
    dotpig  
       2017-06-10 10:43:30 +08:00
    @exxfzc 就是个简单的 Workflow,用终端命令开启 mpv,并把剪贴板上的的视频地址传递给 mpv。
    exxfzc
        47
    exxfzc  
       2017-06-10 20:50:46 +08:00
    @dotpig 求 work flow,[email protected]
    exxfzc
        48
    exxfzc  
       2017-06-10 20:51:35 +08:00
    另外,mpv 今天突然播放视频没有声音了,是怎么回事呀!!!!昨天卸载了 mplayerx,不会跟这有关系吧!!!
    exxfzc
        49
    exxfzc  
       2017-06-10 22:26:21 +08:00
    Last login: Sat Jun 10 22:03:26 on ttys000
    zilingdeMacBook-Pro:~ ziling$
    ?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2
    [1] 1778
    -bash:
    ?spm=a2h0k.8191407.0.0: No such file or directory
    zilingdeMacBook-Pro:~ ziling$ mpv
    ?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2
    [2] 1785
    [1] Exit 127
    ?spm=a2h0k.8191407.0.0
    zilingdeMacBook-Pro:~ ziling$ Resuming playback. This behavior can be disabled with --no-resume-playback.
    Loading config '/Users/ziling/.config/mpv/watch_later/280E44D0459B8AE48F29A468B7F57361'
    Playing:
    ?spm=a2h0k.8191407.0.0
    [markfinished] Not have tag 1 nil
    (+) Video --vid=1 (h264)
    (+) Audio --aid=1 (aac)
    [drc] libavfilter filter 'drc' not found!
    Couldn't create or open audio filter 'drc'
    Error at audio filter chain pre-init!
    Audio: no audio
    failed to init videotoolbox decoder: Hardware doesn't support accelerated decoding for this stream or Videotoolbox decoder is not available at the moment (another application is using it). (-78)
    VO: [opengl] 512x288 yuv420p
    [ffmpeg] NULL: missing picture in access unit with size 2760

    看不懂
    dotpig
        50
    dotpig  
       2017-06-12 17:48:58 +08:00
    @exxfzc 给你 Workflow 也没用啊,每个安装情况不一样啊。我用的终端是 iTerm,下面是脚本:

    on alfred_script(q)
    if application "iTerm" is running or application "iTerm" is running then
    run script "
    on run {q}
    tell application \":Applications:iTerm.app\"
    activate
    try
    select first window
    set onlywindow to false
    on error
    create window with default profile
    select first window
    set onlywindow to true
    end try
    tell the first window
    tell current session to write text \"mpv \" & q
    end tell
    end tell
    end run
    " with parameters {q}
    else
    run script "
    on run {q}
    tell application \":Applications:iTerm.app\"
    activate
    try
    select first window
    on error
    create window with default profile
    select first window
    end try
    tell the first window
    tell current session to write text \"mpv \" & q
    end tell
    end tell
    end run
    " with parameters {q}
    end if
    end alfred_script

    自己弄一个 workflow 吧,设置个快捷键,读取剪贴板内容。
    exxfzc
        51
    exxfzc  
       2017-06-12 23:47:47 +08:00
    @dotpig 有点深奥,得慢慢研究研究
    corsair
        52
    corsair  
       2019-01-10 11:40:10 +08:00
    为啥我的用 you-get 不能播放,默认的 youtube-dl 才可以播放
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1386 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:40 · PVG 07:40 · LAX 16:40 · JFK 19:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.