I work on a Mac Terminal. I have 250 video files in a directory. For each one, I want a 20seconds subclip between seconds 10 and 20, and 179 and 207. I would like the output file to be named the same as the input file plus a "_1" suffix so I can distinguish them. At the moment, I have the following code:
#!/bin/bash
for %%f in (*.mp4) do ffmpeg -i "%%f" -vf "select='between(t, 10, 20) +
between(t, 197, 207)', setpts=N/FRAME_RATE/TB" -qscale 0 -af "aselect='between(t, 10, 20) +
between(t, 197, 207)', asetpts=N/SR/TB" "%%~nf_1.mp4"
When I execute, it gives me the following error: syntax error near unexpected token `('
If I remove the loop and just try with a specific "inputfilename.mp4" and "inputfilename_1.mp4" (i.e. my desired output filename), it works. As for the output filename in the above code, this post suggests that the "~nf" removes the extension (i.e. ".mp4") from the inputfile, so I added the _1.mp4 afterwards.
Any suggestions? Thank you in advance.
%%fsyntax is batch windows cmd but the first line indicates you're using bash, which language do you want to use?