我正在尝试使用这个简单的示例使用Kivy播放视频:
from kivy.app import App
from kivy.uix.videoplayer import VideoPlayer
class TestApp(App):
vid = None
def replay(self, instance, value):
if value != "play":
# self.vid.play = True
self.vid.state = "play"
def build(self):
self.vid = VideoPlayer(source="./S02E02.mp4", state="play")
# self.vid.bind(state=self.replay) # When state changes, if not playing, play it
return self.vid
TestApp().run()
但是视频未加载并播放。我将其作为输出:
[INFO ] [Logger ] Record log in /home/villar/.kivy/logs/kivy_18-08-16_13.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Video ] Provider: null(['video_ffmpeg', 'video_ffpyplayer'] ignored)
[INFO ] [Window ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] Backend used <gl>
[INFO ] [GL ] OpenGL version <b'3.0 Mesa 18.0.5'>
[INFO ] [GL ] OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO ] [GL ] OpenGL renderer <b'Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) '>
[INFO ] [GL ] OpenGL parsed version: 3, 0
[INFO ] [GL ] Shading version <b'1.30'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[ERROR ] [Image ] Error reading file ./S02E02.png
[INFO ] [ProbeSysfs ] device match: /dev/input/event13
[INFO ] [MTD ] Read event from </dev/input/event13>
[INFO ] [ProbeSysfs ] device match: /dev/input/event7
[INFO ] [MTD ] Read event from </dev/input/event7>
[INFO ] [Base ] Start application main loop
[WARNING] [MTD ] Unable to open device "/dev/input/event13". Please ensure you have the appropriate permissions.
[WARNING] [MTD ] Unable to open device "/dev/input/event7". Please ensure you have the appropriate permissions.
[ERROR ] [Image ] Error loading texture ./S02E02.mp4
[INFO ] [GL ] NPOT texture support is available
视频文件S02E02.mp4
与python脚本位于同一目录中。
我使用的kivy版本是1.10.1,带有Python 3.6和Ubuntu 18.04。
有人知道发生了什么事吗?
答案 0 :(得分:0)
[WARNING] [MTD ] Unable to open device "/dev/input/event13". Please ensure you have the appropriate permissions.
[WARNING] [MTD ] Unable to open device "/dev/input/event7". Please ensure you have the appropriate permissions.
将用户添加到“输入”组:
$ sudo adduser $USER input
注意 您需要先注销然后重新登录才能应用这些权限。