Skip to content

Commit

Permalink
feat: Video image with based FFmpeg-6.1 on Ubuntu-22.04
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Dec 1, 2023
1 parent 113bb0a commit bad311a
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 33 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ BUILD_ARGS := $(BUILD_ARGS)
MAJOR := $(word 1,$(subst ., ,$(TAG_VERSION)))
MINOR := $(word 2,$(subst ., ,$(TAG_VERSION)))
MAJOR_MINOR_PATCH := $(word 1,$(subst -, ,$(TAG_VERSION)))
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-6.0)
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-6.1)
FFMPEG_BASED_NAME := $(or $(FFMPEG_BASED_NAME),$(FFMPEG_BASED_NAME),ndviet)
FFMPEG_BASED_TAG := $(or $(FFMPEG_BASED_TAG),$(FFMPEG_BASED_TAG),6.1-ubuntu2204)

all: hub \
distributor \
Expand Down Expand Up @@ -119,7 +121,7 @@ standalone_edge_beta: edge_beta
cd ./Standalone && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(NAME) --build-arg VERSION=beta --build-arg BASE=node-edge -t $(NAME)/standalone-edge:beta .

video:
cd ./Video && docker build $(BUILD_ARGS) -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .
cd ./Video && docker build $(BUILD_ARGS) --build-arg NAMESPACE=$(FFMPEG_BASED_NAME) --build-arg BASED_TAG=$(FFMPEG_BASED_TAG) -t $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) .


# https://github.com/SeleniumHQ/docker-selenium/issues/992
Expand Down Expand Up @@ -357,9 +359,9 @@ test_video: video hub chrome firefox edge
done
# Using ffmpeg to verify file integrity
# https://superuser.com/questions/100288/how-can-i-check-the-integrity-of-a-video-file-avi-mpeg-mp4
docker run -v $$(pwd):$$(pwd) -w $$(pwd) jrottenberg/ffmpeg:6.0-alpine -v error -i ./tests/videos/chrome_video.mp4 -f null - 2>error.log
docker run -v $$(pwd):$$(pwd) -w $$(pwd) jrottenberg/ffmpeg:6.0-alpine -v error -i ./tests/videos/firefox_video.mp4 -f null - 2>error.log
docker run -v $$(pwd):$$(pwd) -w $$(pwd) jrottenberg/ffmpeg:6.0-alpine -v error -i ./tests/videos/edge_video.mp4 -f null - 2>error.log
docker run -v $$(pwd):$$(pwd) -w $$(pwd) $(FFMPEG_BASED_NAME)/ffmpeg:$(FFMPEG_BASED_TAG) -v error -i ./tests/videos/chrome_video.mp4 -f null - 2>error.log
docker run -v $$(pwd):$$(pwd) -w $$(pwd) $(FFMPEG_BASED_NAME)/ffmpeg:$(FFMPEG_BASED_TAG) -v error -i ./tests/videos/firefox_video.mp4 -f null - 2>error.log
docker run -v $$(pwd):$$(pwd) -w $$(pwd) $(FFMPEG_BASED_NAME)/ffmpeg:$(FFMPEG_BASED_TAG) -v error -i ./tests/videos/edge_video.mp4 -f null - 2>error.log

