ndbroadbent
ndbroadbent

Reputation: 13803

Is it a good idea to use HLS for short videos (max 15 seconds)?

I'm building an iOS app that will stream videos with a maximum length of 15 seconds. I read good things about HLS, so I've been transcoding videos with a segment size of 5 seconds. It's good that if the first part of the video takes too long to load, then we can fall back to a lower quality for the next 10 seconds.

However, I'm not sure if the added complexity is worth it. The main disadvantage is that we need to transcode additional videos for web. Another problem is that AVPlayer on iOS is basically a black box, and it would be difficult or impossible to build features such as caching segments to disk, or re-using the bandwidth measurements between videos. I think we would have to build our own HLS player from scratch so that we can have these features, and that would take a lot of effort.

Upvotes: 5

Views: 1570

Answers (2)

Anton
Anton

Reputation: 11

If you have a good share of mobile users (which is your case) and you deliver short HD videos weighting 3MB or more, HLS is useful.

However, you cannot stick to Apple general recommendations to define the bitrate ladder and the encoding parameters. First, with short videos you should use short chunks. Second, per-title encoding becomes really important, in order to optimise the weight for a target visual quality.

You may check this short video that shows HLS at work for a short (9 seconds) clip with different connection conditions. I prepared it for a post in freecodecamp addressing this issue.

You may either encode the videos with ffmpeg or use a cloud service if you don't want to do the developmet effort. Encoding of short videos externally can be quite cheap. The point here is to ensure that the encoding parameters -chunk duration, resolutions and bitrates- are adapted to your content.

Upvotes: 1

Swaroop
Swaroop

Reputation: 91

If the videos are just 15 seconds long it may be overkill to use HLS. Yes AVPlayer is a blackbox and in my experience I haven't seen it handing bitrate switching after playing only one segment. I think it behaves in exactly opposite way, i.e. it starts playing from lower bitrate and then bumps to higher bitrates (Not completely sure about this one).

About writing a custom player, You can send all requests from AVPlayer through a local http proxy and try to put intelligent caching logic there. I have seen some apps doing this for DRM protected content but doing it for non-DRM content may not be approved by app-store.

Upvotes: 2

Related Questions