-
Notifications
You must be signed in to change notification settings - Fork 934
Description
I was unable to use ffmpeg-python wrappers as instructed on the readme file. I wrote the code using VS code on Windows, and I wasn't able to call ffmpeg's input, output, and run functions like:
ffmpeg.input([file]).output([path], **{[arguments]}).run() # all [] on this line are the placeholders just like function parameters, they are not python lists.
If I tried to do it, VScode would highligh the first function (input in this case) blue, but raises a problem saying input is not a known attribute of module "ffmpeg", and any other function called after that (such as .output().run()) are grayed out by the editor.
After a long time of trials and error, I found that I must also import ffmpeg.__ffmpeg and ffmpeg.__run in order for this to work, and the syntax I used was the following:
import ffmpeg
import ffmpeg.__ffmpeg
import ffmpeg.__run
import pathlib
def process(in_path, out_path, args): #args is a dictionary
ffmpeg._run.run(
ffmpeg._ffmpeg.output(
ffmpeg._ffmpeg.input(pathlib.Path(in_path)),
str(pathlib.Path(out_path)),
**args
)
)
As far as I know, this syntax was never mentioned nor documented on the internet, so I hope that it will be included in the official documentation.