Nuno Mesquita
Nuno Mesquita

Reputation: 1

Having issues making an app with py2app ffmpeg and ffprobe

I have made an app in OSX Python, that uses FFMEG and ffprobe.

It runs fine in my VS Code.

I want to make a self sustained app, that others can use, without needed to install anything themselves. So, I manually included the static libraries in the bin folder of my main app, and am able to run the app using the libraries inside my bin folder.

I have lost many hours trying to figure this out, and am always getting the same error.

My best shot was being able to open the app inside app/contents/resources and running via Python, but still have the issue saying that ffprobe is not available.

I´m losing my mind...

Should I try a completely different approach?

For now, I just want my OSX friends to be able to use the app, then I will want it to run on Windows too, but baby steps.

I am not quite sure what to include in setup.py, so I would love to include everything that is in my app folder, to avoid all sorts of errors in missing .pngs and stuff.

I also made sure that libraries are executable (they are about 80MB each (ffmpeg and ffprobe))

Can anyone help =D ???

I described above, tested different ways, checked stuff like redirecting the libraries to the folders of the app:

For the last try my setup.py was :

from setuptools import setup

APP = ['mpc.py']
DATA_FILES = [
    ('bin', ['./bin/ffmpeg', './bin/ffprobe']),
    ('theme/dark', ['./theme/dark/*.png']),
    ('theme/light', ['./theme/light/*.png']),
    ('theme', ['./theme/dark.tcl', './theme/light.tcl']),
    '.',  # Add current directory to ensure everything is included
]

OPTIONS = {
    'argv_emulation': False,
    'packages': ['pydub', 'pygame', 'requests', 'freesound'],
    'includes': ['pydub', 'pygame', 'requests', 'freesound'],
    'resources': ['./bin/ffmpeg', './bin/ffprobe', './theme/dark/*.png', './theme/light/*.png',     './theme/dark.tcl', './theme/light.tcl'],
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

And I also had this in the beginning of my Python script:

# Set ffmpeg and ffprobe paths relative to the app's Resources/bin directory
app_dir = os.path.dirname(os.path.abspath(__file__)) 

# Set ffmpeg and ffprobe paths relative to the app's Resources/bin directory
ffmpeg_path = os.path.join(app_dir, 'bin', 'ffmpeg')
ffprobe_path = os.path.join(app_dir, 'bin', 'ffprobe') 
AudioSegment.converter = ffmpeg_path
AudioSegment.ffprobe = ffprobe_path

Don't know what else to try.

Upvotes: 0

Views: 39

Answers (0)

Related Questions