emacs-eaf / emacs-application-framework

EAF, an extensible framework that revolutionizes the graphical capabilities of Emacs
GNU General Public License v3.0
3.06k stars 231 forks source link

EAF open video only has sound #243

Closed stardiviner closed 4 years ago

stardiviner commented 4 years ago

I use command eaf-open to open a .mp4 video file.

It only has sound. And EAF does not automatically switch to the video file name buffer. Still on current buffer. Then I toggled eaf debug option eaf-enable-debug. Here is the *eaf* buffer log:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe60fa700 (LWP 27090)]
[New Thread 0x7fffdffff700 (LWP 27091)]
[New Thread 0x7fffdf66e700 (LWP 27092)]
[New Thread 0x7fffdecdd700 (LWP 27093)]
[New Thread 0x7fffde34c700 (LWP 27094)]
EAF process starting...
[New Thread 0x7fffcffff700 (LWP 27095)]
[New Thread 0x7fffce161700 (LWP 27096)]
[Thread 0x7fffce161700 (LWP 27096) exited]
[New Thread 0x7fffce161700 (LWP 27097)]
[Thread 0x7fffce161700 (LWP 27097) exited]
[New Thread 0x7fffce161700 (LWP 27098)]
[Thread 0x7fffce161700 (LWP 27098) exited]
[New Thread 0x7fffce161700 (LWP 27099)]
[New Thread 0x7fffcd772700 (LWP 27100)]
[New Thread 0x7fffccc79700 (LWP 27101)]
[New Thread 0x7fffabfff700 (LWP 27102)]
[New Thread 0x7fff9bed6700 (LWP 27103)]
[New Thread 0x7fff9b545700 (LWP 27104)]
[New Thread 0x7fff9abb4700 (LWP 27105)]
[New Thread 0x7fff9a223700 (LWP 27106)]
[New Thread 0x7fff99892700 (LWP 27107)]
[New Thread 0x7fff98c9b700 (LWP 27108)]
[New Thread 0x7fff83fff700 (LWP 27109)]
[New Thread 0x7fff8366e700 (LWP 27110)]
[Thread 0x7fff8366e700 (LWP 27110) exited]

