FFMPEG Python command too long

67 views Asked by At

I am trying to make a program that will overlay some images with a "slide" animation. So I am doing this with FFMPEG in my Python code, and there are lots of files and commmands since the slide animation is frame per frame.

for i in range(1, fps): h = yscale - ratio * (fps-i) # print(h) bg = bg.overlay(img_split[i].filter('crop', w1*scale, h, 0, 0), enable=f"between=(t, {nt},{nt + tsp})", x=x, y=y) nt += tsp

this is where I am overlaying the images, and this is where i export the "bg"

ffmpeg.output(bg, path, vcodec='h264_nvenc', **{'b:v': '30M'}).run(overwrite_output=True)

But since there are lots of small changes, the FFMPEG command is very long, so I get the following error: FileNotFoundError: [WinError 206] The filename or extension is too long

I tried to get the command and execute it separetly. With FFMPEG you can get the command by doing ffmpeg.output(...).get_args(), which gives a list of arguments I tried putting these in a file and run the file with batch but I had this error C:\Users\billy\Desktop\tests\MIXER>bash cmd.txt cmd.txt: line 1: syntax error near unexpected token t,' cmd.txt: line 1: ffmpeg -i project/_pk.mp4 -i project/images/1.png -i project/images/2.png -i project/images/3.png -i project/images/4.png -i project/images/5.png -i project/images/6.png -i project/images/7.png -i project/images/8.png -i project/images/9.png -i project/images/10.png -i project/images/11.png -i project/images/12.png -i project/images/13.png -i project/images/14.png -i project/images/15.png -i project/images/16.p (I didn't copy the whole thing as it's very long)

0

There are 0 answers