Index
Introduction
Create Image, Install and Configure RPi4 Internet Access
Setup and Configure SSH and Bonjour Services to the RPi4
Setup static IP address for the RPi4’s Ethernet NIC
Setup static Multicast route for IGMP streamer
NAT routing/bridging between Ethernet/Wi-Fi Interfaces
Install Docker and docker-compose to the RPi4
Confirm Docker Setup and running successfully
Installation of the Amino H200 Quick Start Container
Add H200 Firmware Files to the Docker Image
Configure the Docker Image for the Specific Firmware Release
Streaming MPEG2TS IGMP video streams
Building and Running the Docker Container
Portainer for Docker Container Management
Container Configuration modifications on IP Address Change
Connecting the H200 to the RPi4
Introduction
Summary
Quick start guide for using the Amino provided Docker image to create a small network using a Raspberry Pi4 (RPi4), a network switch, and an Amino H200 to demonstrate video streaming on the Set-Top Box (STB).
The container has a DHCP server configuration for the Amino H200 to be hosted on the private network, upgrade the STB’s Firmware, and also provide a simple channel lineup for video “channel zapping”.
By default, the RPi4 is set up so that the STB can only access streams on the private Ethernet network.
However, if you want to access streams from your Wi-Fi network or the Internet, this section provides the additional steps to enable NAT Forwarding on the RPi4 so the STB can get access to streams and files from the Internet.
Prerequisites
- Amino H200
- Raspberry Pi4 (RPi4)
- Although an earlier Raspberry Pi can be used (3, 3B, 3B+)
- Micro SD card larger than 16GB (32GB+ preferred so can host larger video files)
- Ethernet Network Switch
- Internet access via Wi-Fi for the RPi4
- HDMI TV
- For initially configuring the Pi4, and then for the STB usage
- USB Keyboard
- For initially configuring the RPi4
- USB Mouse
- For initially configuring the RPi4
- Access the Amino H200 Docker image tarball
- For example amino_docker_h200-0.2.1_ffmpeg.tar.gz
- Access to the Amino H200 Firmware Application image
- For example 25.3.2021.5R.zip
Raspberry Pi4 Setup
Create Image, Install and Configure RPi4 Internet Access
Using the instructions at https://www.raspberrypi.org/software/ download and create your Raspberry Pi OS Desktop image onto your MicroSD card.
Figure 1 Pi Imager OS Selection
Select "Raspberry Pi OS (32-bit)" (Debian Bullseye).
With the OS image on the MicroSD card and NO Ethernet connected to the RPi4, power on the RPi4 allowing it to boot, and during the setup, select your Wi-Fi SSID and connect to your Internet connection.
Confirm the Internet connection working, by opening a browser and navigating to a known website like https://www.amino.tv/.
The RPi will prompt to Update, you may skip it, and acknowledge to reboot.
Setup and Configure SSH and Bonjour Services to the RPi4
( Instructions loosely based upon “https://roboticsbackend.com/enable-ssh-on-raspberry-pi-raspbian/” )
On the RPi4 desktop, open a Shell Terminal Window and type:
sudo raspi-config
Select “Interface Options” and then “SSH” and then “Yes” and press Enter.
In the Shell Terminal Window type:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y avahi-daemon
With the “avahi-daemon” (Bonjour Service) installed you should now be able to access your RPi4 from your Wi-Fi network with the default hostname raspberrypi.local.
If you do not want to use the local Domain Name to access your RPi4, run the following command to get its IP address:
sudo hostname -I
From your PC Workstation, test the SSH connection by trying to login into pi@raspberrypi.local (or replacing raspberry pi if you changed the hostname, or replace it with the IP address. Use the password you created when you set up the RPi4.
Setup static IP address for the RPi4’s Ethernet NIC
The docker container has been preconfigured to run with a static IP address of 192.168.68.18/24.
Open a shell window via the desktop or SSH into the RPi4 and edit the file /etc/dhcpcd.conf with the command:
sudo nano /etc/dhcpcd.conf
Add or edit the entry for eth0 so it looks like:
interface eth0
static ip_address=192.168.68.18/24
Ensure you do not add or edit any routers or domain_name_server entries, as we want the WLAN0 interface to be the default route to the internet.
Setup static Multicast route for IGMP streamer
To stream UDP Multicast videos, the FFMPEG player requires that either it will output to the default GATEWAY or to a NIC that has a MULTICAST routing setup. With both eth and the WLAN interfaces, we need to force the streamer to output only on the Ethernet port.
sudo nano /lib/dhcpcd/dhcpcd-hooks/40-route
And add the entry:
ip route add 224.0.0.0/4 dev eth0 table local
NAT routing/bridging between Ethernet/Wi-Fi Interfaces
If you would like to stream internet sourced video streams, or streams accessible from the Wi-Fi network, then NAT Masquerading needs to be set up on your RPi4.
Edit the file /etc/sysctl.conf with:
sudo nano /etc/sysctl.conf
And uncomment the line:
net.ipv4.ip_forward=1
This will allow packets to be forwarded between interfaces.
Then reboot the RPi4.
sudo reboot
To activate NAT Masquerading (so multiple devices can be behind a single IP address of the RPi4) run the following commands:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
To create a startup file so the configuration is applied on startup edit the file /lib/dhcpcd/dhcpcd-hooks/70-ipv4-nat with:
sudo nano /lib/dhcpcd/dhcpcd-hooks/70-ipv4-nat
Add the following line and save the file:
iptables-restore --noflush < /etc/iptables.ipv4.nat
Then reboot the RPi4.
sudo reboot
Install Docker and docker-compose to the RPi4
Docker
Docker is not always available with the latest release as a package and may need to be pulled manually.
Log back into your PRi4 either through a desktop Shell Terminal window or via SSH and run:
sudo curl -sSL https://get.docker.com | sh
Adding the “pi” user to the docker group:
sudo usermod -aG docker pi
Reboot the pi, so your next login will have the correct groups with:
sudo reboot
docker-compose
Log back into your RPi4 either through a desktop Shell Terminal window or via SSH and run:
sudo apt-get install -y libffi-dev libssl-dev
sudo apt-get install -y python-dev
sudo apt-get install -y python3 python-pip
sudo pip3 install docker-compose
This will install docker-compose using the “pip” Python package manager.
To enable the docker service and the docker containers to start automatically (if configured in the container):
sudo systemctl enable docker
Reboot the RPi4:
sudo reboot
Confirm Docker Setup and running successfully
Log back into your PRi4 either through a desktop Shell Terminal window or via SSH and create a sample docker container with the command:
docker run hello-world
This will confirm a successful installation.
Installation of the Amino H200 Quick Start Container
The Amino H200 docker image is provided as a “compressed tarball” and needs to be copied to the RPi4 and will include the version of the image in the filename like amino_docker_h200-0.2.1_ffmpeg.tar.gz.
In the “pi” user’s home directory, create a dockers directory using or interactively using the desktop file manager.
mkdir dockers
Either with a USB stick to copy the file to the “pi” user’s “dockers” directory or SCP.
If you prefer to download it directly from this article with the wget command.
wget https://aminocom.zendesk.com/hc/article_attachments/5534547104921/amino_docker_h200-0.2.1_ffmpeg.tar.gz -P ~/dockers
Unpack the tarball by right-clicking from the desktop file manager, or with the command:
cd ~/dockers/
tar -zxvf amino_docker_h200-0.2.1_ffmpeg.tar.gz
This will unpack the docker image which will create the directory structure as shown in Figure 3.
The docker files supplied is supplied with no H200 firmware or video stream files included.
/dockers ├── amino_docker_h200-0.2.1_ffmpeg │ ├── ffmpeg │ │ ├── start_ffmpeg.sh │ │ ├── Dockerfile │ │ └── streams │ ├── docker-compose.yml │ ├── httpd │ │ └── www-root │ │ ├── aosp │ │ │ ├── h200 │ │ │ │ ├── h200_amino_boot.ini │ │ │ │ └── index.html │ │ │ └── index.html │ │ ├── docs │ │ │ ├── EnableJS │ │ │ └── INI │ │ ├── index.html │ │ └── lineup.json │ ├── isc-dhcp-server │ │ └── data │ │ ├── amino-h200-classes │ │ ├── dhcpd.conf │ │ ├── dhcpd.leases │ │ └── aminoenterprise-option-space │ │ └── amino-option-space │ ├── README.md │ └── streams └── amino_docker_h200-0.2.1_ffmpeg.tgz |
Figure 3 Directory structure of unpacked amino docker image
Add H200 Firmware Files to the Docker Image
Download the H200 Application Firmware you want to host and service within the docker container from the Amino Support Site “Zendesk”.
Using the example of the 25.3.2021.5R firmware, download the 25.3.2021.5R.zip firmware file.
NB: Do Not Unpack the Zip file. The STB requires it to be in this format.
To download the firmware file directly, using the RPi4, into the correct directory, you can use wget command:
sudo wget http://gcs.aminoengage.com/fw/1/8/app/25.3.2021.5R.zip -P ~/dockers/amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/aosp/h200/
If you did not use the RPi4 to download the file, copy the firmware zip file to the RPi4 using the file manager and USB or SCP, and copy it to the directory:
~/dockers/amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/aosp/h200/
Configure the Docker Image for the Specific Firmware Release
With the example of the 25.3.2021.5R firmware release, you will need to edit the h200_amino_boot.ini file to verify that is the firmware your H200 will upgrade to.
Either using the desktop editor or nano/pico/vi from the command line, edit the amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/aosp/h200/h200_amino_boot.ini file:
sudo nano ~/dockers/amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/aosp/h200/h200_amino_boot.ini
Edit the lines firmware_upgrade.url and firmware_upgrade.version to look like the below:
firmware_upgrade.url=http://192.168.68.18:8080/aosp/h200/25.3.2021.5R.zip
firmware_upgrade.version="25.3.2021.5R"
tvapp.package_id="com.aminocom.browser"
webapp.lineup_url="http://192.168.68.18:8080/lineup.json"
Streaming MPEG2TS IGMP video streams
If you want to channel zap through HTTP(S) network sourced DASH or HLS streams, then edit the ~/dockers/amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/lineup.json channel lineup file with the appropriate URLs, and the requests will use the Ethernet->Wi-Fi NAT Bridge to access those streams.
If you would like to test and demonstrate UDP IGMP streams like in a traditional IPTV use-case, the default container image, and lineup.json files have been configured to support two MPEG2TS streams to be streamed to 233.22.133.1:8110 and 233.22.133.2:8110 from two files named stream1.ts and stream2.ts respectively is located in the ~/dockers/amino_docker_h200-0.1.1/streams/, directory. The /streams/ directory is volume mounted within the docker container, and therefore can be modified with the docker image having to be rebuilt.
Two sample copyright-free video stream files are available for download from http://stb.amino.tv/streams/stream1.ts and http://stb.amino.tv/streams/stream2.ts, if you want to use those simply run the commands below:
cd ~/dockers
curl -O http://stb.amino.tv/content/bbb_sunflower_1080p_60fps_normal.ts
curl -O http://stb.amino.tv/content/Sintel.2010.4k.ts
ln bbb_sunflower_1080p_60fps_normal.ts amino_docker_h200-0.2.1_ffmpeg/streams/stream1.ts
ln Sintel.2010.4k.ts amino_docker_h200-0.2.1_ffmpeg/streams/stream2.ts
If you want to copy any of your own SPTS MPEG2 Transport Streams simply copy or hard link them to the streams directory as filename stream1.ts or stream2.ts.
If you wish to change the streams or add/remove channels from the Channel Zapper, please see the “H200 Quickstart Guide” and “H200 Channel Zapper Guide” at https://help.aminocom.com/.
Building and Running the Docker Container
Using the example Amino docker image for amino_docker_h200-0.2.1_ffmpeg the commands below in the terminal or ssh session on the RPi4 will build and start the container.
cd ~/dockers/amino_docker_h200-0.2.1_ffmpeg/
docker-compose build
docker-compose up -d
The first time the container is built, it may take some time as the supplementary docker images are downloaded from the internet although subsequent rebuilds will be quicker.
You should see something like below when after the docker-compose up -d
Creating network "amino_docker_h200-012_ffmpeg_default" with the default driver
Creating enablesampledhcpd ... done
Creating enablesamplehttpd ... done
Creating ch1 ... done
Creating ch2 ... done
To confirm the containers are running you can use the ps command:
docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------
ch1 /usr/bin/start_ffmpeg.sh Up
ch2 /usr/bin/start_ffmpeg.sh Up
enablesampledhcpd /entrypoint.sh Up
enablesamplehttpd httpd-foreground Up 0.0.0.0:8080->80/tcp,:::8080->80/tcp
The container is configured to automatically start when the docker service is started on the RPi4. If you want to stop the container from running run docker-compose stop and to remove it docker-compose down.
Additional Setup Options
Portainer for Docker Container Management
If you require to stop/restart the containers often to change and update the channel lineup file or to change the locally streams files, then the portainer docker management system is easy to install and it means you do not even need to go to the command line for such operations.
Instructions on how to do this can be found here: https://pimylifeup.com/raspberry-pi-portainer/.
Container Configuration modifications on IP Address Change
If you want (or need) to change the Static IP of the RPI4, from 192.168.68.18, there are a few files that you will need to modify as well as the entry in this section.
Within the h200_amino_boot.ini file, you will need to change the firmware_upgrade.url IP address and the webapp.lineup_url IP address. The file is located here:
sudo nano ~/dockers/amino_docker_h200-0.2.1_ffmpeg/httpd/www-root/aosp/h200/h200_amino_boot.ini
In addition to changing the contents of the INI file, you will need to also change reconfigure the DHCP configuration file, to point to the INI’s location. This is located in:
sudo nano ~/dockers/amino_docker_h200-0.2.1_ffmpeg/isc-dhcp-server/data/amino-h200-classes
After changing the IP address and editing both files, you will need to rebuild the containers. This can be done by stopping and removing the container:
docker-compose stop
docker-compose down
and then rebuild with:
docker-compose build
Connecting the H200 to the RPi4
Connect the H200 STB and the RPi4 with the ethernet cable and turn on the STB.
If the STB does not receive the boot ini file from the RPi4 try the following steps:
1. Reboot RPi4
2. In the terminal enter the following commands:
cd ~/dockers/amino_docker_h200-0.2.1_ffmpeg/
docker-compose stop
docker-compose down
docker-compose build
docker-compose up -d
3. Turn on the H200 and connect the ethernet cable to the RPi4
4. Wait for H200 to pick up the settings
Comments
0 comments
Please sign in to leave a comment.