Answers.Body: <p>I do not think it would be practical to expect FFMpeg to do something like this. However, we can note, that there is no way to actually finish this task in less than 4 minutes anyhow, so the slight overhead needed to encode the video after grabbing all the images is minor.</p>
  <p>Therefore, i would approach it in two steps:</p>
  <p>First, grab all the frames:</p>
  <pre><code>for i in {01..60}; do cp input.jpg $i.jpeg; sleep 4; done
  </code></pre>
  <p>And only then do we encode:</p>
  <pre><code>ffmpeg -r 1 -i %02d.jpeg [other encoding options you may need] [output]
  </code></pre>
  <p>Once you are satisfied, simply remove the temporary files.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-11T03:57:49.700Z
Answers.LastActivityDate: 2021-12-11T03:57:49.700Z
Answers.UserDisplayName: v010dya
Answers.Body: <p>I'm not sure what you mean by &quot;changing jpg image&quot;. If you mean that you have 15 images in total (x4 = 60 secs) then you could create an image sequence and use a framerate of 0.25 when encoding.</p>
  <p><strong>Files:</strong><br />
  image01.jpg<br />
  image02.jpg<br />
     ⁞     ⁞     ⁞<br />
  image15.jpg</p>
  <p><strong>Command:</strong></p>
  <p><code>ffmpeg -i image%02d.jpg -r 0.25</code> <em>EncoderOptions</em> <code>output.mp4</code></p>
  <p>(If the input isn't recognised, include the format: <code>ffmpeg -f image2 -i ...</code>)</p>
  <hr />
  <p>EDIT: <strong>An example with encoder options:</strong></p>
  <pre><code>ffmpeg -i image%02d.jpg -r 0.25 -pix_fmt yuv420p -c:v h264 -crf 21 -preset veryfast output.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-10T10:05:24.807Z
Answers.LastActivityDate: 2022-03-10T11:16:22.063Z
Answers.LastEditDate: 2022-03-10T11:16:22.063Z
Answers.UserDisplayName: Spiritman
Body: <p>I have this one jpg image which changes approx. every 4 seconds.
  Based on this image, I want to make a 60 second long video.</p>
  <p>I tried this.</p>
  <p><code>ffmpeg -t 60 -loop 1 -r 1 -i input.jpg -r 1 output.mp4</code></p>
  <p>This code makes a 60 second long video of the current image...</p>
  <p>But I want a video of how the image has changed in the 60 seconds.</p>
  <p>How can i do this with FFmpeg ?</p>
  <p><em>Alternatively, I thought maybe I might be able to stream the image while grabbing this stream.</em></p>
  
Tags: <ffmpeg>
Title: Create a video from a changing jpg image with FFmpeg
UserDisplayName: Tio
ThreadText: # Create a video from a changing jpg image with FFmpeg
  
  (Asked by: username_0 on 2021-03-12)
  
  I have this one jpg image which changes approx. every 4 seconds.
  Based on this image, I want to make a 60 second long video.
  
  I tried this.
  
  `ffmpeg -t 60 -loop 1 -r 1 -i input.jpg -r 1 output.mp4`
  
  This code makes a 60 second long video of the current image...
  
  But I want a video of how the image has changed in the 60 seconds.
  
  How can i do this with FFmpeg ?
  
  *Alternatively, I thought maybe I might be able to stream the image while grabbing this stream.*
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-12-11. Score: 1
  
  I do not think it would be practical to expect FFMpeg to do something like this. However, we can note, that there is no way to actually finish this task in less than 4 minutes anyhow, so the slight overhead needed to encode the video after grabbing all the images is minor.
  
  Therefore, i would approach it in two steps:
  
  First, grab all the frames:
  
  ```
  for i in {01..60}; do cp input.jpg $i.jpeg; sleep 4; done
  
  ```
  
  And only then do we encode:
  
  ```
  ffmpeg -r 1 -i %02d.jpeg [other encoding options you may need] [output]
  
  ```
  
  Once you are satisfied, simply remove the temporary files.
  
  
  ---
  
  ### Answer by username_2 on 2022-03-10. Score: 0
  
  I'm not sure what you mean by "changing jpg image". If you mean that you have 15 images in total (x4 = 60 secs) then you could create an image sequence and use a framerate of 0.25 when encoding.
  
  **Files:**  
  image01.jpg  
  image02.jpg  
     ⁞     ⁞     ⁞  
  image15.jpg
  
  **Command:**
  
  `ffmpeg -i image%02d.jpg -r 0.25` *EncoderOptions* `output.mp4`
  
  (If the input isn't recognised, include the format: `ffmpeg -f image2 -i ...`)
  
  ---
  
  EDIT: **An example with encoder options:**
  
  ```
  ffmpeg -i image%02d.jpg -r 0.25 -pix_fmt yuv420p -c:v h264 -crf 21 -preset veryfast output.mp4
  
  ```
  
  
  ---
  
  