Standalone distribution grows huge with gstreamer...

60 views
Skip to first unread message

Erik

unread,
Apr 14, 2015, 4:30:32 PM4/14/15
to kivy-...@googlegroups.com
I've been trying to package my application for distribution on windows using pyinstaller, and it works. But when I add gstreamer according to instructions here: http://kivy.org/docs/guide/packaging-windows.html, the size of the distribution grows hugely. On kivy 1.8.0 its about 320mb, when using 1.9.0 its even bigger: 455mb. I noticed some of the gstreamer seem to be duplicates, but it wont work without them. Can anyone give me a hint to shrinking it down somehow? If not, is it possible to use another video provider for streaming video from a wifi network? 

the spec file I've used:

# -*- mode: python -*-

import os
from kivy.tools.packaging.pyinstaller_hooks import install_hooks
import kivy.core.video

gst_plugin_path = os.environ.get('GST_PLUGIN_PATH').split('lib')[0]

install_hooks(globals())

a = Analysis(['../NXconnect 0.1/main.py'],
             pathex=['C:\\Users\\Erik\\Desktop\\NX-Studio\\NXconnect 0.1'],
             hiddenimports=[],
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='nxconnect.exe',
          debug=False,
          strip=None,
          upx=True,
          console=True )
coll = COLLECT(exe,
               Tree('../NXconnect 0.1/'),
               Tree(gst_plugin_path),
               Tree(os.path.join(gst_plugin_path, 'bin')),
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='nxconnect')


Note, I've set console = True for debugging purposes.

qua non

unread,
Apr 14, 2015, 4:48:46 PM4/14/15
to kivy-...@googlegroups.com
You could try using a stripped down install of streamer, removing all the codecs not used by you.
You could also try and see if ffmpeg suits your needs. Just installing ffmpeg libs should be enough, you can enforce the usage of it over streamer using KIVY_VIDEO = ffmpeg

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Erik

unread,
Apr 14, 2015, 5:20:27 PM4/14/15
to kivy-...@googlegroups.com
ffmpeg would be a good alternative. I did look at it, but I thought kivy doenst support it on windows? Thanks, I'll be sure to look into that option

Op dinsdag 14 april 2015 22:48:46 UTC+2 schreef qua-non:

Erik

unread,
Apr 20, 2015, 7:25:52 AM4/20/15
to kivy-...@googlegroups.com
I wrote a new spec file that only copies the required gstreamer files to be published, this leaves me with a 204mb application which can be compressed into a setup file to about 50mb. I was aiming for less, but this is more acceptable as it is.

For those who might need it some day, this is my spec file:

# -*- mode: python -*-

import os

from kivy.tools.packaging.pyinstaller_hooks import install_hooks
import kivy.core.video

# note: changed these values to make sense in my own system
gst_plugin_path = os.environ.get('GST_PLUGIN_PATH')
gst_bin_path = os.path.join(gst_plugin_path.split('lib')[0], 'bin')

install_hooks(globals())

#####################################################
## Gather additional files / directories
## from the source dir to destination dir
## destination is relative to app.exe root dir

def gather(destdir,sourcedir):
    def gather_files(sourcedir,sourcelist):
        for item in os.listdir(sourcedir):
            filepath = os.path.join(sourcedir,item)
            if os.path.isfile(filepath):
                sourcelist.append(filepath)
            else:
                gather_files(filepath,sourcelist)
                
    sourcelist = []
    
    if os.path.isfile(sourcedir):
        # a single file was requested
        sourcelist.append(sourcedir)
    else:
        gather_files(sourcedir,sourcelist)

    datalist = []
    for location in sourcelist:
        destination = location.replace(sourcedir,destdir)
        datalist.append((destination,location,'DATA'))
        
    return datalist
##
#####################################################


a = Analysis(['../NXconnect 0.1/main.py'],
             pathex=['C:\\Users\\Erik\\Desktop\\NX-Studio\\NXconnect 0.1'],
             hiddenimports=[],
             runtime_hooks=None)

#######################################
# gathering all my project files 
a.datas += gather('data','data')
a.datas += gather('.','..\\NXconnect 0.1\\nxconnect.kv')

#######################################
# gathering gstreamer specific files
a.datas += gather('lib\\gstreamer-1.0',gst_plugin_path)
a.datas += gather('.',gst_bin_path)


pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='nxconnect.exe',
          debug=False,
          strip=None,
          upx=True,
          console=False )
coll = COLLECT(exe,
Reply all
Reply to author
Forward
0 new messages