0

Using a PHP library that relies on ffmpeg, I was able to encrypt a bunch of videos (mostly mp4 but not all) to HLS m3u8 playlists of encrypted fragments. Using https://github.com/video-dev/hls.js, my website is able to play those videos in most browsers but not on iOS 12.

https://caniuse.com/#search=hls says that iOS 13.2+ is required for HLS videos, but I need to be able to support phones as old as iPhone 6, which can only run iOS 12 and lower.

I'd be shocked if there isn't a way to do what I'm looking to do:

When I start over, what should I use to encrypt videos to a format (which format?) that is viewable in browsers on Mac, Windows 10, iOS 12, and Android (using which client-side libraries, if required)?

P.S. @Izzy Thanks for the questions. A PHP library would be ideal, but PHP can also call other programs as long as they're executable in Ubuntu (Linux). Yes, free ($0). By "encrypt", I mean that (like HLS) there is a key/password that the system uses when encrypting the videos, and then the browser/client has also knows that key and uses it for decryption. For quality, resolution, etc, I want as close to lossless as possible. I don't see why encryption would require any loss (hopefully not). Maybe someone here knows of an HLS alternative that suits my needs (would DASH?).

1

Alas there's no one media format(*) that can address "browsers on Mac, Windows 10, iOS 12, and Android" simultaneously. Your best bet is to encode in two formats: HLS (for the legacy Apple side of things) and MPEG-DASH (for the rest of the world).

There are some commercial tools, such as Unified Streaming or Wowza which will let you encode once to a "mezzanine file" (basically a set of MP4 files, one per bitrate) and then allow you to convert them on the fly to the format the requesting device is capable of handling, including DRM.

Otherwise, you can roll your own multi-format streams using tools like the open-source Shaka Packager, which will let you manually encode & encrypt to both MPEG-DASH (+Widevine DRM) and HLS (+FairPlay DRM).

(*) Technically, there is one nowadays -- CMAF. This article is a good primer on it, but player support for CMAF is still patchy at best.

| improve this answer | |
  • Thanks. +1 for effort. Unfortunately iOS 12 does not support HLS or probably any of those other approaches. I’m shocked at how complicated or impossible what I thought such a simple project is. – Ryan Apr 23 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.