Answers.Body: <h1>Image inputs</h1>
  <p>Default frame rate for image inputs is 25. You can change it with the <code>-framerate</code> input option. Example for 24 fps:</p>
  <pre><code>ffmpeg -framerate 24 -i input_%03d.jpg -vf format=yuv420p output.mp4
  </code></pre>
  <ul>
  <li><code>-vf format=yuv420p</code> (or the legacy alias <code>-pix_fmt yuv420p</code>) will ensure compatible <a href="https://en.wikipedia.org/wiki/Chroma_subsampling" rel="noreferrer">chroma subsampling</a> for MP4. Otherwise, <code>ffmpeg</code> will try to preserve color fidelity, but most players can't handle advanced chroma subsampling.</li>
  <li>The output will use the same frame rate as the input. So you do not need to set an output frame rate. But there are a few reasons to do so. See <em>Using a different frame rate for image inputs and video output</em> below.</li>
  </ul>
  <h1>Video inputs</h1>
  <p>Use the <code>-r</code> output option:</p>
  <pre><code>ffmpeg -i input.mp4 -r 25 output.mp4
  </code></pre>
  <hr />
  <h2>Using a different frame rate for image inputs and video output</h2>
  <p>Why? For example, you may want all images to be displayed for 1 second each (1 fps). But most players can't play very low frame rates (about 6 fps or lower). So you can make <code>ffmpeg</code> use a different output frame rate. The output will look like 1 fps, but will actually be a normal frame rate, such as 25 fps.</p>
  <p>Example: input images at 1 fps, but make the output 25 fps.</p>
  <pre><code>ffmpeg -framerate 1 -i input_%03d.png -r 25 output.mp4
  </code></pre>
  <ul>
  <li>Frames will be duplicated or dropped to match the desired output frame rate.</li>
  <li>The <a href="https://ffmpeg.org/ffmpeg-formats.html#image2-1" rel="noreferrer">image demuxer</a> uses <code>-framerate</code>, while the output frame rate is set using <code>-r</code>.</li>
  </ul>
  <h3>Error: Option framerate not found</h3>
  <p>The <code>-framerate</code> option:</p>
  <ul>
  <li>Is not a generic option. It doesn't work for everything.</li>
  <li>Is only an input option.</li>
  <li>Only works with certain <a href="https://ffmpeg.org/ffmpeg-formats.html" rel="noreferrer">demuxers</a> (including: images, x11grab, rawvideo).</li>
  <li>You probably only need to use the <code>-r</code> output option. See the <em>Video inputs</em> section above.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-04T11:26:32.307Z
