Search code examples
videohtml5-videohttp-live-streamingwebm

Is it worth using HLS/DASH for web videos, or should I stick with webm/mp4


I am working on a system that will need to host large videos (~1 hour long).
So I am considering 2 solutions:

  1. Convert the uploaded video to few webm files with different resolutions (4k, 1080p, 720p, ...)
    and a single mp4 as fallback and serve them directly.
  2. Convert the uploaded file to HLS segments (also in multiple resolutions)
    and generate both HLS and DASH playlists and serve them as such.

From what I understand HLS has the advantage of being segmented, so files will be only downloaded when actually playing the video and only in format that the client internet connection can keep up to.

On the other hand webm could be in theory downloaded using HTTP range requests, but not every server can handle it correctly and I am not sure if browsers will always use range requests instead of downloading the entire file.

Will using HLS help reduce network usage of the the server, or is it better to stick with webm?
Are there any other advantages of using one solution vs the other?


Solution

  • HLS vs mp4:

    For longer videos, I think streaming (HLS/DASH) is better.

    1. There are no Media queries for video - you'll need to choose the webm/mp4 using JS and then that's it. your choice is final. For example - if your page logic decides to serve 480p to a device based on the screen size, and then the user goes full screen - the video will remain 480p.
    2. HLS will pick the size based on the screen - but also the network connection - so if the connection is slow, it will drop to a lower version of the video to ensure playback.

    I think the biggest thing is - building HTTP range requests for videos - might work, but there is a robust infrastructure with supported video players and delivery that you can just add into your pipeline, and know that they will work - saving time, debugging, etc.

    If you're going to re-encode these videos I think streaming is the way to go.