ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

python-Pygame.movi​​e丢失

2019-11-18 14:56:24  阅读:356  来源: 互联网

标签:movie raspberry-pi pygame python raspbian


我目前正在一个小项目上使用RPi 3B(最新的Raspbian Jessie),该项目涉及播放简短的.mp4文件.由于Pygame似乎支持播放.mpg文件,因此我将视频转换为该格式.

但是,当我尝试导入影片模块时,出现了常见的python导入错误:

Traceback (most recent call last):
    File "film_app.py", line 3, in <module>
       import pygame.movie
ImportError: No module named movie

经过研究,我发现其他人也遇到了与here相同的问题.我真的不知道是否有解决方案,或者我在RPi上有什么替代方案.

Pygame,python和Raspbian是最新的.

解决方法:

电影不是pygame的子包

像这样使用它:

movie = pygame.movie.Movie("file.mpg")

但是请注意:

电影API已被弃用,您的pygame很可能不包含此API的任何代码.

该代码将仅引发NotImplementedError异常.

遗憾的是,您无法再将pygame用于此类电影.

Here Lenard Lindstrom对此进行了解释:

“Though not properly documented, the pygame.movie module has been
deprecated for some time, and was no longer built by default. The
documented instructions for converting video files to MPEG1 using
ffmpeg are outdated. I built the movie module was built and tested on
32-bit Linux Mint 17.1 (Ubuntu 14.04.2 LTS, Trusty Tahr) and tested it
on a movie converted from MPEG4 using avconv (a fork of ffmpeg);
pygame segfaulted. Also note that pygame.movie was problematic under
Windows.

The newer, experimental pygame._movie module, based on ffmpeg, never
worked for me on Linux; it would lock up. Also, libav is now preferred
over ffmpeg on Linux. Furthermore, it relies on SDL overlays, which
disappear in SDL2.

As a side note, pygame.examples.movieplayer was re-purposed to use
pygame._movie instead of pygame.movie. This change was undocumented.

I like the idea of movie support in Pygame. But pygame.movie uses the
outdated smpeg library, and pygame._movie never quite worked right.
Maybe another movie module can be written based on an existing command
line movie player program.”

标签:movie,raspberry-pi,pygame,python,raspbian
来源: https://codeday.me/bug/20191118/2028957.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有