chart_setup_env:
./tests/K8s/chart_setup_env.sh
Expand Down
2 changes: 1 addition & 1 deletion NodeDocker/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ configs = [
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-6.0-20231129"
video-image = "selenium/video:ffmpeg-6.1-20231129"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ ___

## Video recording

Tests execution can be recorded by using the `selenium/video:ffmpeg-6.0-20231129`
Tests execution can be recorded by using the `selenium/video:ffmpeg-6.1-20231129`
Docker image. One container is needed per each container where a browser is running. This means if you are
running 5 Nodes/Standalone containers, you will need 5 video containers, the mapping is 1-1.

Expand All @@ -501,7 +501,7 @@ This example shows how to start the containers manually:
``` bash
$ docker network create grid
$ docker run -d -p 4444:4444 -p 6900:5900 --net grid --name selenium --shm-size="2g" selenium/standalone-chrome:4.15.0-20231129
$ docker run -d --net grid --name video -v /tmp/videos:/videos selenium/video:ffmpeg-6.0-20231129
$ docker run -d --net grid --name video -v /tmp/videos:/videos selenium/video:ffmpeg-6.1-20231129
# Run your tests
$ docker stop video && docker rm video
$ docker stop selenium && docker rm selenium
Expand Down Expand Up @@ -548,7 +548,7 @@ configs = [
# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-6.0-20231129"
video-image = "selenium/video:ffmpeg-6.1-20231129"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
Expand Down Expand Up @@ -679,7 +679,7 @@ configs = [
# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-6.0-20231129"
video-image = "selenium/video:ffmpeg-6.1-20231129"
# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
Expand Down
42 changes: 27 additions & 15 deletions Video/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
FROM jrottenberg/ffmpeg:6.0-alpine
ARG NAMESPACE
ARG BASED_TAG
FROM $NAMESPACE/ffmpeg:$BASED_TAG
LABEL authors="Selenium <selenium-developers@googlegroups.com>"

#================================================
# Customize sources for apt-get
#================================================
RUN echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n" >> /etc/apt/sources.list

# No interactive frontend during docker build
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true

#========================
# Supervisor
#========================
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update --virtual .build-deps supervisor bash curl jq xset xdpyinfo python3 py3-psutil py3-pip \
&& ln -sf python3 /usr/bin/python \
&& rm -rf /tmp/* /var/cache/apk/*

ENV PYTHONUNBUFFERED=1
RUN python3 -m pip install --no-cache --upgrade --no-cache-dir pip urllib3 setuptools requests wheel
RUN apt-get -qqy update \
&& apt-get upgrade -yq \
&& apt-get -qqy --no-install-recommends install \
supervisor x11-xserver-utils x11-utils curl jq python3-pip \
&& python3 -m pip install --upgrade pip \
&& python3 -m pip install --upgrade setuptools \
&& python3 -m pip install --upgrade wheel \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

#======================================
# Add Supervisor configuration files
#======================================
ENV SE_VIDEO_FOLDER /videos
RUN mkdir -p /opt/bin/
RUN mkdir -p /var/run/supervisor /var/log/supervisor ${SE_VIDEO_FOLDER}

COPY supervisord.conf /etc
COPY entry_point.sh video.sh video_ready.py /opt/bin/
RUN cd /opt/bin && pip install psutil

ENV SE_VIDEO_FOLDER /videos
RUN mkdir -p /var/run/supervisor /var/log/supervisor $SE_VIDEO_FOLDER

RUN chmod +x /opt/bin/*
ENTRYPOINT ["/opt/bin/entry_point.sh"]
CMD ["/opt/bin/entry_point.sh"]

Expand All @@ -32,7 +44,7 @@ ENV DISPLAY_CONTAINER_NAME selenium
ENV SE_SCREEN_WIDTH 1360
ENV SE_SCREEN_HEIGHT 1020
ENV SE_FRAME_RATE 15
ENV SE_CODEC libx264
ENV SE_CODEC libx265
ENV SE_PRESET "-preset ultrafast"
ENV FILE_NAME video.mp4

Expand Down
4 changes: 2 additions & 2 deletions charts/selenium-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ For now, global configuration supported is:
| `global.seleniumGrid.imageRegistry` | `selenium` | Distribution registry to pull images |
| `global.seleniumGrid.imageTag` | `4.15.0-20231129` | Image tag for all selenium components |
| `global.seleniumGrid.nodesImageTag` | `4.15.0-20231129` | Image tag for browser's nodes |
| `global.seleniumGrid.videoImageTag` | `ffmpeg-6.0-20231129` | Image tag for browser's video recoder |
| `global.seleniumGrid.videoImageTag` | `ffmpeg-6.1-20231129` | Image tag for browser's video recoder |
| `global.seleniumGrid.imagePullSecret` | `""` | Pull secret to be used for all images |
| `global.seleniumGrid.imagePullSecret` | `""` | Pull secret to be used for all images |
| `global.seleniumGrid.affinity` | `{}` | Affinity assigned globally |
Expand Down Expand Up @@ -249,7 +249,7 @@ This table contains the configuration parameters of the chart and their default
| `videoRecorder.enabled` | `false` | Enable video recorder for node |
| `videoRecorder.imageRegistry` | `nil` | Distribution registry to pull the image (this overwrites `.global.seleniumGrid.imageRegistry` value) |
| `videoRecorder.imageName` | `video` | Selenium video recoder image name |
| `videoRecorder.imageTag` | `ffmpeg-6.0-20231129` | Image tag of video recorder |
| `videoRecorder.imageTag` | `ffmpeg-6.1-20231129` | Image tag of video recorder |
| `videoRecorder.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| `videoRecorder.uploader` | `false` | Name of the uploader to use. The value `false` is used to disable uploader. Supported default `s3` |
| `videoRecorder.uploadDestinationPrefix` | `false` | Destination URL for uploading video file. The value `false` is used to disable the uploading |
Expand Down
4 changes: 2 additions & 2 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ global:
# Image tag for browser's nodes
nodesImageTag: 4.15.0-20231129
# Image tag for browser's video recorder
videoImageTag: ffmpeg-6.0-20231129
videoImageTag: ffmpeg-6.1-20231129
# Pull secret for all components, can be overridden individually
imagePullSecret: ""

Expand Down Expand Up @@ -796,7 +796,7 @@ videoRecorder:
# Image of video recorder
imageName: video
# Image of video recorder
# imageTag: ffmpeg-6.0-20231129
# imageTag: ffmpeg-6.1-20231129
# Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images)
imagePullPolicy: IfNotPresent
# Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/)
Expand Down
6 changes: 3 additions & 3 deletions docker-compose-v3-video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

chrome_video:
image: selenium/video:ffmpeg-6.0-20231129
image: selenium/video:ffmpeg-6.1-20231129
volumes:
- /tmp/videos:/videos
depends_on:
Expand All @@ -44,7 +44,7 @@ services:
- FILE_NAME=chrome_video.mp4

edge_video:
image: selenium/video:ffmpeg-6.0-20231129
image: selenium/video:ffmpeg-6.1-20231129
volumes:
- /tmp/videos:/videos
depends_on:
Expand All @@ -54,7 +54,7 @@ services:
- FILE_NAME=edge_video.mp4

firefox_video:
image: selenium/video:ffmpeg-6.0-20231129
image: selenium/video:ffmpeg-6.1-20231129
volumes:
- /tmp/videos:/videos
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion generate_release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CHROMEDRIVER_VERSION=$(docker run --rm selenium/node-chrome:${TAG_VERSION} chrom
EDGEDRIVER_VERSION=$(docker run --rm selenium/node-edge:${TAG_VERSION} msedgedriver --version | awk '{print $4}')
FIREFOX_VERSION=$(docker run --rm selenium/node-firefox:${TAG_VERSION} firefox --version | awk '{print $3}')
GECKODRIVER_VERSION=$(docker run --rm selenium/node-firefox:${TAG_VERSION} geckodriver --version | awk 'NR==1{print $2}')
FFMPEG_VERSION=$(docker run --entrypoint="" --rm selenium/video:ffmpeg-6.0-${BUILD_DATE} ffmpeg -version | awk '{print $3}' | head -n 1)
FFMPEG_VERSION=$(docker run --entrypoint="" --rm selenium/video:ffmpeg-6.1-${BUILD_DATE} ffmpeg -version | awk '{print $3}' | head -n 1)


echo "" >> release_notes.md
Expand Down

0 comments on commit bad311a

Please sign in to comment.