fluent-ffmpeg from an array of input files
<p>I want to use <code>fluent-ffmpeg</code> to create a video of last n images of a directory, or database entries.</p>

<p>Which is the correct syntax?</p>

<p>These are my tries: </p>

<p><strong>Mimic shell command</strong></p>

<pre><code>ffmpeg()
  .addInput('ls *png | tail -n 17')
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()
</code></pre>

<p>but it does not accept shell commands;</p>

<p><strong>space - separated paths</strong></p>

<pre><code>ffmpeg()
  .addInput('a*.png b*.png ')
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()
</code></pre>

<p>but it does not accept list of files separated by spaces;</p>

<p><strong>Array of image paths</strong></p>

<pre><code>ffmpeg()
  .addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
  .inputOptions("-pattern_type glob")
  .output("output.mp4").run()
</code></pre>

<p>but it does not accept arrays.</p>

<p><strong>EDIT:</strong></p>

<p>Also, from <a href="https://stackoverflow.com/questions/28877848/merge-multiple-videos-using-node-fluent-ffmpeg">Merge Multiple Videos using node fluent ffmpeg</a>, I am able to add multiple inputs using an array of files as</p>

<pre><code>var ffmpeg= require('fluent-ffmpeg');
var f=ffmpeg() 
pngarr.forEach(p =&gt; f.input(p)) /// pngarr is my array of png paths
</code></pre>

<p>But running </p>

<pre><code>f.output("./output.mp4").run()
</code></pre>

<p>I obtain just a video of 0 seconds containing the first png of the list.</p>