python-vlc + wxpython 在 Raspberry pi 4b

如何解决python-vlc + wxpython 在 Raspberry pi 4b

我有 RaspBerry pi 4b,我正在尝试运行 python-vlc 和 wxpython 来播放视频。

import vlc
import time
import threading
import wx



class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,None,-1,"Video Frame WxPython",size=wx.GetdisplaySize())

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.panel = wx.Panel(self,id= -1,pos=(0,0),size=wx.GetdisplaySize(),style=wx.BORDER_RAISED)
        sizer.Add(self.panel)
        self.SetSizer(sizer)
        self.ShowFullScreen(True)   # EDIT#1

        self.panel.SetBackgroundColour(wx.BLACK)
        self.Show()


def foo():
    global frame   # EDIT#1
    vlc_options = '--no-xlib --verbose 2'  # EDIT#1
    inst = vlc.Instance(vlc_options)
    player = inst.media_player_new()

    m1 = inst.media_new('lang_CZ.mp4')
    time.sleep(0.1)   # EDIT#1
    player.set_xwindow(frame.panel.GetHandle())  # EDIT#1
    while True:
        print("-------")  # EDIT#1
        player.set_media(m1)
        player.play()
        time.sleep(10)
        player.stop()



app = wx.App()
frame = MyFrame()

thr = threading.Thread(target=foo)
thr.start()


app.MainLoop()


print(thr.is_alive())
thr.join()

问题是,经过几次循环迭代后,图形窗口会冻结,并且直到 raspBerry pi 重新启动它才能工作。 Vlc 没有显示任何错误,而且如果我在此之后运行 cvlc 它也不起作用。

提前致谢

编辑: 我在 --verbose 2vlc_options 之前将 player.set_xwindow(frame.panel.GetHandle()) 添加while Trueself.ShowFullScreen(True)MyFrame 类中。这是最后一次成功播放的输出(在 print("-------") 之后):

