Giter Site home page Giter Site logo

electron-chromium-codecs's Introduction

electron-chromium-codecs

This repository contains the necessary git patches to build a custom electron dist with bundled HEVC, AC3 and E-AC3 codecs support for chromium.

TODO: More codecs such as MPEG-2 and DTS.

Compiling Electron

Follow the electron build instructions.

Linux

On Ubuntu >= 20.04, install the following libraries:

$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
                       libnotify-dev libasound2-dev libcap-dev \
                       libcups2-dev libxtst-dev \
                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \
                       gperf bison python3-dbusmock openjdk-8-jre \
                       git npm

Update node and npm to the latest version using your preferred method.

Clone depot_tools and add it to PATH.

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=/path/to/depot_tools:$PATH

Get Electron

$ 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, go get a coffee.

Setup electron environment for pulling later

$ 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 -

Choosing a stable electron version to build (Make sure you have the same node version as stated in your versions DEPS file)

$ cd src/electron
$ git checkout v20.1.1
# You might want to force the checkout with git checkout -f
# Change the node version now to the same node version as the electron tag you want to use
$ gclient sync -f

Move patches to respective directories

$ mv look_chromium_hevc_ac3.patch src/
$ mv look_electron_hevc_ac3.patch src/electron/
$ mv look_ffmpeg_hevc_ac3.patch src/third_party/ffmpeg/

Apply the patches

$ cd src/ && git apply look_chromium_hevc_ac3.patch
$ cd src/electron/ && git apply look_electron_hevc_ac3.patch
$ cd src/third_party/ffmpeg/ && git apply look_ffmpeg_hevc_ac3.patch

Build Electron (step 5)

$ cd src
$ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
$ gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
$ ninja -C out/Release electron

Strip the binaries and pack the distribution (step 6)

$ electron/script/strip-binaries.py -d out/Release
$ ninja -C out/Release electron:electron_dist_zip

Result dist will be inside src/out/Release/dist.zip

Updating electron and rebuilding

Updating electron repository (changing electron version)

$ cd src/electron
$ git fetch
$ git checkout v20.1.1
# Change the node version now to the same node version as the electron tag you want to use
$ gclient sync -f

Removing all changes (everything! including HEAD added files and directories!!!!)

To be honest you might as well clone everything again.

$ cd src/ && git reset --hard HEAD && git clean -df
$ cd src/electron/ && git reset --hard HEAD && git clean -df
$ cd src/third_party/ffmpeg/ && git reset --hard HEAD && git clean -df

Windows fix for EOF

cd src
dos2unix electron/shell/common/extensions/api/resources_private.idl
dos2unix electron/shell/common/extensions/api/cryptotoken_private.idl
dos2unix chrome/common/extensions/api/resources_private.idl
dos2unix chrome/common/extensions/api/cryptotoken_private.idl

Credits

Thanks ThaUnknown for providing help with debugging and the final steps on ffmpeg chromium scripts in order make chromium point the correct codecs to ffmpeg demuxer for the AC3 audio.

Thanks Kirdow for compiling and testing on Windows, as well as for the fix regarding EOF files on Windows that prevented people from linking.

Thanks henrypp for the initial patches on HEVC.

Thanks AAAhs for more up to date HEVC patches.

https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/pull/33/commits/7ac9e95594765c60b207490d3c4512432e081d21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.