How do I correctly package and utilize ffmpeg in a Python Tkinter project?

Viewed 89

I have spent a few days going over this and could not figure it out. I created a py2app GUI wrapper for an ffmpeg process that I use everyday as a Python tkinter interface. The entire project is written with absolute paths and works perfectly when launching the application from terminal (.app > Contents > MacOS..). Otherwise, everything but the ffmpeg function works when launched by opening the .app. My fear is that when launched from Terminal, the function that calls ffmpeg is simply using Terminal and therefore my computer's system PATH to call ffmpeg.

What I tried doing:

In my setup.py file, I added a line that includes ffmpeg by its location-

OPTIONS = {'iconfile':'T2.icns','plist': {'CFBundleShortVersionString':'0.1.0',},'frameworks':['/usr/local/Cellar/ffmpeg/5.0/bin/ffmpeg'],}

This alone did not fix the issue. So I tried modifying the part where I call ffmpeg. I tried using a few different options,

os.system('ffmpeg...')

subprocess.Popen('ffmpeg...', shell=True).wait()

I also tried something the py2app documentation mentioned on page 17, section 1.11.8, though I am not sure I did it right:

 subprocess.Popen("@executable_path/Contents/Frameworks/ffmpeg..., shell=True).wait()

At this point I don't know what else I could try. My end goal is to be able to carry this on a flash drive and run it on any Mac I need to use it on, regardless if it has Python or ffmpeg installed.

Thanks in advance!

0 Answers
Related