kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin 解决过程小记

  • MacOS 10.14.4
  • Python:3.6
  • Kivy:1.10.1

运行 /kivy/examples/demo/kivycatalog/main.py 时报错:
kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin

最开始尝试了 Kivy: Unable to load GStreamer on OSX 说的方法,命令行输入如下内容:

brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-ffmpeg010

报错找不到插件,失败。
kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin 解决过程小记_第1张图片
后来在Kivy项目的Github主页上发现了跟我相同的问题 https://github.com/kivy/kivy/issues/5886
顺着看下去找到了来自 noncup 的方法:
kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin 解决过程小记_第2张图片
这个路径貌似就是Kivy相关模块的安装路径,然而我也忘了之前把它们装在哪里,那就直接在报错信息里找,我的报错信息具体如下:

[INFO ] [Logger ] Record log in /Users/mint/.kivy/logs/kivy_19-04-20_0.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the “OpenGL ES 2” graphics system
[INFO ] [GL ] Backend used
[INFO ] [GL ] OpenGL version
[INFO ] [GL ] OpenGL vendor
[INFO ] [GL ] OpenGL renderer
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [VideoGstplayer] Using Gstreamer 1.10.4.0
[INFO ] [Video ] Provider: gstplayer
[WARNING] [Image ] Unable to load image
[ERROR ] [Image ] Error loading texture …/…/widgets/cityCC0.mpg
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Start application main loop
[INFO ] [Base ] Leaving application in progress…
Traceback (most recent call last):
File “main.py”, line 192, in
KivyCatalogApp().run()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/app.py”, line 826, in run
runTouchApp()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/base.py”, line 502, in runTouchApp
EventLoop.window.mainloop()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/window/window_sdl2.py”, line 727, in mainloop
self._mainloop()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/window/window_sdl2.py”, line 460, in _mainloop
EventLoop.idle()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/base.py”, line 337, in idle
Clock.tick()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/clock.py”, line 581, in tick
self._process_events()
File “kivy/_clock.pyx”, line 384, in kivy._clock.CyClockBase._process_events
File “kivy/_clock.pyx”, line 414, in kivy._clock.CyClockBase._process_events
File “kivy/_clock.pyx”, line 412, in kivy._clock.CyClockBase._process_events
File “kivy/_clock.pyx”, line 167, in kivy._clock.ClockEvent.tick
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/uix/video.py”, line 183, in _do_video_load
self._video = CoreVideo(filename=filename, **self.options)
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/video/video_gstplayer.py”, line 56, in init
super(VideoGstplayer, self).init(**kwargs)
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/video/init.py”, line 84, in init
self.filename = kwargs.get(‘filename’)
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/video/init.py”, line 116, in
lambda self, x: self._set_filename(x),
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/video/init.py”, line 113, in _set_filename
self.load()
File “/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/core/video/video_gstplayer.py”, line 68, in load
self.player.load()
File “kivy/lib/gstplayer/_gstplayer.pyx”, line 233, in kivy.lib.gstplayer._gstplayer.GstPlayer.load
kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin

可以看到错误信息主要集中在 File "/Users/mint/anaconda3/lib/python3.6/site-packages/kivy/***" ,估计就是这个路径。
接下来进入 /Users/mint/anaconda3/lib/python3.6/site-packages/kivy/lib 目录,里面有如下文件:在这里插入图片描述
没有noncup说的gstreamer目录,只有gstplayer。再看错误信息也显示在kivy.lib.gstplayer下,试着删除这个目录。在命令行输入:

rm -R gstplayer

再次运行 /kivy/examples/demo/kivycatalog/main.py,成功出现如下界面!kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin 解决过程小记_第3张图片
写在最后:刚接触Kivy,发现有关Kivy错误的博客不是很多,只能多在项目主页寻找,找到可行的解决方法就记录下来,以备后续学习之需。

你可能感兴趣的:(kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin 解决过程小记)