My system: Manjaro Linux latest version. Python (virtualenv version): 3.8.1 Emacs version: GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.13) of 2020-02-09 EAF version: latest master branch (latest commit a76d42a * master upstream/master Use eaf-send-second-key-sequence instead eaf-send-cancel-key-sequence.

manateelazycat commented 4 years ago

Please check with other video play, if other video player can't play, it's something wrong in your video file.

manateelazycat commented 4 years ago

duplicate issue https://github.com/manateelazycat/emacs-application-framework/issues/42

stardiviner commented 4 years ago

I can play video with mpv, it works fine.

manateelazycat commented 4 years ago

best upload video url let me check.

stardiviner commented 4 years ago

链接: https://pan.baidu.com/s/1Dl3HjnSuWIeAczNMxa26mQ 提取码: f57i

A small video file

manateelazycat commented 4 years ago

深度截图_plasmashell_20200301171747

manateelazycat commented 4 years ago

I can't show video graphics when I first time play it.

But video is show after i try mpv or ffplay.

I don't know why.

stardiviner commented 4 years ago

I tried many different video files, also tried different format video files. None of them works. And the eaf-enable-debug can't give my any meaning info at all. Is there more advanced way to debug it?

manateelazycat commented 4 years ago

I tried many different video files, also tried different format video files. None of them works. And the eaf-enable-debug can't give my any meaning info at all. Is there more advanced way to debug it?

eaf-enable-debug only effect for segfault, but your problem looks is something wrong with ffmpeg or qt.

manateelazycat commented 4 years ago

其实有一个更好的方案,就是用 plyr.js 和浏览器来重新实现视频播放器,但是QtWebEngine默认没有加入视频解码器,导致Chrome可以播放,EAF浏览器无法播放。

stardiviner commented 4 years ago

当前的实现是在浏览器里播放视频么?我浏览器打开 eaf-open-browser 是没问题的。

关于视频解码,Qt能否调用FFMpeg或者MPlayer他们的库么?这是我这个菜鸡唯一能想到的办法。(可能你早就想过了。。。:)

manateelazycat commented 4 years ago

当前的实现是在浏览器里播放视频么?我浏览器打开 eaf-open-browser 是没问题的。

关于视频解码,Qt能否调用FFMpeg或者MPlayer他们的库么?这是我这个菜鸡唯一能想到的办法。(可能你早就想过了。。。:)

当前播放器是用QMediaPlayer实现的,而QMediaPlayer本身就是用的FFMpeg实现的,Mplayer也是用的ffmpeg.

估计问题出在你的系统环境和QMediaPlayer的兼容性了。

manateelazycat commented 4 years ago

当前的实现是在浏览器里播放视频么?我浏览器打开 eaf-open-browser 是没问题的。

关于视频解码,Qt能否调用FFMpeg或者MPlayer他们的库么?这是我这个菜鸡唯一能想到的办法。(可能你早就想过了。。。:)

你的浏览器可以播放视频文件吗?你是怎么安装QtWebEngine这个库的?

stardiviner commented 4 years ago

pip install -U PyQtWebEngine 用pip 安装的。我打开Bilibili视频网站,无法看,需要Flash。不知道有哪个 不是 Flash 的视频网站可以测试下 HTML 5 video支持的。

stardiviner commented 4 years ago

我想用youtube测试下,但是设置了 EAF 代理,打不开youtube。

(defvar eaf-proxy-enabled nil)
  (defun eaf-proxy-toggle ()
    "Toggle EAF proxy."
    (interactive)
    (if eaf-proxy-enabled
        (progn
          (eaf-setq eaf-proxy-type nil)
          (eaf-setq eaf-proxy-host nil)
          (eaf-setq eaf-proxy-port nil))
      (progn
        (eaf-setq eaf-proxy-type "socks5")
        (eaf-setq eaf-proxy-host "127.0.0.1")
        (eaf-setq eaf-proxy-port "1086"))))
manateelazycat commented 4 years ago

我想用youtube测试下,但是设置了 EAF 代理,打不开youtube。

(defvar eaf-proxy-enabled nil)
  (defun eaf-proxy-toggle ()
    "Toggle EAF proxy."
    (interactive)
    (if eaf-proxy-enabled
        (progn
          (eaf-setq eaf-proxy-type nil)
          (eaf-setq eaf-proxy-host nil)
          (eaf-setq eaf-proxy-port nil))
      (progn
        (eaf-setq eaf-proxy-type "socks5")
        (eaf-setq eaf-proxy-host "127.0.0.1")
        (eaf-setq eaf-proxy-port "1086"))))

你要本地配置代理才行,EAF只是代理设置,并不包括代理功能。

stardiviner commented 4 years ago

你要本地配置代理才行,EAF只是代理设置,并不包括代理功能。

我设置了代理的,Firefox能够通过这个代理打开youtube。

manateelazycat commented 4 years ago

我这边实在无法重现你说的视频问题。

  1. QMediaPlayer播放,我这边是EAF,mpv,ffplay都可以工作
  2. 浏览器必须要 WebEngine 重新用私有编解码选项编译才能支持 mp4 播放,可惜 PyQtWebEngine 默认不支持这些编码器
  3. 我一直用代理,没有问题,请检查你自己的代理工具是否有流量请求

我现在对你的无法播放视频的问题实在无能为力,没有时间折腾为啥我行你不行。

除非你能提供更有效的解决方案,我可能不能跟进这个 issue 了,抱歉。

stardiviner commented 4 years ago

嗯嗯,对此我表示理解。我自己再折腾下。

stardiviner commented 4 years ago

我又尝试打开一些视频文件,发现又可以了,但是我获得一个报错,是在能够播放视频之前。

dbus-call-method: D-Bus error: "Traceback (most recent call last):
  File \"/home/stardiviner/.virtualenvs/python3.8/lib/python3.8/site-packages/dbus/service.py\", line 711, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File \"/home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py\", line 89, in new_buffer
    return self.create_app(buffer_id, str(url), \"app.{0}.buffer\".format(str(app_name)), str(arguments))
  File \"/home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py\", line 131, in create_app
    self.create_buffer(buffer_id, url, module_path, arguments)
  File \"/home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py\", line 144, in create_buffer
    app_buffer = module.AppBuffer(buffer_id, url, eaf_config_dir, arguments, self.emacs_var_dict)
  File \"/home/stardiviner/Code/Emacs/emacs-application-framework/app/video-player/buffer.py\", line 37, in __init__
    self.build_widget_method(method_name)
  File \"/home/stardiviner/Code/Emacs/emacs-application-framework/core/buffer.py\", line 332, in build_widget_method
    setattr(self, method_name, getattr(self.buffer_widget, method_name))
AttributeError: 'VideoPlayerWidget' object has no attribute 'play_backward'

这好像是 DBus 的问题? Anyway,现在能正常播放视频文件了。

manateelazycat commented 4 years ago

是的,一周之前重构的时候引入的问题。

stardiviner commented 4 years ago

我看你更新了README的提示。感谢。

manateelazycat commented 4 years ago

我看你更新了README的提示。感谢。

最新版增加了 js-video-player , 当QWebEngine是通过pacman安装的,就用 js-video-player 替换 video-player 来播放本地视频。

因为 js-video-player 是基于 plyr.js 这个库开发的,不论界面效果还是功能来说都要好很多,应该不会出现黑屏的问题。

stardiviner commented 4 years ago

我 pull 了最新的更新。懒猫真厉害,这么快就出新feature了。 用新的EAF(重启了Emacs的) 打开了几个视频试了下。还是有问题,有的没有声音,有的还是黑屏。 因为视频有点大,上传不是很方便。 这几个视频我是从YouTube用 youtube-dl (用 pip install youtube-dl 安装) 下载的。 这个视频 https://www.youtube.com/watch?v=oJNHXPs0XDk 只有视频没有声音。 这个视频 https://www.youtube.com/watch?v=VC_MTD68erY 只有声音没有视频,黑屏的。

我怀疑可能是我系统问题?还是说EAF选择编码的时候依然有问题?MPV,MPlayer,之类的我测试了是能正常播放的。 比如MPlayer:

mplayer One\ Million\ Clicks\ per\ Minute\ with\ Kafka\ and\ Clojure\ -\ Devon\ Peticolas-VC_MTD68erY.mkv
do_connect: could not connect to socket
connect: No such file or directory
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory

虽然报错,但是能正常播放。MPV是没有输出这个报错的。

stardiviner commented 4 years ago

另外,新的视频播放器确实要好很多,毕竟界面控制摆在那里嘛。哈哈哈。点个赞。原先 l 快进不方便,现在拉进度条就方便多了。

manateelazycat commented 4 years ago

我 pull 了最新的更新。懒猫真厉害,这么快就出新feature了。 用新的EAF(重启了Emacs的) 打开了几个视频试了下。还是有问题,有的没有声音,有的还是黑屏。 因为视频有点大,上传不是很方便。 这几个视频我是从YouTube用 youtube-dl (用 pip install youtube-dl 安装) 下载的。 这个视频 https://www.youtube.com/watch?v=oJNHXPs0XDk 只有视频没有声音。 这个视频 https://www.youtube.com/watch?v=VC_MTD68erY 只有声音没有视频,黑屏的。

我怀疑可能是我系统问题?还是说EAF选择编码的时候依然有问题?MPV,MPlayer,之类的我测试了是能正常播放的。 比如MPlayer:

mplayer One\ Million\ Clicks\ per\ Minute\ with\ Kafka\ and\ Clojure\ -\ Devon\ Peticolas-VC_MTD68erY.mkv
do_connect: could not connect to socket
connect: No such file or directory
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory

虽然报错,但是能正常播放。MPV是没有输出这个报错的。

我感觉你的系统VDPAU有问题,不管是什么播放器,最底层都是ffmpeg.

stardiviner commented 4 years ago

好的,虽然不知道这VDPAU是啥,我去调查下,然后检查下我的系统。稍后更新反馈。

stardiviner commented 4 years ago

了解了VDPAU,运行一些命令后的测试结果确实是我的VDPAU不支持一些视频格式。MPV这些倒是正常播放,于是我写了一个函数给Org Mode,让它在打开视频链接的时候选择使用什么播放。暂时只能这样了。不知道怎么解决这个VDPAU不支持问题,难道是因为我在MacBook Pro 2015上安装Manjaro Linux的问题?

vainfo
vainfo: VA-API version: 1.6 (libva 2.6.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Broadwell - 2.4.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointVLD

$ vdpauinfo
display: :0   screen: 0
    API version: 1
    Information string: OpenGL/VAAPI backend for VDPAU

    Video surface:

    name   width height types
    -------------------------------------------
    420     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24
    422     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24
    444     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24

    Decoder capabilities:

    name                        level macbs width height
    ----------------------------------------------------
    MPEG1                          --- not supported ---
    MPEG2_SIMPLE                   --- not supported ---
    MPEG2_MAIN                     --- not supported ---
    H264_BASELINE                  51 16384  2048  2048
    H264_MAIN                      51 16384  2048  2048
    H264_HIGH                      51 16384  2048  2048
    VC1_SIMPLE                     --- not supported ---
    VC1_MAIN                       --- not supported ---
    VC1_ADVANCED                   --- not supported ---
    MPEG4_PART2_SP                 --- not supported ---
    MPEG4_PART2_ASP                --- not supported ---
    DIVX4_QMOBILE                  --- not supported ---
    DIVX4_MOBILE                   --- not supported ---
    DIVX4_HOME_THEATER             --- not supported ---
    DIVX4_HD_1080P                 --- not supported ---
    DIVX5_QMOBILE                  --- not supported ---
    DIVX5_MOBILE                   --- not supported ---
    DIVX5_HOME_THEATER             --- not supported ---
    DIVX5_HD_1080P                 --- not supported ---
    H264_CONSTRAINED_BASELINE      51 16384  2048  2048
    H264_EXTENDED                  --- not supported ---
    H264_PROGRESSIVE_HIGH          --- not supported ---
    H264_CONSTRAINED_HIGH          --- not supported ---
    H264_HIGH_444_PREDICTIVE       --- not supported ---
    VP9_PROFILE_0                  --- not supported ---
    VP9_PROFILE_1                  --- not supported ---
    VP9_PROFILE_2                  --- not supported ---
    VP9_PROFILE_3                  --- not supported ---
    HEVC_MAIN                      --- not supported ---
    HEVC_MAIN_10                   --- not supported ---
    HEVC_MAIN_STILL                --- not supported ---
    HEVC_MAIN_12                   --- not supported ---
    HEVC_MAIN_444                  --- not supported ---

    Output surface:

    name              width height nat types
    ----------------------------------------------------
    B8G8R8A8         16384 16384    y
    R8G8B8A8         16384 16384    y
    R10G10B10A2      16384 16384    y
    B10G10R10A2      16384 16384    y
    A8               16384 16384    y

    Bitmap surface:

    name              width height
    ------------------------------
    B8G8R8A8         16384 16384
    R8G8B8A8         16384 16384
    R10G10B10A2      16384 16384
    B10G10R10A2      16384 16384
    A8               16384 16384

    Video mixer:

    feature name                    sup
    ------------------------------------
    DEINTERLACE_TEMPORAL             -
    DEINTERLACE_TEMPORAL_SPATIAL     -
    INVERSE_TELECINE                 -
    NOISE_REDUCTION                  -
    SHARPNESS                        -
    LUMA_KEY                         -
    HIGH QUALITY SCALING - L1        -
    HIGH QUALITY SCALING - L2        -
    HIGH QUALITY SCALING - L3        -
    HIGH QUALITY SCALING - L4        -
    HIGH QUALITY SCALING - L5        -
    HIGH QUALITY SCALING - L6        -
    HIGH QUALITY SCALING - L7        -
    HIGH QUALITY SCALING - L8        -
    HIGH QUALITY SCALING - L9        -

    parameter name                  sup      min      max
    -----------------------------------------------------
    VIDEO_SURFACE_WIDTH              -
    VIDEO_SURFACE_HEIGHT             -
    CHROMA_TYPE                      -
    LAYERS                           -

    attribute name                  sup      min      max
    -----------------------------------------------------
    BACKGROUND_COLOR                 -
    CSC_MATRIX                       -
    NOISE_REDUCTION_LEVEL            -
    SHARPNESS_LEVEL                  -
    LUMA_KEY_MIN_LUMA                -
    LUMA_KEY_MAX_LUMA                -
grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log
[     5.863] (II) intel(0): [DRI2]   DRI driver: i965
[     5.863] (II) intel(0): [DRI2]   VDPAU driver: va_gl
stardiviner commented 4 years ago

I confirmed Emacs started from KDE/krunner (without virtualenv) can play local video files. But when open Emacs from shell (which has enabled virtualenv) will caused this problem.

As you mentioned in latest commit about using Arch installed python library webengine will use private encoder/decoder for vidoes. But not work for webengine which is installed by pip.

This is awkward, because I have to use virtualenv in Emacs. By the way, I have not corresponding package for fitz module under Arch Linux.

manateelazycat commented 4 years ago

fitz is module from package python-pymupdf

stardiviner commented 4 years ago

That's weird, I remember I have installed python-pymupdf before, and now I re-installed it again. I found when I enter python without virtualenv, it can't find fitz module. I will search for this issue.

stardiviner commented 4 years ago

I confirmed this problem. I deactived virtualenv, and enter Arch Linux python. import fitz failed. Here is the log exception dump from *eaf* which failed to open PDF file.

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe3103700 (LWP 464289)]
[New Thread 0x7fffe12d0700 (LWP 464290)]
[New Thread 0x7fffdb307700 (LWP 464291)]
[New Thread 0x7fffda976700 (LWP 464292)]
[New Thread 0x7fffd9fe5700 (LWP 464293)]
[New Thread 0x7fffd9654700 (LWP 464294)]
EAF process starting...
Traceback (most recent call last):
  File "/home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py", line 134, in create_app
    self.create_buffer(buffer_id, url, module_path, arguments)
  File "/home/stardiviner/Code/Emacs/emacs-application-framework/eaf.py", line 146, in create_buffer
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/stardiviner/Code/Emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 29, in <module>
    import fitz
ModuleNotFoundError: No module named 'fitz'
stardiviner commented 4 years ago

Then I use command sudo pip3 install pymupdf solved this problem.

manateelazycat commented 4 years ago

I believe this is some thing wrong in your environment.

I even don't use virtualenv, sorry can't help you.

stardiviner commented 4 years ago

Thanks @manateelazycat , The problem is solved anyway. :smile: