title: Make total video duration instantly known in video player (ffmpeg / html)
body: <h2>TL;DR</h2>
  <p>What's the correct ffmpeg setting to prevent the video from 'lazy' loading the video's total duration?</p>
  <h2>Problem</h2>
  <p>I'm trying to transcode a video using ffmpeg (in NodeJS).
  When transcoding is finished ffmpeg uploads the video automatically to a bucket (GCP).</p>
  <p>Hoverever, the video that ffmpeg produces doesn't have a clear total duration when played in a HTML video player. It's only after x (milli)seconds that the total video duration is known and displayed.</p>
  <h2>Code</h2>
  <p>Using the fluent-ffmpeg NodeJS library:</p>
  <pre><code>const settings: VideoHDPresetSettings = {
    format: &quot;mp4&quot;,
    codec: &quot;libx264&quot;,
    size: &quot;1920x1080&quot;,
    ratio: &quot;16:9&quot;,
    options: [
      &quot;-movflags&quot;, &quot;frag_keyframe+empty_moov+faststart&quot;,
      &quot;-preset&quot;, &quot;veryfast&quot;,
      &quot;-crf&quot;, &quot;16&quot;,
    ],
  };
  
  ffmpeg({source: &quot;input.mp4&quot;})
   .format(settings.format)
   .videoCodec(settings.codec)
   .size(settings.size)
   .aspectRatio(settings.ratio)
   .outputOptions(settings.options)
   .writeToStream(outputStream);
  </code></pre>
  <p>This is fluent-ffmpeg's generated command:</p>
  <pre><code>ffmpeg -i input.mp4 -vcodec libx264 -filter:v scale=w=1920:h=1080 -f mp4 -movflags frag_keyframe+empty_moov+faststart -preset veryfast -crf 16 pipe:1
  </code></pre>
  <h2>Example</h2>
  <h4>Original</h4>
  <p>This is what I'd like it to be, when the video is loaded the total video duration is known immediatly.</p>
  <p><a href="https://storage.googleapis.com/uhasselt/problem/original" rel="nofollow noreferrer">https://storage.googleapis.com/uhasselt/problem/original</a> (expired)</p>
  <h4>Ffmpeg:</h4>
  <p>This is what the code above generates, when the video is loaded the total video duration is known yet. <em>It's pretty difficult to detect with this video, so refresh a couple of times while looking at the video's total duration on the timeline.</em></p>
  <p><a href="https://storage.googleapis.com/uhasselt/problem/ffmpeg-result" rel="nofollow noreferrer">https://storage.googleapis.com/uhasselt/problem/ffmpeg-result</a> (expired)</p>
  <h2>Question</h2>
  <p>What's the correct ffmpeg setting to prevent the video from 'lazy' loading the video's total duration? What am I doing wrong?</p>