title: Why is long video taking long time before VideoJS player gets metadata to start playing?
body: <p>Does anyone know why it is taking so long before the <code>loadedmetadata</code> event is fired for longer videos?</p>
  
  <p>Here is an example: <a href="https://www.la1tv.co.uk/player/124/260" rel="nofollow">https://www.la1tv.co.uk/player/124/260</a></p>
  
  <p>I can see in developer tools that the file is still downloading when the event is fired, so it's not like it's having to download the whole file, it's just having to get quite far though before the event is fired.</p>
  
  <p>The ffmpeg command I am using to encode the video from java is:</p>
  
  <pre><code>RuntimeHelper.executeProgram(new String[] {config.getString("ffmpeg.location"), "-y", "-nostdin", "-timelimit", ""+config.getInt("ffmpeg.videoEncodeTimeLimit"), "-progress", ""+f.progressFile.getAbsolutePath(), "-i", source.getAbsolutePath(), "-vf", "scale=trunc(("+f.h+"*a)/2)*2:"+f.h, "-strict", "experimental", "-acodec", "aac", "-b:a", f.aBitrate+"k", "-ac", "2", "-ar", "48000", "-vcodec", "libx264", "-vprofile", "main", "-g", "48", "-b:v", f.vBitrate+"k", "-maxrate", f.vBitrate+"k", "-bufsize", f.vBitrate*2+"k", "-preset", "medium", "-crf", "16", "-vsync", "vfr", "-af", "aresample=async=1000", "-movflags", "+faststart", "-r", f.fr+"", "-f", "mp4", f.outputFile.getAbsolutePath()}, workingDir, null, null);
  </code></pre>
  
  <p>which can be found <a href="https://github.com/LA1TV/Website-Upload-Processor/blob/177df3797b9ba9cbeee758102d181041051e4a9a/src/main/java/uk/co/la1tv/websiteUploadProcessor/fileTypes/VODVideoFileType.java#L137" rel="nofollow">here</a>.</p>
  
  <p>It has the <code>faststart</code> flag set and I thought this meant the metadata would be inserted right at the beginning of the file?</p>
  
  <p>Could it be an issue with the encode settings?</p>
  
  <p>Thanks!</p>