Answers.Body: <p>No ffmpeg code can identify interesting frames. At most, there are filters which detect representative frames and filters which identify frames with a scene change. So, at best, there's a thumbnail filter for this, sort of. It can't detect "interesting" frames but it detects representative frames. So, frames from the middle of fades should be out. </p>
  
  <p>Syntax is</p>
  
  <pre><code>ffmpeg -ss 50 -i in.avi -vf thumbnail=300 -vsync 0 thumbs%d.png
  </code></pre>
  
  <p>This will pick one representative frame from each batch of 300 consecutive frames.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-03T12:47:04.703Z
Answers.Text: This seems to be the answer, thank you. I think the usage is syntax is somewhat different, however.
  
  Running the above command results in a single file over 1GB (it must contain a frame every 300 frames), rather than producing a separate image for each frame.
  
  Additionally, as we only require one frame I think we can add `-frames:v 1` so that it will take the first suitable frame it finds. This seems ok to me.
  
  This seems to ignore the `-ss` parameter as far as I can tell, though. Would be ideal to start finding thumbnails after X seconds, but maybe it won't be needed. Thanks again!
Answers.UserDisplayName: SpongeBobPHPants
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-03T13:17:42.940Z
Answers.Text: Check your ffmpeg version. Both `ss` before `-i` works and output is a set of image files (PNG is a still image format, anyway). There's one change needed to avoid a quirk of ffmpeg which will duplicate frames. I've added that to the command.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-03T05:07:12.540Z
Answers.LastActivityDate: 2016-11-03T13:17:59.193Z
Answers.LastEditDate: 2016-11-03T13:17:59.193Z
Answers.UserDisplayName: Gyan
Body: <p>I have a need to generate a thumbnail for videos for a web application and I am currently doing that with this command:</p>
  
  <p><code>ffmpeg -ss &lt;seconds&gt; -i &lt;input file&gt; -vframes 1 -y &lt;output file&gt;</code></p>
  
  <p>Pretty basic, and does the job. But, of course, sometimes the frames aren't very "interesting".</p>
  
  <p>For example, sometimes the video has faded to black as the scene changes, or it could be something which is somewhat boring like credits rolling or similar.</p>
  
  <p>I need some sort of algorithmic way to extract something interesting from the video and essentially filter out the boring bits.</p>
  
  <p>Is there anything in FFmpeg that might be able to make this easier?</p>
  
  <p>If not, then I will need to collect a number of frames and process them outside of FFmpeg; likely using PHP. As a side note, if anyone has any existing code that does this, it would be super helpful!</p>
  
  <p>Many thanks</p>
  
Tags: <video><ffmpeg><thumbnails>
Title: Extract key frame from video with ffmpeg
UserDisplayName: SpongeBobPHPants
ThreadText: # Extract key frame from video with ffmpeg
  
  (Asked by: username_0 on 2016-11-03)
  
  I have a need to generate a thumbnail for videos for a web application and I am currently doing that with this command:
  
  `ffmpeg -ss <seconds> -i <input file> -vframes 1 -y <output file>`
  
  Pretty basic, and does the job. But, of course, sometimes the frames aren't very "interesting".
  
  For example, sometimes the video has faded to black as the scene changes, or it could be something which is somewhat boring like credits rolling or similar.
  
  I need some sort of algorithmic way to extract something interesting from the video and essentially filter out the boring bits.
  
  Is there anything in FFmpeg that might be able to make this easier?
  
  If not, then I will need to collect a number of frames and process them outside of FFmpeg; likely using PHP. As a side note, if anyone has any existing code that does this, it would be super helpful!
  
  Many thanks
  
  **Tags:** video, ffmpeg, thumbnails
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-11-03. Score: 2 | Accepted answer
  
  No ffmpeg code can identify interesting frames. At most, there are filters which detect representative frames and filters which identify frames with a scene change. So, at best, there's a thumbnail filter for this, sort of. It can't detect "interesting" frames but it detects representative frames. So, frames from the middle of fades should be out.
  
  Syntax is
  
  ```
  ffmpeg -ss 50 -i in.avi -vf thumbnail=300 -vsync 0 thumbs%d.png
  
  ```
  
  This will pick one representative frame from each batch of 300 consecutive frames.
  
  > **Comments:**
  > **username_0**: This seems to be the answer, thank you. I think the usage is syntax is somewhat different, however.  Running the above command results in a single file over 1GB (it must contain a frame every 300 frames), rather than producing a separate image for each frame.  Additionally, as we only require one frame I think we can add `-frames:v 1` so that it will take the first suitable frame it finds. This seems ok to me.  This seems to ignore the `-ss` parameter as far as I can tell, though. Would be ideal to start finding thumbnails after X seconds, but maybe it won't be needed. Thanks again!  
  > **username_1**: Check your ffmpeg version. Both `ss` before `-i` works and output is a set of image files (PNG is a still image format, anyway). There's one change needed to avoid a quirk of ffmpeg which will duplicate frames. I've added that to the command.  
  
  ---
  
  