-------
[b1576280] main input debug: Creating an input for 'lang_CZ.mp4'
[b1576280] main input debug: using timeshift granularity of 50 MiB
[b1576280] main input debug: using default timeshift path
[b1576280] main input debug: `file:///home/pi/lang_CZ.mp4' gives access `file' demux `any' path `/home/pi/lang_CZ.mp4'
[9fd089d8] main input source debug: creating demux: access='file' demux='any' location='/home/pi/lang_CZ.mp4' file='/home/pi/lang_CZ.mp4'
[9fd07a48] main demux debug: looking for access_demux module matching "file": 17 candidates
[9fd07a48] main demux debug: no access_demux modules matched
[9fd0b138] main stream debug: creating access: file:///home/pi/lang_CZ.mp4
[9fd0b138] main stream debug:  (path: /home/pi/lang_CZ.mp4)
[9fd0b138] main stream debug: looking for access module matching "file": 28 candidates
[9fd0b138] main stream debug: using access module "filesystem"
[9fd0a9f0] main stream debug: looking for stream_filter module matching "prefetch,cache_read": 26 candidates
[9fd0a9f0] cache_read stream debug: Using stream method for AStream*
[9fd0a9f0] cache_read stream debug: starting pre-buffering
[9fd0a9f0] cache_read stream debug: received first data after 0 ms
[9fd0a9f0] cache_read stream debug: pre-buffering done 1024 bytes in 0s - 3472 KiB/s
[9fd0a9f0] main stream debug: using stream_filter module "cache_read"
[9fd023e8] main stream debug: looking for stream_filter module matching "any": 26 candidates
[9fd023e8] lua stream debug: Trying Lua scripts in /home/pi/.local/share/vlc/lua/playlist
[9fd023e8] lua stream debug: Trying Lua scripts in /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/anevia_streams.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/anevia_xml.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/appletrailers.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/bbc_co_uk.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/cue.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/dailymotion.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/jamendo.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/koreus.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/liveleak.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/newgrounds.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/rockBox_fm_presets.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/soundcloud.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/twitch.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/vimeo.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/vocaroo.luac
[9fd023e8] lua stream debug: Trying Lua playlist script /usr/lib/arm-linux-gnueabihf/vlc/lua/playlist/youtube.luac
[9fd023e8] lua stream debug: Trying Lua scripts in /usr/share/vlc/lua/playlist
[9fd023e8] main stream debug: no stream_filter modules matched
[9fd0ac20] main stream_directory debug: looking for stream_directory module matching "any": 1 candidates
[9fd0ac20] main stream_directory debug: no stream_directory modules matched
[9fd089d8] main input source debug: attachment of directory-extractor Failed for file:///home/pi/lang_CZ.mp4
[9fd023e8] main stream debug: looking for stream_filter module matching "record": 26 candidates
[9fd023e8] main stream debug: using stream_filter module "record"
[9fd089d8] main input source debug: creating demux: access='file' demux='any' location='/home/pi/lang_CZ.mp4' file='/home/pi/lang_CZ.mp4'
[9fd06868] main demux debug: looking for demux module matching "mp4": 55 candidates
[9fd023e8] mp4 stream warning: unkNown Box type stik (incompletely loaded)
[9fd023e8] mp4 stream warning: unkNown Box type tvsn (incompletely loaded)
[9fd023e8] mp4 stream warning: unkNown Box type tves (incompletely loaded)
[9fd023e8] mp4 stream warning: unkNown Box type hdvd (incompletely loaded)
[9fd023e8] mp4 stream debug: dumping root Box "root"
[9fd023e8] mp4 stream debug: |   + ftyp size 20 offset 0
[9fd023e8] mp4 stream debug: |   + moov size 310863 offset 20
[9fd023e8] mp4 stream debug: |   |   + mvhd size 108 offset 28
[9fd023e8] mp4 stream debug: |   |   + trak size 100838 offset 136
[9fd023e8] mp4 stream debug: |   |   |   + tkhd size 92 offset 144
[9fd023e8] mp4 stream debug: |   |   |   + mdia size 100738 offset 236
[9fd023e8] mp4 stream debug: |   |   |   |   + mdhd size 32 offset 244
[9fd023e8] mp4 stream debug: |   |   |   |   + hdlr size 45 offset 276
[9fd023e8] mp4 stream debug: |   |   |   |   + minf size 100653 offset 321
[9fd023e8] mp4 stream debug: |   |   |   |   |   + vmhd size 20 offset 329
[9fd023e8] mp4 stream debug: |   |   |   |   |   + dinf size 36 offset 349
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + dref size 28 offset 357
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   + url  size 12 offset 373
[9fd023e8] mp4 stream debug: |   |   |   |   |   + stbl size 100589 offset 385
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsd size 149 offset 393
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   + avc1 size 133 offset 409
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   |   + avcC size 47 offset 495
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stts size 24 offset 542
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stss size 2072 offset 566
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsc size 28 offset 2638
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsz size 49156 offset 2666
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stco size 49152 offset 51822
[9fd023e8] mp4 stream debug: |   |   + trak size 208954 offset 100974
[9fd023e8] mp4 stream debug: |   |   |   + tkhd size 92 offset 100982
[9fd023e8] mp4 stream debug: |   |   |   + mdia size 208832 offset 101074
[9fd023e8] mp4 stream debug: |   |   |   |   + mdhd size 32 offset 101082
[9fd023e8] mp4 stream debug: |   |   |   |   + hdlr size 45 offset 101114
[9fd023e8] mp4 stream debug: |   |   |   |   + minf size 208747 offset 101159
[9fd023e8] mp4 stream debug: |   |   |   |   |   + smhd size 16 offset 101167
[9fd023e8] mp4 stream debug: |   |   |   |   |   + dinf size 36 offset 101183
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + dref size 28 offset 101191
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   + url  size 12 offset 101207
[9fd023e8] mp4 stream debug: |   |   |   |   |   + stbl size 208687 offset 101219
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsd size 91 offset 101227
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   + mp4a size 75 offset 101243
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   |   |   + esds size 39 offset 101279
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stts size 24 offset 101318
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsc size 77776 offset 101342
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stsz size 84692 offset 179118
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + stco size 46096 offset 263810
[9fd023e8] mp4 stream debug: |   |   |   + udta size 22 offset 309906
[9fd023e8] mp4 stream debug: |   |   |   |   + name size 14 offset 309914
[9fd023e8] mp4 stream debug: |   |   + udta size 955 offset 309928
[9fd023e8] mp4 stream debug: |   |   |   + Meta size 947 offset 309936
[9fd023e8] mp4 stream debug: |   |   |   |   + hdlr size 34 offset 309948
[9fd023e8] mp4 stream debug: |   |   |   |   + ilst size 901 offset 309982
[9fd023e8] mp4 stream debug: |   |   |   |   |   + stik size 25 offset 309990 (????)
[9fd023e8] mp4 stream debug: |   |   |   |   |   + tvsn size 28 offset 310015 (????)
[9fd023e8] mp4 stream debug: |   |   |   |   |   + tves size 28 offset 310043 (????)
[9fd023e8] mp4 stream debug: |   |   |   |   |   + hdvd size 25 offset 310071 (????)
[9fd023e8] mp4 stream debug: |   |   |   |   |   + ---- size 715 offset 310096
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + mean size 28 offset 310104
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + name size 20 offset 310132
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + data size 659 offset 310152
[9fd023e8] mp4 stream debug: |   |   |   |   |   + ---- size 72 offset 310811
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + mean size 28 offset 310819
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + name size 20 offset 310847
[9fd023e8] mp4 stream debug: |   |   |   |   |   |   + data size 16 offset 310867
[9fd023e8] mp4 stream debug: |   + free size 8 offset 310883
[9fd023e8] mp4 stream debug: |   + mdat size 158370850 offset 310891
[9fd06868] mp4 demux debug: unrecognized major media specification (mp42).
[9fd06868] mp4 demux debug: found 2 tracks
[9fd06868] mp4 demux debug: track[Id 0x1] read 12284 chunk
[9fd06868] mp4 demux warning: STTS table of 1 entries
[9fd06868] mp4 demux debug: track[Id 0x1] read 12284 samples length:491s
[b1576280] main input debug: selecting program id=0
[9fd06868] mp4 demux debug: adding track[Id 0x1] video (enable) language eng
[9fd06868] mp4 demux debug: track[Id 0x2] read 11520 chunk
[9fd06868] mp4 demux warning: STTS table of 1 entries
[9fd06868] mp4 demux debug: track[Id 0x2] read 21168 samples length:491s
[9fd06868] mp4 demux debug: adding track[Id 0x2] audio (enable) language eng
[9fd06868] main demux debug: using demux module "mp4"
[b1576280] main input debug: looking for a subtitle file in /home/pi/
[9fd2e400] main decoder debug: looking for video decoder module matching "any": 18 candidates
[9fd2e400] mmal_codec decoder debug: OpenDecoder: <<< (h264/----)[H264] 768x576 0/0=0/0 o:0 -> (----/----) 0x0 0/0 o:0
[9fd2e400] mmal_codec decoder: VCSM init succeeded: CMA
[9fd2e400] main decoder debug: using video decoder module "mmal_codec"
[9fd3b328] main decoder debug: looking for audio decoder module matching "any": 21 candidates
[9fd3b328] main decoder debug: using audio decoder module "faad"
[9fd0b5d8] main demux Meta debug: looking for Meta reader module matching "any": 2 candidates
[9fd0b5d8] main demux Meta debug: using Meta reader module "taglib"
[9fd06868] main demux debug: removing module "taglib"
[b1576280] main input debug: `file:///home/pi/lang_CZ.mp4' successfully opened
[9fd06868] mp4 demux debug: track[Id 0x1] using Sync Sample Box (stss)
[9fd06868] mp4 demux debug: stss gives 0 --> 0 (sample number)
[b1576280] main input debug: Buffering 0%
[9fd3b328] faad decoder warning: decoded zero sample
[b15628f0] main generic debug: creating audio output
[9f32e940] main audio output debug: looking for audio output module matching "any": 6 candidates
[9f32e940] vlcpulse audio output debug: using library version 12.2.0
[9f32e940] vlcpulse audio output debug:  (compiled with version 12.2.0,protocol 32)
[b1576280] main input debug: Buffering 25%
[b1576280] main input debug: Buffering 50%
[b1576280] main input debug: Buffering 75%
[b1576280] main input debug: Buffering 100%
[b1576280] main input debug: Stream buffering done (1250 ms in 11 ms)
[b0b4c180] main spu text debug: looking for text renderer module matching "any": 2 candidates
[b0b4c180] freetype spu text debug: Building font databases.
[b0b4c180] freetype spu text debug: Took -32427 microseconds
[b0b4c180] main spu text debug: using text renderer module "freetype"
[b0b12d00] main scale debug: looking for video converter module matching "any": 17 candidates
[b0b12d00] swscale scale debug: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality)
[b0b12d00] main scale debug: using video converter module "swscale"
[b0b20480] main scale debug: looking for video converter module matching "any": 17 candidates
[b0b20480] yuvp scale debug: YUVP to YUVA converter
[b0b20480] main scale debug: using video converter module "yuvp"
[b0b2ab78] main video output debug: Deinterlacing available
[b0b2ab78] main video output debug: deinterlace -1,mode auto,is_needed 0
[b0b15b08] main window debug: looking for vout window module matching "embed-xid,any": 6 candidates
[b155d168] pulse audio output debug: changing sink 0: alsa_output.platform-bcm2835_audio.digital-stereo (Built-in Audio Digital Stereo)

它挂在最后一行 (b155d168) 上,按 ctrl+c 后,我可以看到鼠标光标出现黑屏。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?