Answers.Text: ffmpeg version 3.2.2 tells me: `Option framerate not found.` :-(
Answers.UserDisplayName: erik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-04T21:24:09.327Z
Answers.Text: Yes, you are right. But nevertheless the option `-framerate` does not exist anymore. I will delete my comment, as it really has nothing to do with converting a series of images to a video with a certain framerate.
Answers.UserDisplayName: erik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-04T22:33:14.627Z
Answers.Text: @erik `-framerate` does exist. It's used by the image and rawvideo demuxers and some input devices such as x11grab and v4l2.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-06T09:29:53.440Z
Answers.Text: Oh, ok. Sorry for the noise.
Answers.UserDisplayName: erik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T17:02:49.737Z
Answers.Text: Where is the option `-framerate` documented? I've read the `man ffmpeg` page, but I couldn't find it. Any pointer, perhaps?
Answers.UserDisplayName: Atcold
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T17:12:47.213Z
Answers.Text: OK, found it... `FFMPEG-DEVICES(1)`.
Answers.UserDisplayName: Atcold
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-01T21:48:45.783Z
Answers.Text: For MP4 to MP4 conversion, `ffmpeg -y -i in.mp4 -r 30 out.mp4` just worked. `-framerate` seems to not work in this case.
Answers.UserDisplayName: Thomas Weller
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-01T21:50:41.227Z
Answers.Text: @ThomasWeller `-framerate` is not a generic option. It is a special input option only for certain demuxers: image inputs, some capturing inputs such as x11grab and v4l2 and a few others. The original question was about images, so that's why the answer involves `-framerate`, although it seems like many users are not noticing this. I'll update the answer.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-11-19T19:02:01.517Z
Answers.LastActivityDate: 2021-04-01T22:29:25.117Z
Answers.LastEditDate: 2021-04-01T22:29:25.117Z
Answers.UserDisplayName: llogan
Answers.Body: <pre><code>ffmpeg -framerate 30 -i img%03d.png output.mp4  
  </code></pre>
  
  <p>will be sufficient in the latest version of ffmpeg.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-19T07:18:50.880Z
Answers.Text: Dont forget the `-pix_fmt yuv420p` or you may end up with files that many software tools don't like: https://trac.ffmpeg.org/ticket/8856
Answers.UserDisplayName: bers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-03T17:33:35.900Z
Answers.Text: I don't see how that would be sufficient since the input is at 7 fps. That frame rate has to appear somewhere.
Answers.UserDisplayName: Alexis Wilke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-31T13:04:06.583Z
Answers.LastActivityDate: 2018-07-31T13:04:06.583Z
Answers.UserDisplayName: Trect
Answers.Body: <p>You are talking about video interpolation. There is no way for 7 fps to become 30 fps without video interpolation... Basically you want to get 30fps from the start, in the process of making videos... As video interpolation will take lots of resources and time, and it might be filled with artifacts. I heard you can make a single shot picture into a short movies, with adobe, but lots of manual work there...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-08T10:26:14.040Z
Answers.Text: Ah, sure there is. Modern neuronal networks can do a lot of fun things along these lines, cf. https://www.youtube.com/c/DenisShiryaev/videos
Answers.UserDisplayName: Matthias Urlichs
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-07T07:56:57.257Z
Answers.LastActivityDate: 2020-10-07T07:56:57.257Z
Answers.UserDisplayName: Alvydas Jokubauskas
Answers.Body: <p>It sounds like you may the resultant video to have 30 frames per second for compatibility with certain devices (e.g. a DVD player), but you want the content to play back at an effective 7 frames per second to maintain the original temporal resolution. In that case, you'll need to use an FFmpeg video filter like <a href="https://unix.stackexchange.com/questions/178503/ffmpeg-interpolate-frames-or-add-motion-blur">tblend</a> or <a href="https://www.reddit.com/r/ffmpeg/comments/herifq/minterpolate_to_reduce_image_sequence_framerate/" rel="nofollow noreferrer">minterpolate</a> to interpolate the 7 frames' worth of content to 30 frames (with varying visual changes), or use a third party application like <a href="https://github.com/dthpham/butterflow" rel="nofollow noreferrer">butterflow</a> which itself uses FFmpeg.</p>
  <p>If you purely want the 7 fps source content to be sped up to 30 fps (shortening the playback time ~4:1) then the other <code>-framerate</code> based answers will suffice.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-25T23:02:43.053Z
Answers.LastActivityDate: 2021-05-25T23:02:43.053Z
Answers.UserDisplayName: Chris Woods
Answers.Body: <p>I'm using the below code to do the same thing.</p>
  
  <pre><code>ffmpeg -framerate 30 -i img%03d.png -c:v libx264 -pix_fmt yuv420p -crf 23 output.mp4
  </code></pre>
  
  <p>Breaking down the command:</p>
  
  <pre><code>ffmpeg             &lt;- call ffmpeg
    -framerate 30    &lt;- set the input framerate to 30
    -i img%03d.png   &lt;- read PNG images with filename img001, img002, img003, etc..
                       img can be changed to another prefix
                       %03d can be changed to %04d for 0001, %05d for 00001 formats, etc...
    -c:v libx264     &lt;- Set the codec to libx264
    -pix_fmt yuv420p &lt;- Set the pixel format to planar YUV 4:2:0, 12bpp
    -crf 23          &lt;- set the Constant Rate Factor to 23 (default value)
    -output.mp4      &lt;- the output filename
  </code></pre>
  
  <p>This reads the input at 30 fps (the <code>-framerate 30</code> option) and encodes it using the <code>libx264</code> codec with <a href="https://trac.ffmpeg.org/wiki/Encode/H.264#crf" rel="noreferrer">constant rate factor</a> of 23 (the <code>-crf 23</code> option).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-03T17:28:36.383Z
Answers.Text: How do you compute the `-crf` value? What does it represent compared to the 30 fps and 7 frames per second in the source? (i.e. is it "30 - 7 = 23"?)
Answers.UserDisplayName: Alexis Wilke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-03T19:24:22.137Z
Answers.Text: It's not related to the fps (I think). Did you read the linked page about the constant rate factor (crf)?
Answers.UserDisplayName: Saaru Lindestøkke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T00:08:12.590Z
Answers.Text: Oh, yeah, so I really don't understand how your answer was chosen as the answer. It's wrong. In OP's question, the input FPS is 7 and the output 30. You are not taking care of that in your examples.
Answers.UserDisplayName: Alexis Wilke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T05:48:02.390Z
Answers.Text: Thanks for trying to improve my answer. I don't entirely follow, Could you perhaps explain what is not being addressed? The question asker wants a video that plays 30 of their frames per second. The command in my answer outputs 30 frames per second. The framerate at which the frames are captured (7) seems not relevant, right?
Answers.UserDisplayName: Saaru Lindestøkke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T16:26:30.973Z
Answers.Text: Assuming you count from 1, frames 1 to 7 from the input have to be played in 1 second (spread over 30 frames in the output video). Then frames 8 to 15 will be played on the 2nd second of the output video. Etc. I think that with your command line you will end up playing 30 frames of input in 1 second (a little over 4 times too fast).
Answers.UserDisplayName: Alexis Wilke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-04T17:20:24.240Z
Answers.Text: That's certainly one way to interpret it, but the question asker did not specify that that's what they want, so I gave an answer based on my interpretation. As the question asker did not post comments (e.g. "it's playing way too fast now") and accepted the answer it appears the answer was helpful (to some extent). Feel free to edit my answer if you believe it displays incorrect information or post your own answer if you would like to obtain reputation points.
Answers.UserDisplayName: Saaru Lindestøkke
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-11-19T13:20:25.217Z
Answers.LastActivityDate: 2018-07-31T13:24:26.813Z
Answers.LastEditDate: 2018-07-31T13:24:26.813Z
Answers.UserDisplayName: Saaru Lindestøkke
Body: <p>I have no knowledge whatsoever about video encoding, I have an application written in OpenGL and I am saving the frames it generated into <code>png</code> images. The frames from my app are at 7 FPS and I am trying to create a video from those.</p>
  
  <p>To that purpose I use ffmpeg like this</p>
  
  <p><code>ffmpeg -framerate 30 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4</code></p>
  
  <p>which was taken <a href="https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images">from this site</a>, however I was wondering if it is possible to have a video that shows the animation at 30 FPS?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-04T00:03:01.070Z
Comments.Text: [Similar question](https://askubuntu.com/questions/1012113/how-to-make-video-out-of-frames-with-a-given-frame-rate) and [manual](http://manpages.ubuntu.com/manpages/xenial/man1/ffmpeg.1.html).
Comments.UserDisplayName: dma_k
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-18T14:33:01.683Z
Comments.Text: Just tweak the `-framerate` parameter to get the desired results.
Comments.UserDisplayName: tripulse
Tags: <ffmpeg>
Title: How to encode a video at 30 FPS from images taken at 7 FPS
UserDisplayName: BRabbit27
ThreadText: # How to encode a video at 30 FPS from images taken at 7 FPS
  
  (Asked by: username_0 on 2014-11-19)
  
  I have no knowledge whatsoever about video encoding, I have an application written in OpenGL and I am saving the frames it generated into `png` images. The frames from my app are at 7 FPS and I am trying to create a video from those.
  
  To that purpose I use ffmpeg like this
  
  `ffmpeg -framerate 30 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4`
  
  which was taken [from this site](https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images), however I was wondering if it is possible to have a video that shows the animation at 30 FPS?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: [Similar question](https://askubuntu.com/questions/1012113/how-to-make-video-out-of-frames-with-a-given-frame-rate) and [manual](http://manpages.ubuntu.com/manpages/xenial/man1/ffmpeg.1.html).  
  > **username_2**: Just tweak the `-framerate` parameter to get the desired results.  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_13 on 2014-11-19. Score: 30 | Accepted answer
  
  I'm using the below code to do the same thing.
  
  ```
  ffmpeg -framerate 30 -i img%03d.png -c:v libx264 -pix_fmt yuv420p -crf 23 output.mp4
  
  ```
  
  Breaking down the command:
  
  ```
  ffmpeg             <- call ffmpeg
    -framerate 30    <- set the input framerate to 30
    -i img%03d.png   <- read PNG images with filename img001, img002, img003, etc..
                       img can be changed to another prefix
                       %03d can be changed to %04d for 0001, %05d for 00001 formats, etc...
    -c:v libx264     <- Set the codec to libx264
    -pix_fmt yuv420p <- Set the pixel format to planar YUV 4:2:0, 12bpp
    -crf 23          <- set the Constant Rate Factor to 23 (default value)
    -output.mp4      <- the output filename
  
  ```
  
  This reads the input at 30 fps (the `-framerate 30` option) and encodes it using the `libx264` codec with [constant rate factor](https://trac.ffmpeg.org/wiki/Encode/H.264#crf) of 23 (the `-crf 23` option).
  
  > **Comments:**
  > **username_9**: How do you compute the `-crf` value? What does it represent compared to the 30 fps and 7 frames per second in the source? (i.e. is it "30 - 7 = 23"?)  
  > **username_13**: It's not related to the fps (I think). Did you read the linked page about the constant rate factor (crf)?  
  > **username_9**: Oh, yeah, so I really don't understand how your answer was chosen as the answer. It's wrong. In OP's question, the input FPS is 7 and the output 30. You are not taking care of that in your examples.  
  > **username_13**: Thanks for trying to improve my answer. I don't entirely follow, Could you perhaps explain what is not being addressed? The question asker wants a video that plays 30 of their frames per second. The command in my answer outputs 30 frames per second. The framerate at which the frames are captured (7) seems not relevant, right?  
  > **username_9**: Assuming you count from 1, frames 1 to 7 from the input have to be played in 1 second (spread over 30 frames in the output video). Then frames 8 to 15 will be played on the 2nd second of the output video. Etc. I think that with your command line you will end up playing 30 frames of input in 1 second (a little over 4 times too fast).  
  > **username_13**: That's certainly one way to interpret it, but the question asker did not specify that that's what they want, so I gave an answer based on my interpretation. As the question asker did not post comments (e.g. "it's playing way too fast now") and accepted the answer it appears the answer was helpful (to some extent). Feel free to edit my answer if you believe it displays incorrect information or post your own answer if you would like to obtain reputation points.  
  
  ---
  
  ### Answer by username_3 on 2014-11-19. Score: 36
  
  # Image inputs
  
  Default frame rate for image inputs is 25. You can change it with the `-framerate` input option. Example for 24 fps:
  
  ```
  ffmpeg -framerate 24 -i input_%03d.jpg -vf format=yuv420p output.mp4
  
  ```
  
  * `-vf format=yuv420p` (or the legacy alias `-pix_fmt yuv420p`) will ensure compatible [chroma subsampling](https://en.wikipedia.org/wiki/Chroma_subsampling) for MP4. Otherwise, `ffmpeg` will try to preserve color fidelity, but most players can't handle advanced chroma subsampling.
  * The output will use the same frame rate as the input. So you do not need to set an output frame rate. But there are a few reasons to do so. See *Using a different frame rate for image inputs and video output* below.
  
  # Video inputs
  
  Use the `-r` output option:
  
  ```
  ffmpeg -i input.mp4 -r 25 output.mp4
  
  ```
  
  ---
  
  ## Using a different frame rate for image inputs and video output
  
  Why? For example, you may want all images to be displayed for 1 second each (1 fps). But most players can't play very low frame rates (about 6 fps or lower). So you can make `ffmpeg` use a different output frame rate. The output will look like 1 fps, but will actually be a normal frame rate, such as 25 fps.
  
  Example: input images at 1 fps, but make the output 25 fps.
  
  ```
  ffmpeg -framerate 1 -i input_%03d.png -r 25 output.mp4
  
  ```
  
  * Frames will be duplicated or dropped to match the desired output frame rate.
  * The [image demuxer](https://ffmpeg.org/ffmpeg-formats.html#image2-1) uses `-framerate`, while the output frame rate is set using `-r`.
  
  ### Error: Option framerate not found
  
  The `-framerate` option:
  
  * Is not a generic option. It doesn't work for everything.
  * Is only an input option.
  * Only works with certain [demuxers](https://ffmpeg.org/ffmpeg-formats.html) (including: images, x11grab, rawvideo).
  * You probably only need to use the `-r` output option. See the *Video inputs* section above.
  
  > **Comments:**
  > **username_4**: ffmpeg version 3.2.2 tells me: `Option framerate not found.` :-(  
  > **username_4**: Yes, you are right. But nevertheless the option `-framerate` does not exist anymore. I will delete my comment, as it really has nothing to do with converting a series of images to a video with a certain framerate.  
  > **username_3**: @username_4 `-framerate` does exist. It's used by the image and rawvideo demuxers and some input devices such as x11grab and v4l2.  
  > **username_4**: Oh, ok. Sorry for the noise.  
  > **username_5**: Where is the option `-framerate` documented? I've read the `man ffmpeg` page, but I couldn't find it. Any pointer, perhaps?  
  > **username_5**: OK, found it... `FFMPEG-DEVICES(1)`.  
  > **username_6**: For MP4 to MP4 conversion, `ffmpeg -y -i in.mp4 -r 30 out.mp4` just worked. `-framerate` seems to not work in this case.  
  > **username_3**: @username_6 `-framerate` is not a generic option. It is a special input option only for certain demuxers: image inputs, some capturing inputs such as x11grab and v4l2 and a few others. The original question was about images, so that's why the answer involves `-framerate`, although it seems like many users are not noticing this. I'll update the answer.  
  
  ---
  
  ### Answer by username_7 on 2018-07-31. Score: 2
  
  ```
  ffmpeg -framerate 30 -i img%03d.png output.mp4  
  
  ```
  
  will be sufficient in the latest version of ffmpeg.
  
  > **Comments:**
  > **username_8**: Dont forget the `-pix_fmt yuv420p` or you may end up with files that many software tools don't like: https://trac.ffmpeg.org/ticket/8856  
  > **username_9**: I don't see how that would be sufficient since the input is at 7 fps. That frame rate has to appear somewhere.  
  
  ---
  
  ### Answer by username_10 on 2020-10-07. Score: 1
  
  You are talking about video interpolation. There is no way for 7 fps to become 30 fps without video interpolation... Basically you want to get 30fps from the start, in the process of making videos... As video interpolation will take lots of resources and time, and it might be filled with artifacts. I heard you can make a single shot picture into a short movies, with adobe, but lots of manual work there...
  
  > **Comments:**
  > **username_11**: Ah, sure there is. Modern neuronal networks can do a lot of fun things along these lines, cf. https://www.youtube.com/c/DenisShiryaev/videos  
  
  ---
  
  ### Answer by username_12 on 2021-05-25. Score: 0
  
  It sounds like you may the resultant video to have 30 frames per second for compatibility with certain devices (e.g. a DVD player), but you want the content to play back at an effective 7 frames per second to maintain the original temporal resolution. In that case, you'll need to use an FFmpeg video filter like [tblend](https://unix.stackexchange.com/questions/178503/ffmpeg-interpolate-frames-or-add-motion-blur) or [minterpolate](https://www.reddit.com/r/ffmpeg/comments/herifq/minterpolate_to_reduce_image_sequence_framerate/) to interpolate the 7 frames' worth of content to 30 frames (with varying visual changes), or use a third party application like [butterflow](https://github.com/dthpham/butterflow) which itself uses FFmpeg.
  
  If you purely want the 7 fps source content to be sped up to 30 fps (shortening the playback time ~4:1) then the other `-framerate` based answers will suffice.
  
  
  ---
  
  