Chromium accelerated decoding for Jetson

From RidgeRun Developer Wiki



Introduction to Chromium accelerated decoding for Jetson

On this page, you will find instructions on how to get Hardware decoding acceleration for Chromium on NVIDIA Jetson platforms.

You can contact us if you need support on enabling chromium acceleration on Jetson.


This support was tested under the following conditions:

  • Chromium version: v90.0.4400.4
  • Jetpack version: 4.5
  • Supported formats: VP9, VP8 and H.264


In the next sections, you will see the instructions on how to build this on your own but if you prefer, you can download the already built version from the link below:

Easy build

The easiest way of building Chromium with accelerated decoding support is by using our provided docker image. If you don't have docker, you can follow these instructions to install it on your host computer.

Once you have it installed, just run the following command:

sudo docker run --name chromium -it --privileged -v /home/$USER/chromium_output:/root/chromium_output ridgerun/chromium_accelerated:90.0.4400.4 /root/chromium_build.sh

This process took ~13h in a machine with an Intel CORE i7 7th Gen CPU, with 12GB of RAM and a 100Mbps internet connection. See here the full log.

After the build completes, the resulting debian will be in $HOME/chromium_output

Manual build

This section shows the instructions on how to manually build to generate a Debian package with the accelerated version of Chromium. In the following sections, we provide you with two alternative ways of building chromium: using the provided build script or step by step.

This guide was tested on an Ubuntu 18 machine so if you are using a different version, you can use a docker container (this is the recommended way of building chromium) and create it with the following command:

sudo docker run --name chromium -it --privileged -v /home/$USER/chromium_output:/root/chromium_output ubuntu:18.04

After this, you will be logged into the container and you will see something like this:

root@1a2e71546a30:/# 

NOTE: When creating this container, a folder called chromium_output will be created in the $HOME folder of your host machine which will be associated with the /root/chromium_output folder in your docker container. This folder will be used to easily move the resulting debian to your host computer.

Once you created the container, follow either the build script or step-by-step instructions.

Using build script

1. Get the code:

git clone https://github.com/RidgeRun/chromium-jetson-accelerated.git

2. Checkout the tag matching the Chromium version you want to build (v90.0.4400.4 for example):

git checkout v90.0.4400.4

3. In the tools folder you can find a chromium_build.sh script which will take care of executing all the commands necessary to build chromium. It will take care of installing dependencies downloading repositories and building. Execute it with:

./chromium_build.sh

When the build process finishes, the resulting debian will be under the /root/chromium_build directory of your container and under the $HOME/chromium_output directory of your host computer.

Step by step build

From now on, we will call $CHROMIUM your working directory.

1. Set your working directory

export CHROMIUM=$HOME/chromium
mkdir $CHROMIUM
cd $CHROMIUM

2. Prepare host

apt-get update
apt-get install -y git curl wget lsb-release vim python2.7 sudo
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

3. Get depot_tools

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

4. Get Chromium

mkdir $CHROMIUM/chromium
cd $CHROMIUM/chromium
fetch chromium

5. Checkout the desired tag (90.0.4400.4 in this example):

cd src
git checkout tags/90.0.4400.4 -b 90.0.4400.4

6. Sync repository

gclient sync --with_branch_heads --with_tags

7. Get patches tag matching the chromium version you are trying to build (v90.0.4400.4 in this example)

git clone --branch v90.0.4400.4 https://github.com/RidgeRun/chromium-jetson-accelerated.git $CHROMIUM/patches

7. Apply patches

cd $CHROMIUM/chromium/src
for p in `ls $CHROMIUM/patches/patches/*.patch`
do
    patch -p1 -i ${p}
done

8. Get chromium dependencies

./build/install-build-deps.sh
./build/install-build-deps.sh --arm
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64

8. Setup build environment

GYP_DEFINES="target_arch=arm64" gclient runhooks
export GYP_CROSSCOMPILE=1

9. Build Chromium

gn gen out/release-90/ "--args=is_debug=false target_cpu=\"arm64\" is_component_build=false use_ozone=true use_v4l2_codec=true use_linux_v4l2_only=true use_v4lplugin=true proprietary_codecs=true ffmpeg_branding=\"Chrome\" use_nvidia_v4l2=true enable_linux_installer = true"
autoninja -C out/release-90/ chrome chrome_sandbox "chrome/installer/linux:unstable_deb"

This build will take some hours to complete. After it successfully finishes, the Debian package will be under: out/release-90/chromium-browser-unstable_90.0.4400.4-1_arm64.deb

Installation instructions

Once the build had succeeded, If you built Chromium in a container, your debian file will be under the $HOME/chromium_output directory. Move it to your target board and install it with:

sudo dpkg -i chromium-browser-unstable_90.0.4400.4-1_arm64.deb

Testing instructions

For testing the accelerated version of chromium you will need the following:

1. Follow build and installation instructions

2. Log into your board using ssh

3. Get a 4k, H264 video for testing (you can use this one)

Once the requirements are fulfilled, stop Ubuntu Desktop in your target board:

sudo systemctl stop gdm
sudo loginctl terminate-seat seat0

Then start X:

xinit &
export DISPLAY=:0

And finally, start chromium:

sudo chromium-browser-unstable --no-sandbox --use-gl=egl  --enable-gpu-rasterization --ignore-gpu-blacklist -kiosk file://FULL_PATH_TO_YOUR_VIDEO


RidgeRun Resources

Quick Start Client Engagement Process RidgeRun Blog Homepage
Technical and Sales Support RidgeRun Online Store RidgeRun Videos Contact Us
RidgeRun.ai: Artificial Intelligence | Generative AI | Machine Learning

Contact Us

Visit our Main Website for the RidgeRun Products and Online Store. RidgeRun Engineering information is available at RidgeRun Engineering Services, RidgeRun Professional Services, RidgeRun Subscription Model and Client Engagement Process wiki pages. Please email to support@ridgerun.com for technical questions and contactus@ridgerun.com for other queries. Contact details for sponsoring the RidgeRun GStreamer projects are available in Sponsor Projects page.