Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Last active August 23, 2024 06:20
Show Gist options
  • Save jedi4ever/d095656ae0f0eca4a83ebb2b331da367 to your computer and use it in GitHub Desktop.
Save jedi4ever/d095656ae0f0eca4a83ebb2b331da367 to your computer and use it in GitHub Desktop.
Chromium build with proprietary codecs

Building chromium on OSX

See https://chromium.googlesource.com/chromium/src/+/master/docs/mac_build_instructions.md

git clone depot_tools

add to path (not using ~ but $HOME) in .bash_profile

Increase vnodes

sudo sysctl kern.maxvnodes=$((512*1024))

Download src code

mkdir chromium ; cd chromium
fetch chromium
gclient sync
gclient runhooks

Configure build

cd src
# Enable proprietary video codecs
export  GYP_DEFINES="proprietary_codecs=1 ffmpeg_branding=Chrome"```
# Generate config
cgn gen out/Default
# Speed up build settings (opens editor)
gn args out/Default
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
is_debug = false
is_component_build = true
symbol_level = 0

media_use_ffmpeg = true
media_use_libvpx = true
proprietary_codecs = true
ffmpeg_branding = "Chrome"

Compile Chrome

ninja -C out/Default chrome

Test pages

Jwplayer specific in headless

It seems jwplayer checks on the Headless useragent

const browser = await puppeteer.launch({
  executablePath: executable,
  headless: true,
  //args: [ '--enable-speech-api']
  args: [ '--user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36"']
});

d24221c is commit id tested

Steps to checkout Chromium release branches

Initial setup

mkdir chromium && cd chromium
fetch --nohooks chromium --nosvn=True
gclient sync --with_branch_heads --nohooks # May not even need this.

Fetching/updating a specific release branch

cd src # Assuming that you are already in the above 'chromium' directory.
git fetch origin refs/branch-heads/<branch> # <branch> would be something like '1942'.
git checkout FETCH_HEAD
gclient sync
fetch --nohooks chromium --nosvn=True

Good writeup for Linux

Puppeteer example

const puppeteer = require('puppeteer');

(async() => {

const executable = "/Users/patrick/dev/chromium/src/out/Default/Chromium.app/Contents/MacOS/Chromium"
const browser = await puppeteer.launch({
  executablePath: executable,
  headless: true
});

function timeout(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
};

const page = await browser.newPage();
  page.on('console', msg => console.log(msg.text));

await page.goto('https://support.jwplayer.com/customer/portal/articles/1428525', {waitUntil: 'networkidle2'});
//await page.goto('https://html5test.com/', {waitUntil: 'networkidle2'});
await page.screenshot({ path: 'a.png' , fullPage: true })

await timeout(5000);
browser.close();
)}();
@jedi4ever
Copy link
Author

a

@brianrodri
Copy link

brianrodri commented Oct 18, 2021

Your Good Writeup for Linux link points to porn :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment