title: ffmpeg - transcode every video file from a folder (file extension resiliency)
body: <p>For my activity, I need to transcode bunches of files locally and add a watermark to it.
  I receive video RAW files, that need to be transcoded into MP4 with a watermark.
  so I made this bash command</p>
  <pre><code>for name in /transcoding/IN/*.MP4; do
  ffmpeg -i &quot;$name&quot; \
  -i /transcoding/Ressources/watermark_1080p.png \
  -filter_complex &quot;[0:v]scale=1920:1080[bg];[bg][1:v]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2&quot; \
  -c:v libx264 -crf 20 -profile:v High -level 4.1 \
  -c:a aac \
  -f mp4 \
  &quot;${name%.*}_encoded.mp4&quot;
  mv /transcoding/IN/*_encoded.mp4 /transcoding/OUT
  done
  </code></pre>
  <p>I receive video files with multiple file extensions:
  .mp4/MP4 .mov/MOV .avi/AVI etc
  and sometimes I got mixed files on the same deliveries.
  which forces me to run the command by changing <code>*.MP4</code> to the good file extension.</p>
  <p>I find the way to use this <code>*{mp4,MP4,mov,MOV,avi,AVI}</code>
  but it crashes if a/several file extension(s) is/are not present in the folder.</p>
  <p>how would you do it?</p>
  <p>thanks</p>