Skip to content

5rahim/electron-media-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Electron Media Patch

Electron patches for HEVC, AC3 and E-AC3 codec support.

Versions

  • Electron v36.2.1
    • Tested on macOS
    • Tested on Windows
    • Tested on Linux

Guide

Source: Electron Build Instructions

Install depot_tools

Also, on Windows, you'll need to set the environment variable DEPOT_TOOLS_WIN_TOOLCHAIN=0. To do so, open Control Panel → System and Security → System → Advanced system settings and add a system variable DEPOT_TOOLS_WIN_TOOLCHAIN with value 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version that only Googlers have access to).

Getting the code

mkdir electron && cd electron
gclient config --name "src/electron" --unmanaged https://github.com/electron/electron
gclient sync --with_branch_heads --with_tags
# This will take a while

Update the respective folder's origin URLs for git pull

cd src/electron
git remote remove origin
git remote add origin https://github.com/electron/electron
git checkout main
git branch --set-upstream-to=origin/main
cd -

📝 gclient works by checking a file called DEPS inside the src/electron folder for dependencies (like Chromium or Node.js). Running gclient sync -f ensures that all dependencies required to build Electron match that file.

So, in order to pull, you'd run the following commands:

cd src/electron
git pull
# Checkout the tagged version
git checkout v36.2.1
# Sync the dependencies
gclient sync -f

Apply the patches

move media_hevc_ac3_chromium.patch into src/ move media_hevc_ac3_electron.patch into src/electron/ move media_hevc_ac3_ffmpeg.patch into src/third_party/ffmpeg/

cd src
git apply media_hevc_ac3_chromium.patch
cd src/electron
git apply media_hevc_ac3_electron.patch
cd src/third_party/ffmpeg
git apply media_hevc_ac3_ffmpeg.patch

Download this file and place it in the src/third_party/ffmpeg directory.

Then, run the following command to apply the patch:

node ./add-hevc-ffmpeg-decoder-parser.js

Set the environment variable for chromium build tools

On Linux & MacOS:

cd src
export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools

On Windows:

# cmd
cd src
set CHROMIUM_BUILDTOOLS_PATH=%cd%\buildtools


# PowerShell
cd src
$env:CHROMIUM_BUILDTOOLS_PATH = "$(Get-Location)\buildtools"

Generate Release build config of Electron, this will take a while

On Linux & MacOS

gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"

On Windows:

# cmd
gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"

# PowerShell
gn gen out/Release --args="import(\`"//electron/build/args/release.gn\`")"

Build Electron

For the release configuration (This will take a while):

ninja -C out/Release electron

Packaging

On linux, first strip the debugging and symbol information:

electron/script/strip-binaries.py -d out/Release

To package the electron build as a distributable zip file:

ninja -C out/Release electron:electron_dist_zip

Acknowledgements

User avatar: Rinkerbel  User avatar: MidnightKittenCat

  • @Rinkerbel - Windows build
  • @MidnightKittenCat - Linux build

About

Electron patches for HEVC, AC3 and E-AC3 codec support on Windows, macOS and Linux.

Topics

Resources

Stars

Watchers

Forks