title: ffmpeg batch frame extraction to .png
body: <p>I'm attempting to extract stacks of .png files from short 20-second videos of zebrafish hearts for ImageJ heartbeat analysis.</p>
  <p>So far, this code,</p>
  <pre><code>ffmpeg -i C:\example_directory\filename.movS -r 30/1 C:\example_directory\filename_%04d.png
  </code></pre>
  <p>works quite well. However, this can only be run for one video file at a time, and outputs to one folder at a time.</p>
  <p>I have a bit of code that converts multiple .mp4 videos into .mov:</p>
  <pre><code>for i in *.mp4; do ffmpeg -i &quot;$i&quot; -qscale 0 &quot;$(basename&quot;$i&quot; .mp4)&quot;.mov ; done
  </code></pre>
  <p>is there a way to use a for loop or some kind of batch or .sh file to automate the .png extraction from a large group of short videos, say, a twenty or so videos?</p>
  <p>I'm trying to write instructions to streamline the video and image processing for future lab students, so it might be helpful to know if there are differences in automating this for macOS, linux, or Windows 10</p>
  <p>any advice is welcome!</p>
  <p>thanks</p>