title: Create Video Thumbnail of All Files in a Directory via FFmpeg and PHP
body: <p>I have searched all over the Google and StackOverFlow, but still did not find a solution for this.</p>
  
  <p>I want to generate video thumbnail of all mp4 video files in a directory and name the thumbnails as "filename.mp4".jpg</p>
  
  <p>I have ffmpeg and ffmpeg-php installed on my server. I also succeeded in creating thumbnails of one file at a time.</p>
  
  <p>So this is the situation, I have a directory named uploads which has lots of mp4 videos.
  Now, when I run the script, thumbnail of size 100x100 shoud be created automatically and placed in another folder "skrin". Eg: xxx.mp4 should have xxx.mp4.jpg has the thumb name.</p>
  
  <p>IMPORTANT: My filenames have spaces, single quotes, brackets etc in their file names. So the script should be able to handle this.</p>
  
  <p>Could some one help me ? I use the following shell command in php using exec to generate thumb of an individual video.</p>
  
  <pre><code>exec("/usr/local/bin/ffmpeg -itsoffset -105 -i 'xxx haha.mp4' -vcodec mjpeg -vframes 1 -an -f rawvideo -s 100x100 'xxx haha.mp4.jpg'");
  </code></pre>