I'm trying to use bash to stitch several images in multiple directories into one video. The script below works.
for f in {0..289}; do convert +append Viewer/$f.png Timeline_Board/$f.png Leaderboard/$f.png Montage/montage$f.png; done
cd Montage
ffmpeg -f image2 -r 7 -i montage%d.png -vcodec libx264 -crf 22 montage.mkv
This loops through frames 0.png through 289.png and stitches the components together, as expected. However, I don't always know how many frames I'll be converting. What I'd like to be able to do is use a line like this:
for f in {0..$1}; do convert +append Viewer/$f.png Timeline_Board/$f.png Leaderboard/$f.png Montage/montage$f.png; done
Where I can pass in a command line argument to select exactly how many frames I want. However, when I have that line in my script and run ./convert_images 289
I get an error saying convert: unable to open image 'Viewer/{0..289}.png': No such file or directory @ error/blob.c/OpenBlob/2675.
It seems as though bash is not interpreting the integer I passed in as a parameter for the loop. How can I make bash treat the variable as a number to loop up to?