'Supporting HEVC/H.265 videos in Electron

Chrome/Electron don't normally support H.265 videos. I want the user to be able to play .mov files recorded by Apple devices in my app. How can I do this?

Possible approaches:

  1. Use ffmpeg to transcode to H.264 in real-time, which will be resource intensive (not ideal)
  2. Use WebAssembly to render the video in a <canvas> tag (not ideal)
  3. Fork and manually add H.265 codec support to Chrome/Electron like https://github.com/AAAhs/electron-hevc (overkill)
  4. Use a native module that renders the video in a <canvas> or BrowserView


Solution 1:[1]

We ran into a similar problem on our project where users from the iOS app were sending video messages to browser users. In the end, the easiest solution to the problem was to record the video manually in the h264 codec. An example from the documentation:

https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/capturing_video_in_alternative_formats

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 twofed