Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit df99dfb

Browse files
committed
v2.46.0-05: Split video files through -e VIDEO_CHUNK_SECS=00:10:00
1 parent 5566616 commit df99dfb

File tree

13 files changed

+136
-75
lines changed

13 files changed

+136
-75
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ Note sha256 digests are generated after pushing the image to the registry theref
44

55
Note image ids also change after scm-source.json has being updated which triggers a cyclic problem so value TBD will be set here and updated in the [release][] page by navigating into any release tag.
66

7+
## v2.46.0-05 (2015-07-20)
8+
+ Split video files through `-e VIDEO_CHUNK_SECS="00:10:00"`. (Leo Gallucci)
9+
+ Lower down ffmpeg CPU usage considerable by using libx264 ultrafast.
10+
+ Image tag details:
11+
+ Selenium: v2.46.0 (87c69e2)
12+
+ Chrome stable: 43.0.2357.134
13+
+ Chrome beta: 44.0.2403.89
14+
+ Chrome unstable: 45.0.2454.7
15+
+ Firefox versions in this image:
16+
39.0 38.0.6 37.0.2 36.0.4
17+
35.0.1 34.0.5 33.0.3 32.0.3 31.0 30.0
18+
29.0.1 28.0 27.0.1 26.0 25.0.1 24.0
19+
+ chromedriver: 2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961)
20+
+ Java: 1.8.0_60-internal OpenJDK 64-Bit 1.8.0_60-b22
21+
+ Timezone: Europe/Berlin
22+
+ Built with: Docker version 1.7.1, build 786b29d
23+
+ FROM ubuntu:wily-20150708
24+
+ Python: 2.7.10
25+
+ Digest: sha256:TBD
26+
+ Image ID: TBD
27+
728
## v2.46.0-04 (2015-07-18)
829
+ Fix bug openbox X manager not waiting for Xvfb. (Leo Gallucci)
930
+ Fix entry.sh exiting immediately and not checking DISABLE_ROLLBACK.

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ RUN apt-get update -qqy \
357357
libx264-dev \
358358
libvorbis-dev \
359359
libx11-dev \
360-
ffmpeg \
360+
libav-tools \
361361
&& rm -rf /var/lib/apt/lists/*
362362

363363
#==========================
@@ -672,6 +672,7 @@ ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERS
672672
SUPERVISOR_HTTP_USERNAME=supervisorweb \
673673
SUPERVISOR_HTTP_PASSWORD=somehttpbasicauthpwd \
674674
SUPERVISOR_REQUIRED_SRV_LIST="vnc|novnc|sshd|xmanager|xvfb" \
675+
SLEEP_SECS_AFTER_KILLING_SUPERVISORD=3 \
675676
# Supervisor loglevel and also general docker log level
676677
# can be: debug, warn, trace, info
677678
LOG_LEVEL=info \
@@ -692,9 +693,10 @@ ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERS
692693
# sometimes helps reducing the movie size.
693694
VNC2SWF_FRAMERATE=25 \
694695
# ffmpeg encoding options
695-
FFMPEG_FRAME_RATE=25 \
696-
# ENV FFMPEG_CODEC_ARGS "-vcodec libx264 -vpre lossless_ultrafast -threads 0"
697-
FFMPEG_CODEC_ARGS="" \
696+
FFMPEG_FRAME_RATE=15 \
697+
# Video size can be lowered down via re-encoding, see
698+
# http://askubuntu.com/a/365221/134645
699+
FFMPEG_CODEC_ARGS="-vcodec libx264 -crf 0 -preset ultrafast" \
698700
# Services to start by default; true/false
699701
VIDEO=false \
700702
GRID=true \
@@ -703,8 +705,10 @@ ENV FIREFOX_VERSIONS="${FIREFOX_VERSIONS1}, ${FIREFOX_VERSIONS2}, ${FIREFOX_VERS
703705
# Video file and extension, e.g. swf, mp4, mkv, flv
704706
VIDEO_FILE_EXTENSION="mkv" \
705707
VIDEO_FILE_NAME="test" \
708+
VIDEO_FLUSH_SECS="0.5" \
709+
VIDEO_CHUNK_SECS="00:05:00" \
710+
VIDEO_CHUNKS_MAX=999 \
706711
VIDEOS_DIR="${NORMAL_USER_HOME}/videos" \
707-
FLUSH_VIDEO_SECS="0.5" \
708712
# You can choose what X manager to use
709713
XMANAGER="fluxbox" \
710714
#===============================

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Note SeleniumHQ/docker-selenium project is more useful for building selenium gri
1919
In general: add `sudo` only if needed in your environment and `--privileged` if you really need it.
2020

2121
sudo docker run --privileged -p 4444:24444 -p 5920:25900 \
22-
-e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-04
22+
-e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-05
2323

2424
### Non-privileged
2525
### Run
@@ -31,7 +31,7 @@ If your setup is correct, privileged mode and sudo should not be necessary:
3131
-e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 \
3232
-e VNC_PASSWORD=hola \
3333
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" \
34-
elgalu/selenium:v2.46.0-04
34+
elgalu/selenium:v2.46.0-05
3535

3636
Make sure `docker run` finishes with **selenium all done and ready for testing** else you won't be able to start your tests. To perform this check programatically please use this command where `ch` is the name of the container:
3737

@@ -68,7 +68,7 @@ To configure which Firefox version to use first check available versions in the
6868

6969
If you create the container with `-e VIDEO=true` it will start recording a video through the vnc connection run upon start but first create a local folder `videos` in your current directory and mount the videos directory for an easy transfer with `-v $(pwd)/videos:/videos`
7070

71-
Once your tests are done you can either manually stop the recording via `docker exec ch stop-video` where *ch* is just the arbitrary container chosen name in `docker run` command. Or simply stop the container and that will stop the video recording automatically.
71+
Once your tests are done you can either manually stop the recording via `docker exec ch /bin-utils/stop-video` where *ch* is just the arbitrary container chosen name in `docker run` command. Or simply stop the container and that will stop the video recording automatically.
7272

7373
Relevant environment variables to customize it are:
7474

@@ -96,7 +96,7 @@ You can lunch a grid only container via environment variables:
9696

9797
docker run --rm --name=hub -p 4444:24444 -p 5930:25900 -p 2223:22222 \
9898
-p=6081:26080 -e CHROME=false -e FIREFOX=false \
99-
elgalu/selenium:v2.46.0-04
99+
elgalu/selenium:v2.46.0-05
100100

101101
The important part above is `-e CHROME=false -e FIREFOX=false` which tells the docker image not run run default chorme and firefox nodes turning the container into a grid-only one.
102102

@@ -112,7 +112,7 @@ You can lunch a node only container via environment variables:
112112
-p 25550:25550 -p 25551:25551 \
113113
-e GRID=false -e CHROME=true -e FIREFOX=true \
114114
-v $(pwd)/videos:/videos \
115-
elgalu/selenium:v2.46.0-04
115+
elgalu/selenium:v2.46.0-05
116116

117117
The important part above is `-e GRID=false` which tells the container to be a node-only node, this this case with 2 browsers `-e CHROME=true -e FIREFOX=true` but could be just 1.
118118

@@ -137,9 +137,9 @@ There are also additional steps you can take to ensure you're using the correct
137137

138138
You can simply verify that image id is indeed the correct one.
139139

140-
# e.g. full image id for tag v2.46.0-04
141-
export IMGID=e7ceeaf7ab0adf758a1f2f5e21fe53db9aa2eff7b55b01af1c7fe2620a9f309b
142-
if docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-04 |grep ${IMGID} &> /dev/null; then
140+
# e.g. full image id for tag v2.46.0-05
141+
export IMGID=TBD
142+
if docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-05 |grep ${IMGID} &> /dev/null; then
143143
echo "Image ID tested ok"
144144
else
145145
echo "Image ID doesn't match"
@@ -149,8 +149,8 @@ You can simply verify that image id is indeed the correct one.
149149

150150
Given docker.io currently allows to push the same tag image twice this represent a security concern but since docker >= 1.6.2 is possible to fetch the digest sha256 instead of the tag so you can be sure you're using the exact same docker image every time:
151151

152-
# e.g. sha256 for tag v2.46.0-04
153-
export SHA=6f525fa015e3b815da968a998c58757892955f195cee286b4c39fe15035d01d3
152+
# e.g. sha256 for tag v2.46.0-05
153+
export SHA=TBD
154154
docker pull elgalu/selenium@sha256:${SHA}
155155

156156
You can find all digests sha256 and image ids per tag in the [CHANGELOG](./CHANGELOG.md) so as of now you just need to trust the sha256 in the CHANGELOG. Bullet proof is to fork this project and build the images yourself if security is a big concern.
@@ -169,7 +169,7 @@ Host machine, terminal 2:
169169
docker run --rm --name=ch -p=4470:24444 \
170170
-e SCREEN_WIDTH -e SCREEN_HEIGHT -e XE_DISP_NUM \
171171
-v /tmp/.X11-unix/X${XE_DISP_NUM}:/tmp/.X11-unix/X${XE_DISP_NUM} \
172-
elgalu/selenium:v2.46.0-04
172+
elgalu/selenium:v2.46.0-05
173173

174174
Now when you run your tests instead of connecting. If docker run fails try `xhost +`
175175

@@ -191,7 +191,7 @@ ANYPORT=0
191191
REMOTE_DOCKER_SRV=localhost
192192
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -p=0.0.0.0:${ANYPORT}:24444 \
193193
-p=0.0.0.0:${ANYPORT}:25900 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola \
194-
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-04
194+
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-05
195195
196196
# -- Option 2.docker run- Running docker on remote docker server like in the cloud
197197
# Useful if the docker server is running in the cloud. Establish free local ports
@@ -201,7 +201,7 @@ ssh ${REMOTE_DOCKER_SRV} #get into the remote docker provider somehow
201201
# it acts as a jump host so my public key is already on that server
202202
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -e SCREEN_HEIGHT=1110 \
203203
-e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" \
204-
elgalu/selenium:v2.46.0-04
204+
elgalu/selenium:v2.46.0-05
205205
206206
# -- Common: Wait for the container to start
207207
./host-scripts/wait-docker-selenium.sh ch 7s
@@ -272,7 +272,7 @@ If you git clone this repo locally, i.e. cd into where the Dockerfile is, you ca
272272
273273
If you prefer to download the final built image from docker you can pull it, personally I always prefer to build them manually except for the base images like Ubuntu 14.04.2:
274274
275-
docker pull elgalu/selenium:v2.46.0-04
275+
docker pull elgalu/selenium:v2.46.0-05
276276
277277
#### 2. Use this image
278278

READMELeo.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
## Build
22

3-
time (docker build -t="elgalu/selenium:v2.46.0-04" . ;echo $?;beep)
4-
docker run --rm -ti --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e CHROME_FLAVOR=unstable -e FIREFOX_VERSION=38.0.6 -e VIDEO=true -e VIDEO_FILE_NAME=hola elgalu/selenium:v2.46.0-04
3+
time (docker build -t="elgalu/selenium:v2.46.0-05" . ;echo $?;beep)
4+
docker run --rm -ti --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -p=6080:26080 -p=29001:29001 -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" -v $(pwd)/videos:/videos -e DISABLE_ROLLBACK=true -e CHROME_FLAVOR=unstable -e FIREFOX_VERSION=38.0.6 -e VIDEO=true -e VIDEO_FILE_NAME=hola -e VIDEO_CHUNK_SECS="00:00:05" elgalu/selenium:v2.46.0-05
55

66
See logs
77

88
docker exec -ti ch bash -c "ls -lah /var/log/sele/"
99

1010
Testing in ssh [email protected]
1111

12-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:v2.46.0-04
12+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -p=2222:22222 -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" -e VNC_PASSWORD=Hola3 os-registry.stups.zalan.do/tip/selenium:v2.46.0-05
1313

1414
## Transfer used browser source artifacts to keep them in the cloud
1515

1616
SSHCMD="-o StrictHostKeyChecking=no -q -P 2222 application@localhost"
1717
scp ${SSHCMD}:/home/application/chrome-deb/google*.deb browsers-bins/
18-
#scp ${SSHCMD}:/home/application/firefox-src/firefox-latest.en-US.linux64.tar.bz2 browsers-bins/firefox-38.0.5.en-US.linux64.tar.bz2
1918

2019
List chrome versions via docker exec
2120

@@ -32,18 +31,18 @@ List firefox versions via docker exe
3231

3332
## To update image id and digest
3433

35-
docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-04
34+
docker inspect -f='{{.Id}}' elgalu/selenium:v2.46.0-05
3635
docker images --digests
3736

3837
## Run with shared dir
3938

4039
docker run --rm --name=ch -p=127.0.0.1:4460:24444 -p=127.0.0.1:5910:25900 \
41-
-v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-04
40+
-v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-05
4241
docker run --rm --name=ch -p=4460:24444 -p=5910:25900 \
43-
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.46.0-04
42+
-v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) elgalu/selenium:v2.46.0-05
4443

4544

46-
docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-04
45+
docker run --rm --name=ff -p=127.0.0.1:4461:24444 -p=127.0.0.1:5911:25900 -v /e2e/uploads:/e2e/uploads elgalu/selenium:v2.46.0-05
4746

4847
## Run without shared dir and bind ports to all network interfaces
4948

@@ -66,11 +65,11 @@ List firefox versions via docker exe
6665
## Run without dir and bind to all interfaces
6766
Note anything after the image will be taken as arguments for the cmd/entrypoint
6867

69-
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-04
68+
docker run --rm --name=ch -p=0.0.0.0:8813:8484 -p=0.0.0.0:2222:2222 -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 -e SCREEN_WIDTH=1800 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium:v2.46.0-05
7069

71-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-04
72-
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.46.0-04
73-
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.46.0-04
70+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola elgalu/selenium:v2.46.0-05
71+
docker run --rm --name=ch -p=4470:24444 -p=5920:25900 -e VNC_PASSWORD=hola docker.io/elgalu/selenium:v2.46.0-05
72+
docker run --rm --name=ch -p=0.0.0.0:4470:24444 -p=0.0.0.0:5920:25900 --add-host myserver.dev:172.17.42.1 elgalu/selenium:v2.46.0-05
7473

7574
However adding a custom host IP to server-selenium.local (e.g. bsele ssh config) is more work:
7675

@@ -79,32 +78,32 @@ However adding a custom host IP to server-selenium.local (e.g. bsele ssh config)
7978

8079
vncv localhost:5920 -Scaling=60% &
8180

82-
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:v2.46.0-04
81+
docker run --rm --name=ff -p=0.0.0.0:4471:24444 -p=0.0.0.0:5921:25900 elgalu/selenium:v2.46.0-05
8382

8483
Automatic builds not working for me right now, maybe there is an issue with docker registry v1 vs v2
8584
https://registry.hub.docker.com/u/elgalu/docker-selenium/builds_history/31621/
8685

8786
## Push version
8887

8988
docker login
90-
docker push docker.io/elgalu/selenium:v2.46.0-04 ;echo $?;beep
91-
docker tag elgalu/selenium:v2.46.0-04 elgalu/selenium:latest
89+
docker push docker.io/elgalu/selenium:v2.46.0-05 ;echo $?;beep
90+
docker tag elgalu/selenium:v2.46.0-05 elgalu/selenium:latest
9291
docker push docker.io/elgalu/selenium:latest
9392

9493
Not working maybe because it has automated builds enabled but then it fails in the cloud but works locally
9594
https://registry.hub.docker.com/u/elgalu/selenium/tags/manage/
9695

97-
docker push elgalu/selenium:v2.46.0-04
98-
docker push elgalu/docker-selenium:v2.46.0-04
99-
docker push docker.io/elgalu/docker-selenium:v2.46.0-04
96+
docker push elgalu/selenium:v2.46.0-05
97+
docker push elgalu/docker-selenium:v2.46.0-05
98+
docker push docker.io/elgalu/docker-selenium:v2.46.0-05
10099

101100
## Pulling
102101

103-
docker pull registry.hub.docker.com/elgalu/selenium:v2.46.0-04
102+
docker pull registry.hub.docker.com/elgalu/selenium:v2.46.0-05
104103

105104
## Pull
106105

107-
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:v2.46.0-04
106+
docker run -d --name=max -p=0.0.0.0:4411:24444 -p=0.0.0.0:5911:25900 elgalu/selenium:v2.46.0-05
108107

109108
How to connect through vnc (need a vnc client)
110109

scm-source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"url": "https://github.com/elgalu/docker-selenium",
3-
"revision": "45cfd9122cfaad8cc9ec7099842a7d0e13aa2409",
3+
"revision": "28ac6ce15bfb354df71bae2ee7bc265c4e298a6f",
44
"author": "lgallucci",
55
"status": ""
66
}

supervisor/bin/run-supervisord.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
function shutdown {
55
echo "Trapped SIGTERM/SIGINT/x so shutting down supervisord gracefully..."
66
# First stop video recording because it needs some time to flush it
7-
(supervisorctl -c /etc/supervisor/supervisord.conf stop \
8-
video-rec && sleep ${FLUSH_VIDEO_SECS}) || true
7+
supervisorctl -c /etc/supervisor/supervisord.conf stop video-rec || true
98
supervisorctl -c /etc/supervisor/supervisord.conf stop all
109
# kill -SIGTERM $(cat ${SUPERVISOR_PIDFILE})
1110
kill -SIGTERM ${SUPERVISOR_PID}
1211
wait
12+
# sleep ${SLEEP_SECS_AFTER_KILLING_SUPERVISORD}
13+
# sudo kill -9 ${SUPERVISOR_PID} || true
1314

1415
# when DISABLE_ROLLBACK=true it will:
1516
# - output logs

video-rec/bin/ffmpeg-start-sh

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,54 @@
33
# Make it portable
44
[ -z "${FFMPEG_FRAME_SIZE}" ] && export \
55
FFMPEG_FRAME_SIZE="${SCREEN_WIDTH}x${SCREEN_HEIGHT}"
6-
[ -z "${VIDEO_PATH}" ] && export \
7-
VIDEO_PATH="${VIDEOS_DIR}/${VIDEO_FILE_NAME}.${VIDEO_FILE_EXTENSION}"
6+
7+
# Exit all child processes properly
8+
function shutdown {
9+
echo "Trapped SIGTERM or SIGINT so shutting down ffmpeg-start.sh..."
10+
kill -SIGTERM ${LAST_FFMPEG_PID}
11+
wait ${LAST_FFMPEG_PID}
12+
/bin-utils/fix_video_perms.sh
13+
echo "ffmpeg-start.sh shutdown complete."
14+
exit 0
15+
}
16+
17+
# Run function shutdown() when this process a killer signal
18+
trap shutdown SIGTERM SIGINT SIGKILL
819

920
# record testing video using password file
1021
# using sudo due to http://stackoverflow.com/questions/23544282/
1122
# ffmpeg
1223
# -an no audio
24+
# -v loglevel set logging level, e.g. quiet
25+
# -t duration Stop writing the output after its duration reaches duration
26+
# duration may be a number in seconds, or in
27+
# "hh:mm:ss[.xxx]" form.
1328
# -f x11grab force format
1429
# -y overwrite output files
1530
# -i display and pos
1631
# https://www.ffmpeg.org/ffmpeg-codecs.html
1732
# sudo avconv -an -y -f x11grab \
18-
sudo ffmpeg -an -y -f x11grab \
19-
-framerate ${FFMPEG_FRAME_RATE} \
20-
-video_size ${FFMPEG_FRAME_SIZE} ${FFMPEG_CODEC_ARGS} \
21-
-i "${DISPLAY}.0+0,0" \
22-
"${VIDEO_PATH}" 2>&1
33+
34+
for i in $(seq -f "%03g" 0 ${VIDEO_CHUNKS_MAX}); do
35+
video_name="${VIDEO_FILE_NAME}-$i"
36+
if [ "$i" == "000" ]; then
37+
video_name="${VIDEO_FILE_NAME}"
38+
fi
39+
video_path="${VIDEOS_DIR}/${video_name}.${VIDEO_FILE_EXTENSION}"
40+
41+
# Fix perms to be able to start ffmpeg without sudo
42+
sudo touch "${video_path}"
43+
sudo chown ${NORMAL_USER_UID}:${NORMAL_USER_GID} "${video_path}"
44+
45+
avconv -f x11grab \
46+
-framerate ${FFMPEG_FRAME_RATE} \
47+
-video_size ${FFMPEG_FRAME_SIZE} \
48+
-i "${DISPLAY}.0+0,0" \
49+
${FFMPEG_CODEC_ARGS} \
50+
-t "${VIDEO_CHUNK_SECS}" \
51+
-y -an "${video_path}" 2>&1 &
52+
LAST_FFMPEG_PID=$!
53+
54+
# tells bash to wait until child processes have exited
55+
wait
56+
done

video-rec/bin/fix_video_perms.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# Exit immediately if a command exits with a non-zero status
4+
set -e
5+
6+
# Make it portable
7+
[ -z "${HOST_GID}" ] && export HOST_GID=$(stat -c "%g" ${VIDEOS_DIR})
8+
[ -z "${HOST_UID}" ] && export HOST_UID=$(stat -c "%u" ${VIDEOS_DIR})
9+
[ -z "${VIDEO_BASE_PATH}" ] && export \
10+
VIDEO_BASE_PATH="${VIDEOS_DIR}/${VIDEO_FILE_NAME}"
11+
12+
echo "Fixing perms for "${VIDEO_BASE_PATH}"*"
13+
sudo chown ${HOST_UID}:${HOST_GID} "${VIDEO_BASE_PATH}"*

video-rec/bin/start-video

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/usr/bin/env bash
22

3-
# Old:
4-
# start-stop-daemon --start --background -m --pidfile ${VIDEO_PIDFILE} \
5-
# --exec /bin-utils/vnc2swf-start.sh
6-
73
# Test: supervisorctl -c /etc/supervisor/supervisord.conf status
84
supervisorctl -c /etc/supervisor/supervisord.conf start video-rec
9-
wait-video-rec.sh

0 commit comments

Comments
 (0)