実現したいこと
ここに実現したいことを箇条書きで書いてください。
-
kivyのvideoウィジェットを使用したコードをNuitkaでコンパイルして実行ファイルを起動したとき、動画が再生されるようにする。
-
実行ファイル単体で環境を問わず実行できるようにするため、--onefileと--standaloneオプションは必須。
前提
kivyのvideoウィジェットを使用したコードの動作が、コマンドプロンプト上ではProvider: ffpyplayer(['video_ffmpeg'] ignored)になるものの、Nuitkaの--include-module=ffpyplayerを使用してコンパイルした実行ファイルでは、Provider: null(['video_ffmpeg', 'video_ffpyplayer'] ignored)になる。
ログ
[INFO ] [Logger ] Record log in C:\Users\trans\.kivy\logs\kivy_23-08-01_7.txt [INFO ] [Kivy ] v2.2.0 [INFO ] [Kivy ] Installed at "C:\Users\trans\AppData\Local\Temp\ONEFIL~1\kivy\__init__.py" [INFO ] [Python ] v3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] [INFO ] [Python ] Interpreter at "C:\Users\trans\AppData\Local\Temp\ONEFIL~1\python.exe" [INFO ] [Logger ] Purge log fired. Processing... [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 190 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored) [INFO ] [Video ] Provider: null(['video_ffmpeg', 'video_ffpyplayer'] ignored) [INFO ] [Text ] Provider: sdl2 [INFO ] [Window ] Provider: sdl2 [INFO ] [GL ] Using the "OpenGL" graphics system [INFO ] [GL ] GLEW initialization succeeded [INFO ] [GL ] Backend used <glew> [INFO ] [GL ] OpenGL version <b'4.6.14761 Compatibility Profile Context 21.30.14 30.0.13014.8'> [INFO ] [GL ] OpenGL vendor <b'ATI Technologies Inc.'> [INFO ] [GL ] OpenGL renderer <b'AMD Radeon(TM) Graphics'> [INFO ] [GL ] OpenGL parsed version: 4, 6 [INFO ] [GL ] Shading version <b'4.60'> [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 [DEBUG ] Importing BlpImagePlugin [DEBUG ] Importing BmpImagePlugin [DEBUG ] Importing BufrStubImagePlugin [DEBUG ] Importing CurImagePlugin [DEBUG ] Importing DcxImagePlugin [DEBUG ] Importing DdsImagePlugin [DEBUG ] Importing EpsImagePlugin [DEBUG ] Importing FitsImagePlugin [DEBUG ] Importing FitsStubImagePlugin [DEBUG ] Importing FliImagePlugin [DEBUG ] Importing FpxImagePlugin [DEBUG ] [Image ] failed to import FpxImagePlugin: No module named 'olefile' [DEBUG ] Importing FtexImagePlugin [DEBUG ] Importing GbrImagePlugin [DEBUG ] Importing GifImagePlugin [DEBUG ] Importing GribStubImagePlugin [DEBUG ] Importing Hdf5StubImagePlugin [DEBUG ] Importing IcnsImagePlugin [DEBUG ] Importing IcoImagePlugin [DEBUG ] Importing ImImagePlugin [DEBUG ] Importing ImtImagePlugin [DEBUG ] Importing IptcImagePlugin [DEBUG ] Importing JpegImagePlugin [DEBUG ] Importing Jpeg2KImagePlugin [DEBUG ] Importing McIdasImagePlugin [DEBUG ] Importing MicImagePlugin [DEBUG ] [Image ] failed to import MicImagePlugin: No module named 'olefile' [DEBUG ] Importing MpegImagePlugin [DEBUG ] Importing MpoImagePlugin [DEBUG ] Importing MspImagePlugin [DEBUG ] Importing PalmImagePlugin [DEBUG ] Importing PcdImagePlugin [DEBUG ] Importing PcxImagePlugin [DEBUG ] Importing PdfImagePlugin [DEBUG ] Importing PixarImagePlugin [DEBUG ] Importing PngImagePlugin [DEBUG ] Importing PpmImagePlugin [DEBUG ] Importing PsdImagePlugin [DEBUG ] Importing QoiImagePlugin [DEBUG ] Importing SgiImagePlugin [DEBUG ] Importing SpiderImagePlugin [DEBUG ] Importing SunImagePlugin [DEBUG ] Importing TgaImagePlugin [DEBUG ] Importing TiffImagePlugin [DEBUG ] Importing WebPImagePlugin [DEBUG ] Importing WmfImagePlugin [DEBUG ] Importing XbmImagePlugin [DEBUG ] Importing XpmImagePlugin [DEBUG ] Importing XVThumbImagePlugin [ERROR ] [Image ] Error loading <C:\Users\trans\AppData\Local\Temp\ONEFIL~1\test.mp4>
該当のソースコード(pl.py)
import os from kivy.app import App from kivy.uix.video import Video from kivy.uix.button import Button from kivy.uix.boxlayout import BoxLayout os.environ["KIVY_VIDEO"] = "ffpyplayer" dir_path = os.path.dirname(__file__) mp4 = os.path.join(dir_path, 'test.mp4') class VideoApp(App): def build(self): layout = BoxLayout(orientation='vertical') video = Video(source=mp4) video.state = 'play' layout.add_widget(video) button = Button(text='Skip 3 seconds') button.bind(on_press=lambda x: self.skip(video, 3)) layout.add_widget(button) return layout def skip(self, video, seconds): video.seek(video.position + seconds) if __name__ == '__main__': VideoApp().run()
コンパイルする際に入力したコマンド
-
nuitka --mingw64 --follow-imports --onefile --disable-ccache --standalone --include-module=ffpyplayer --include-module=kivy.uix.video --include-module=PIL.QoiImagePlugin --include-module=kivy.core.video.video_ffpyplayer --include-module=kivy.core.video.video_null --include-data-files=test.mp4=test.mp4 pl.py
-
--include-package=ffpyplayerや--include-package-data=ffpyplayerも試したが変わらず。
環境
Python:3.10.8
OS:Windows 11 Home 21H2
Kivy:2.2.0
Nuitka:1.8rc5

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。