From e5d0aa66fa5c095bf059fa62fc8ceb1dc9ff10ec Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sat, 2 Dec 2023 02:44:29 +0700 Subject: [PATCH] feat: Video image with based FFmpeg-6.1 on Ubuntu-22.04 (#2042) Signed-off-by: Viet Nguyen Duc --- Makefile | 12 +++++---- NodeDocker/config.toml | 2 +- README.md | 8 +++--- Video/Dockerfile | 42 ++++++++++++++++++++------------ charts/selenium-grid/README.md | 4 +-- charts/selenium-grid/values.yaml | 4 +-- docker-compose-v3-video.yml | 6 ++--- generate_release_notes.sh | 2 +- 8 files changed, 47 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index e207c209e..6853a676d 100644 --- a/Makefile +++ b/Makefile @@ -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 \ @@ -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 @@ -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 diff --git a/NodeDocker/config.toml b/NodeDocker/config.toml index 5c31e62cf..a505e1c1a 100644 --- a/NodeDocker/config.toml +++ b/NodeDocker/config.toml @@ -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 diff --git a/README.md b/README.md index 684bf284e..5892db09f 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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 @@ -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 diff --git a/Video/Dockerfile b/Video/Dockerfile index 808e8715a..a6a426ee7 100644 --- a/Video/Dockerfile +++ b/Video/Dockerfile @@ -1,29 +1,41 @@ -FROM jrottenberg/ffmpeg:6.0-alpine +ARG NAMESPACE +ARG BASED_TAG +FROM $NAMESPACE/ffmpeg:$BASED_TAG LABEL authors="Selenium " +#================================================ +# 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"] @@ -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 diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 2ec8a7ab0..ea0bb31dd 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -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 | @@ -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 | diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index b6e4ee040..a32a9c96a 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -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: "" @@ -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/) diff --git a/docker-compose-v3-video.yml b/docker-compose-v3-video.yml index ff2e8c7fe..6f044bece 100644 --- a/docker-compose-v3-video.yml +++ b/docker-compose-v3-video.yml @@ -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: @@ -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: @@ -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: diff --git a/generate_release_notes.sh b/generate_release_notes.sh index c936c48d4..c2f4e40ae 100755 --- a/generate_release_notes.sh +++ b/generate_release_notes.sh @@ -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