Using ffmpeng in swift code using PythonKit

60 views Asked by At

I have a python script that uses ffmpeng. I installed it using brew install ffmpeg. If I run the python script on python IDE it runs perfectly.

But I wanted to run this python script on my macOS app, so using PythonKit I tried running it:

static func make_audio(dict: [String: String]) {
        let sys = Python.import("sys")
        let dirPath = "/Users/seungjunlee/PycharmProjects/pythonProject8"
        sys.path.append(dirPath)
        let Media = Python.import("audio")
        Media.make_audio(PythonObject(dict))
    }

But if I run above function it keep saying cannot find ffmpeng. So I installed ffmpeng again in current directory.(macOS app project). But I'm still getting error.

I already spent several hours fixing can't find ffmpeng bug appearing when running the python script on Python IDE. The solution was installing it using command brew install ffmpeg. But now it appearing again when I try to run the script in swift code.

Can anyone help me with this? Thanks.

0

There are 0 answers