title: ffmpeg copy stream preserving FPS
body: <p>I have a stream that I know is outputting at a certain frame rate (30 FPS). I want to use ffmpeg to make a copy of this stream and save it to disk.</p>
  
  <p>I have the following command:</p>
  
  <pre><code>ffmpeg -i http://input/ -c copy -map 0 \
      -f segment -strftime 1 -segment_time 900 \
      -segment_atclocktime 1 -segment_format mp4 %Y-%m-%d_%H-%M-%S.mp4
  </code></pre>
  
  <p>But when I run the command, I see the following:</p>
  
  <pre><code>frame=   32 fps=3.9 q=-1.0 Lsize=N/A time=00:00:01.27 bitrate=N/A
  </code></pre>
  
  <p>Where it appears the FPS is hovers around ~4.0 FPS and <code>time</code> moves slower than real time.</p>
  
  <p>I tried added <code>-re</code> (copy the rate of the input stream) and <code>-r 30</code> (manually set the rate to 30 FPS) flag specified before the input file, but it didn't seem to work.</p>
  
  <p>I also read <a href="https://video.stackexchange.com/questions/13066/how-to-encode-a-video-at-30-fps-from-images-taken-at-7-fps">a similar question here</a> using <code>-framerate 30</code>, but that option doesn't exist in the man pages and is an <code>Invalid option</code>.</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <hr>
  
  <p>So I let the modified command (removing the flags <code>-c copy -map 0</code>) run for exactly 5 minutes. Running <code>ffprobe</code> yields:</p>
  
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2017-03-10_01-09-12.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf57.2.100
    Duration: 00:00:15.43, start: 0.066016, bitrate: 13416 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1024x768, 13414 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
      Metadata:
        handler_name    : VideoHandler
  </code></pre>
  
  <p>Again, this only produces 15 seconds of video and I can't seem to get a 1:1 relationship between the input stream of 30 FPS and an output stream also in 30 FPS in real time. Playing the video yields something that's sped up.</p>