1

I need to use a video tag to serve over 3GB of video on the web. When the page is loaded, it takes a long time for the media element to receive the 'loadedmetadata event'.

I've found that the size of the moov box is too large (33MB). So when I re-encoded it with the 'empty_moov + frag_keyframe' option of 'ffmpeg', but it also took longer to fetch all fragmented information from the 'Inspector - Network' tab in Chrome.

Is there a way to speed up loading when playing 'fragmented mp4' with html5 video tag?

  • have you encoded the video to relocate the MOOV atom to the start of the video (see https://stackoverflow.com/questions/25977044/html5-lagging-videos-mp4/26002847#26002847 ) ? – Offbeatmammal Nov 23 '17 at 02:36
  • @Offbeatmammal, Of course. 'empty_moov + frag_keyframe' option can move MOOV atom to the start of video. – Kevin Youngho Seo Nov 23 '17 at 02:41

1 Answers1

0

You don't mention what protocol you are using to the deliver the video to the browser, but fragmented MP4 is usually delivered with an ABR (Adaptive Bit Rate) streaming protocol. The most commonly used ABR protocols at the time of writing are probably HLS and DASH.

Using ABR allows the client start at a lower bit rate and hence speed up initial playback - it can then step up through different quality levels to reach the optimal quality for the particular device and the current network conditions.

You can see this effect with large streaming services where the video quality will be noticeably lower at start up and then improve after 10-20 seconds. See more more info in this answer:

Bowsers generally don't support ABR natively with the HTML5 tag - for this reason you generally will use a Javascript based player which uses the HTML5 MSE (Media Source Extensions) mechanism to support ABR. You can see open source exmamples such as:

Mick
  • 24,231
  • 1
  • 54
  • 120
  • I do not know about the protocol, but I know it's an http protocol when using video tags. Anyway, you mean that if the file size is large, there is no way to start playing fast without using ABR. Regardless of the size of moov or moof, is it impossible if the video file is large? – Kevin Youngho Seo Nov 24 '17 at 01:33
  • A player which supports streaming will generally start playing as soon as it has the header information and what it considers enough buffered frames in its buffer, so if your player and server support some form of streaming, HTTP, ABR etc then the video length is not so important. Using a low bit rate ABR initially just allows the player to get frames more quickly initially. – Mick Nov 24 '17 at 11:29