Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial set of files to support video recording (#1111) [deploy][prer…
…elease] * Initial set of files to support video recording * Adding Selenium Grid logo as wallpaper for Fluxbox * Adding video image build to Makefile * Fixing copy&paste error * Adding docker-compose-v3-video.yml as example * Simple docs showing how to use video container * Adjusting tags in docker-compose-v3-video.yml * Updating script that updates tags and dates in docs * Removing ambiguous commentary * Adding ffmpeg version to release notes
- Loading branch information
Showing
11 changed files
with
259 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM jrottenberg/ffmpeg:4.3.1-ubuntu1804 | ||
LABEL authors="Selenium <selenium-developers@googlegroups.com>" | ||
|
||
#================================================ | ||
# Customize sources for apt-get | ||
#================================================ | ||
RUN echo "deb http://archive.ubuntu.com/ubuntu bionic main universe\n" > /etc/apt/sources.list \ | ||
&& echo "deb http://archive.ubuntu.com/ubuntu bionic-updates main universe\n" >> /etc/apt/sources.list \ | ||
&& echo "deb http://security.ubuntu.com/ubuntu bionic-security main universe\n" >> /etc/apt/sources.list | ||
|
||
# No interactive frontend during docker build | ||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
DEBCONF_NONINTERACTIVE_SEEN=true | ||
|
||
#======================== | ||
# Supervisor | ||
#======================== | ||
RUN apt-get -qqy update \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
supervisor x11-xserver-utils \ | ||
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
|
||
#====================================== | ||
# Add Supervisor configuration file | ||
#====================================== | ||
COPY supervisord.conf /etc | ||
COPY entry_point.sh video.sh /opt/bin/ | ||
|
||
RUN mkdir -p /var/run/supervisor /var/log/supervisor /videos | ||
|
||
ENTRYPOINT ["/opt/bin/entry_point.sh"] | ||
CMD ["/opt/bin/entry_point.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
/usr/bin/supervisord --configuration /etc/supervisord.conf & | ||
|
||
SUPERVISOR_PID=$! | ||
|
||
function shutdown { | ||
echo "Trapped SIGTERM/SIGINT/x so shutting down supervisord..." | ||
kill -s SIGTERM ${SUPERVISOR_PID} | ||
wait ${SUPERVISOR_PID} | ||
echo "Shutdown complete" | ||
} | ||
|
||
trap shutdown SIGTERM SIGINT | ||
wait ${SUPERVISOR_PID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; Documentation of this file format -> http://supervisord.org/configuration.html | ||
|
||
[supervisord] | ||
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) | ||
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | ||
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | ||
logfile_backups=10 ; (num of main logfile rotation backups;default 10) | ||
loglevel=info ; (log level;default info; others: debug,warn,trace) | ||
pidfile=/var/run/supervisor/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
nodaemon=true ; (start in foreground if true;default false) | ||
minfds=1024 ; (min. avail startup file descriptors;default 1024) | ||
minprocs=200 ; (min. avail process descriptors;default 200) | ||
|
||
[program:video-recording] | ||
priority=0 | ||
command=/opt/bin/video.sh | ||
autostart=true | ||
autorestart=false | ||
startsecs=0 | ||
startretries=0 | ||
stopsignal=INT | ||
|
||
;Logs (all activity redirected to stdout so it can be seen through "docker logs" | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
VIDEO_SIZE=${VIDEO_SIZE:-"1360x1020"} | ||
DISPLAY_CONTAINER_NAME=${DISPLAY_CONTAINER_NAME:-"selenium"} | ||
DISPLAY=${DISPLAY:-"99"} | ||
FILE_NAME=${FILE_NAME:-"video.mp4"} | ||
FRAME_RATE=${FRAME_RATE:-"15"} | ||
CODEC=${CODEC:-"libx264"} | ||
PRESET=${PRESET:-"-preset ultrafast"} | ||
|
||
return_code=1 | ||
max_attempts=50 | ||
attempts=0 | ||
echo 'Checking if the display is open...' | ||
until [ $return_code -eq 0 -o $attempts -eq $max_attempts ]; do | ||
xset -display ${DISPLAY_CONTAINER_NAME}:${DISPLAY} b off > /dev/null 2>&1 | ||
return_code=$? | ||
if [ $return_code -ne 0 ]; then | ||
echo 'Waiting before next display check...' | ||
sleep 0.5 | ||
fi | ||
attempts=$((attempts+1)) | ||
done | ||
|
||
# exec replaces the video.sh process with ffmpeg, this makes easier to pass the process termination signal | ||
exec ffmpeg -y -f x11grab -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY_CONTAINER_NAME}:${DISPLAY}.0 -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p "/videos/$FILE_NAME" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-video.yml up` | ||
# Add the `-d` flag at the end for detached execution | ||
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-video.yml down` | ||
version: "3" | ||
services: | ||
chrome: | ||
image: selenium/node-chrome:4.0.0-alpha-7-prerelease-20200907 | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
depends_on: | ||
- selenium-hub | ||
environment: | ||
- SE_EVENT_BUS_HOST=selenium-hub | ||
- SE_EVENT_BUS_PUBLISH_PORT=4442 | ||
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443 | ||
ports: | ||
- "6900:5900" | ||
|
||
firefox: | ||
image: selenium/node-firefox:4.0.0-alpha-7-prerelease-20200907 | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
depends_on: | ||
- selenium-hub | ||
environment: | ||
- SE_EVENT_BUS_HOST=selenium-hub | ||
- SE_EVENT_BUS_PUBLISH_PORT=4442 | ||
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443 | ||
ports: | ||
- "6901:5900" | ||
|
||
opera: | ||
image: selenium/node-opera:4.0.0-alpha-7-prerelease-20200907 | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
depends_on: | ||
- selenium-hub | ||
environment: | ||
- SE_EVENT_BUS_HOST=selenium-hub | ||
- SE_EVENT_BUS_PUBLISH_PORT=4442 | ||
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443 | ||
ports: | ||
- "6902:5900" | ||
|
||
chrome_video: | ||
image: selenium/video:ffmpeg-4.3.1-20200920 | ||
volumes: | ||
- /tmp/videos:/videos | ||
depends_on: | ||
- chrome | ||
environment: | ||
- DISPLAY_CONTAINER_NAME=chrome | ||
- FILE_NAME=chrome_video.mp4 | ||
|
||
firefox_video: | ||
image: selenium/video:ffmpeg-4.3.1-20200920 | ||
volumes: | ||
- /tmp/videos:/videos | ||
depends_on: | ||
- firefox | ||
environment: | ||
- DISPLAY_CONTAINER_NAME=firefox | ||
- FILE_NAME=firefox_video.mp4 | ||
|
||
opera_video: | ||
image: selenium/video:ffmpeg-4.3.1-20200907 | ||
volumes: | ||
- /tmp/videos:/videos | ||
depends_on: | ||
- opera | ||
environment: | ||
- DISPLAY_CONTAINER_NAME=firefox | ||
- FILE_NAME=opera_video.mp4 | ||
|
||
selenium-hub: | ||
image: selenium/hub:4.0.0-alpha-7-prerelease-20200907 | ||
container_name: selenium-hub | ||
ports: | ||
- "4442:4442" | ||
- "4443:4443" | ||
- "4444:4444" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters