Reputation: 17
This code works fine:
cmd = "ffmpeg -y -loop 1 -i " + url1 + " -ss 0 -t 5 " + " -
filter_complex" + "
[0:v]scale=w=-2:h=3*720,crop=w=3*1080/1.2:h=3*720/1.2:y=t*in_h/5-
t*out_h/5,scale=w=1080:h=720 " + " -c:v h264 -crf 18 -preset veryfast
" + url2
os.system(cmd)
But after executing the below code:
cmd = "ffmpeg -y -loop 1 -i " + url1 + " -ss 0 -t 5 " + " -
filter_complex" + "
[0:v]scale=w=-2:h=3*720,crop=w=3*1080/1.2:h=3*720/1.2:y=(in_h-out_h)-
t*(in_h-out_h)/5,scale=w=1080:h=720 " + " -c:v h264 -crf 18 -preset
veryfast " + url2
os.system(cmd)
I get an error:
**sh: 1: Syntax error: "(" unexpected****
So it is having a problem with the parentheses. Is there any way to fix it?
Upvotes: 0
Views: 457
Reputation: 54867
Parentheses have a special meaning to the shell. You can either protect them using a backslash (which you'd have to double: \\(in_h-out_h\\)
), or you can put that whole sequence in single quotes:
... + "'[0:v]scale=w=-2:h=3720,crop=w=31080/1.2:h=3720/1.2:y=(in_h-out_h)-t(in_h-out_h)/5,scale=w=1080:h=720'" + ...
Upvotes: 1