I am trying to create a waveform png for a bunch of videos using ffmpeg -filter_complex
The single line command works fine & produces the expected waveform graphic for a single video file:
ffmpeg -i INPUT.mp4 -filter_complex:a "showwavespic=s=1080x120" -frames:v 1 OUTPUT.png
When I try to automate the process for multiple files
for f in *.mp4
do
ffmpeg
-i "$f"
-filter_complex:a "showwavespic=s=1080x120"
-frames:v 1
'"${f%.mp4}.png"'
done
ffmpeg returns an error:
Unable to find a suitable output format for '"INPUT.png"'
'"INPUT.png"': invalid argument
I also tried the stripped down command:
for f in *.mp4
do
ffmpeg -i "$f" -filter_complex 'showwavespic' -frames:v 1 “${f%.mp4}.png”
done
but got the same argument error.
I'm guessing the problem is because of bash syntax, and I am not escaping the quoted arguments properly. I tried multiple versions of the command, but to no success. How do I fix this for loop?