From 073d32cb34b17be1bda0f40ffde473c6916a30d2 Mon Sep 17 00:00:00 2001 From: OmarTrigui Date: Mon, 22 Jun 2020 20:12:26 +0200 Subject: [PATCH] Make video dimensions parameterizable in Dockerfile --- Dockerfile | 3 +++ entrypoint.sh | 2 +- main.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b1f8d2e..b41ff29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,9 @@ FROM ubuntu:xenial LABEL maintainer="omar.trigui.tn@gmail.com" +ENV OUTPUT_VIDEO_WIDTH 1280 +ENV OUTPUT_VIDEO_HEIGHT 720 + ADD https://github.com/just-containers/s6-overlay/releases/download/v2.0.0.1/s6-overlay-amd64.tar.gz /tmp/ RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && \ rm /tmp/s6-overlay-amd64.tar.gz diff --git a/entrypoint.sh b/entrypoint.sh index 86c9b56..4743a2d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,7 +21,7 @@ launch_xvfb() { export DISPLAY=${XVFB_DISPLAY:-:1} local screen=${XVFB_SCREEN:-0} - local resolution=${XVFB_RESOLUTION:-1280x720x24} + local resolution="${OUTPUT_VIDEO_WIDTH}x${OUTPUT_VIDEO_HEIGHT}x24" local timeout=${XVFB_TIMEOUT:-5} Xvfb "${DISPLAY}" -screen "${screen}" "${resolution}" & diff --git a/main.js b/main.js index f722029..fc3c187 100644 --- a/main.js +++ b/main.js @@ -15,7 +15,7 @@ function getStartChromeCommand () { return 'DISPLAY=:1.0 /bin/sh -c ' + '"/opt/google/chrome/google-chrome ' + '--window-position=0,0 ' + - '--window-size=1281,721 ' + + `--window-size=${+process.env.OUTPUT_VIDEO_WIDTH + 1},${+process.env.OUTPUT_VIDEO_HEIGHT + 1} ` + '--remote-debugging-port=9222 ' + '--no-first-run ' + '--no-default-browser-check ' + @@ -33,7 +33,7 @@ function getStartRecordingCommand () { return 'ffmpeg -y ' + '-f x11grab ' + '-draw_mouse 0 ' + - '-s 1280x720 ' + + `-s ${process.env.OUTPUT_VIDEO_WIDTH}x${process.env.OUTPUT_VIDEO_HEIGHT} ` + '-thread_queue_size 4096 ' + '-i :1 ' + '-f pulse ' +