title: Why does ffmpeg report different durations?
body: <p>Source videos: <a href="http://www.artworknotavailable.com/tmp/ffmpegtest" rel="noreferrer">http://www.artworknotavailable.com/tmp/ffmpegtest</a></p>
  
  <p>Quicktime Pro 7.7.1 Inspector (Win 7) reports the following for the file 2398.mov</p>
  
  <blockquote>
    <p>4.19MB<br>
    H.264<br>
    Movie FPS: 23.98<br>
    Data Rate: 2.35 mbits/Sec<br>
    Duration 14:97<br></p>
  </blockquote>
  
  <p>ffmpeg reports the following (see full ffmpeg version info at bottom of post)</p>
  
  <blockquote>
    <p>ffmpeg -i 2398.mov</p>
    
    <p>Seems stream 1 codec frame rate differs from container frame rate: 47952.00 (47952/1) -> >23.98 (2997/125)<br>
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2398.mov':<br>
     Metadata:<br>
       major_brand     : qt<br></p>
    
    <blockquote>
      <p>minor_version   : 537199360<br>
         compatible_brands: qt<br>
       Duration: 00:00:15.97, start: 0.-963005, bitrate: 2210 kb/s<br>
         Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16, 152 kb/s<br>
         Stream #0.1(eng): Video: h264, yuv420p, 848x480, 2060 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47952 tbc<br></p>
    </blockquote>
  </blockquote>
  
  <p>One second longer than what Quicktime reports.</p>
  
  <p>As an experiment I exported this file from Quicktime Pro using the following settings:</p>
  
  <blockquote>
    <p>Frame Rate: Current<br>
    Key Frames: Every 24 frames<br>
    Frame Reordering On<br>
    Quality: High<br>
    Encoding Best<br>
    Data Rate: Automatic<br>
    Optimized for Download<br>
    Output file: qtime-export-2398.mov</p>
  </blockquote>
  
  <p>Quicktime Inspector reports:</p>
  
  <blockquote>
    <p>5.62 MB<br>
    H.264<br>
    Movie FPS: 23.98<br>
    Data Rate: 3.15 mbits/Sec<br>
    Duration 14:97<br></p>
  </blockquote>
  
  <p>ffmpeg now reports:</p>
  
  <blockquote>
    <p>ffmpeg -i qtime-export-2398.mov</p>
    
    <p>Seems stream 1 codec frame rate differs from container frame rate: 1200.00 (1200/1) -> 23.98 (24000/1001)<br>
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'qtime-export-2398.mov':<br>
     Metadata:<br>
       major_brand     : qt<br>
       minor_version   : 537199360<br>
       compatible_brands: qt<br>
     Duration: 00:00:14.96, start: 0.000000, bitrate: 3153 kb/s<br>
       Stream #0.0(eng): Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s<br>
       Stream #0.1(eng): Video: h264, yuv420p, 678x384, 1738 kb/s, 23.98 fps, 23.98 tbr, 600 tbn, 1200 tbc<br></p>
  </blockquote>
  
  <p>ffmpeg's report on duration went from 15.97 to 14.96 (I can live with .1)</p>
  
  <p>Is this duration calculated from the bitrate? </p>
  
  <p>I need to accurately report the duration of uploaded videos as well as convert them to FLV. Can somebody tell me what is going on here and how I might get around this?</p>
  
  <p>ffmpeg info below. I've tried this on 2 completely different installs/versions of ffmpeg. Same result.</p>
  
  <blockquote>
    <p>FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
      built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
      configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
      libavutil     50.15. 1 / 50.15. 1
      libavcodec    52.72. 2 / 52.72. 2
      libavformat   52.64. 2 / 52.64. 2
      libavdevice   52. 2. 0 / 52. 2. 0
      libavfilter    1.19. 0 /  1.19. 0
      libswscale     0.11. 0 /  0.11. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    FFmpeg 0.6.5
    libavutil     50.15. 1 / 50.15. 1
    libavcodec    52.72. 2 / 52.72. 2
    libavformat   52.64. 2 / 52.64. 2
    libavdevice   52. 2. 0 / 52. 2. 0
    libavfilter    1.19. 0 /  1.19. 0
    libswscale     0.11. 0 /  0.11. 0
    libpostproc   51. 2. 0 / 51. 2. 0</p>
  </blockquote>