Answers.Body: <p><code>r_frame_rate</code> is "<em>the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream).</em>"</p>
  
  <p><code>avg_frame_rate</code> is just that: <code>total duration / total # of frames</code></p>
  
  <p>You can just specify <code>-r 30000/1001</code> to maintain the average rate (near-abouts). You don't specify which format you're outputting to, but for MP4, ffmpeg defaults to constant-frame rate, where it picks <code>r_frame_rate</code> as the value. It will then duplicate or drop frames to keep that rate. Use <code>-vsync vfr</code> to keep the variable rate.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T19:08:18.000Z
Answers.Text: Wow... You're impressive. The first line comes from the FAQ. Any idea where this is mentioned in the `man` page? Yes, I'm encoding in MP4. Where did you get that info about the constant frame rate picking? I ended up setting `-r` to the input `avg_frame_rate`. (My client expect temporal constancy between the frames.)
Answers.UserDisplayName: Atcold
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T19:24:14.133Z
Answers.Text: `r_frame_rate` is not a CLI option, so I doubt the man pages mention it, although I haven't looked.  You have to look in the mp4 muxer source to check the default rate muxing mode. Again, not in the man pages. FFmpeg docs are a work in progress.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T20:27:12.970Z
Answers.Text: Again, impressive. Thank you for sharing your knowledge.
Answers.UserDisplayName: Atcold
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-27T17:58:45.380Z
Answers.LastActivityDate: 2017-02-27T17:58:45.380Z
Answers.UserDisplayName: Gyan
Body: <p>What is the default output frame rate chosen by <code>ffmpeg</code> to encode MP4s?<br>
  Where is this specified on the <code>man</code> page?</p>
  
  <p>My input video stats are:</p>
  
  <ul>
  <li><code>r_frame_rate=120/1</code></li>
  <li><code>avg_frame_rate=31230000/1042111</code></li>
  <li><code>duration=11.579011</code></li>
  <li><code>nb_frames=347</code></li>
  </ul>
  
  <p>After (demuxing, decoding) splitting (rescaling, encoding and muxing) the video stream I end up with has the following stats:</p>
  
  <ul>
  <li><code>r_frame_rate=120/1</code></li>
  <li><code>avg_frame_rate=120/1</code></li>
  <li><code>duration=9.575000</code></li>
  <li><code>nb_frames=1149</code></li>
  </ul>
  
  <p>I started with <code>347</code> frames and ended up with <code>1149</code> (should have been <code>287</code>).
  The input average fps was <code>29.97</code> and now I end up with <code>120</code>... which was the max fps of the input video.
  So, I imagine <code>ffmpeg</code> picks the highest one from the input... but is this specified anywhere?
  How does one go simply matching the input fps?
  And why does I have a variable fps to begin with?</p>
  
  <p>Hmm... too may questions I guess.
  Still, is this simply a consequence of this paragraph?</p>
  
  <pre><code>STREAM SELECTION                                                 
         By default, ffmpeg includes only one stream of each type  
         (video, audio, subtitle) present in the input files and   
         adds them to each output file.  It picks the "best" of    
         each based upon the following criteria: for video, it is  
         the stream with the highest resolution, for audio, it is  
         the stream with the most channels, for subtitles, it is   
         the first subtitle stream. In the case where several      
         streams of the same type rate equally, the stream with the
         lowest index is chosen.                                   
  </code></pre>
  
Tags: <ffmpeg>
Title: ffmpeg default output frame rate
UserDisplayName: Atcold
ThreadText: # ffmpeg default output frame rate
  
  (Asked by: username_0 on 2017-02-27)
  
  What is the default output frame rate chosen by `ffmpeg` to encode MP4s?  
  Where is this specified on the `man` page?
  
  My input video stats are:
  
  * `r_frame_rate=120/1`
  * `avg_frame_rate=31230000/1042111`
  * `duration=11.579011`
  * `nb_frames=347`
  
  After (demuxing, decoding) splitting (rescaling, encoding and muxing) the video stream I end up with has the following stats:
  
  * `r_frame_rate=120/1`
  * `avg_frame_rate=120/1`
  * `duration=9.575000`
  * `nb_frames=1149`
  
  I started with `347` frames and ended up with `1149` (should have been `287`).
  The input average fps was `29.97` and now I end up with `120`... which was the max fps of the input video.
  So, I imagine `ffmpeg` picks the highest one from the input... but is this specified anywhere?
  How does one go simply matching the input fps?
  And why does I have a variable fps to begin with?
  
  Hmm... too may questions I guess.
  Still, is this simply a consequence of this paragraph?
  
  ```
  STREAM SELECTION                                                 
         By default, ffmpeg includes only one stream of each type  
         (video, audio, subtitle) present in the input files and   
         adds them to each output file.  It picks the "best" of    
         each based upon the following criteria: for video, it is  
         the stream with the highest resolution, for audio, it is  
         the stream with the most channels, for subtitles, it is   
         the first subtitle stream. In the case where several      
         streams of the same type rate equally, the stream with the
         lowest index is chosen.                                   
  
  ```
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-27. Score: 17 | Accepted answer
  
  `r_frame_rate` is "*the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream).*"
  
  `avg_frame_rate` is just that: `total duration / total # of frames`
  
  You can just specify `-r 30000/1001` to maintain the average rate (near-abouts). You don't specify which format you're outputting to, but for MP4, ffmpeg defaults to constant-frame rate, where it picks `r_frame_rate` as the value. It will then duplicate or drop frames to keep that rate. Use `-vsync vfr` to keep the variable rate.
  
  > **Comments:**
  > **username_0**: Wow... You're impressive. The first line comes from the FAQ. Any idea where this is mentioned in the `man` page? Yes, I'm encoding in MP4. Where did you get that info about the constant frame rate picking? I ended up setting `-r` to the input `avg_frame_rate`. (My client expect temporal constancy between the frames.)  
  > **username_1**: `r_frame_rate` is not a CLI option, so I doubt the man pages mention it, although I haven't looked.  You have to look in the mp4 muxer source to check the default rate muxing mode. Again, not in the man pages. FFmpeg docs are a work in progress.  
  > **username_0**: Again, impressive. Thank you for sharing your knowledge.  
  
  ---
  
  