Add video processing
This commit is contained in:
21
prepareVideo.sh
Executable file
21
prepareVideo.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The video starts with a few blank frames, we want to know when the stop
|
||||
ffprobe -f lavfi -i "movie=app.mp4,blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1 -v quiet > ffmpeg_info
|
||||
END_OF_BLACK=`cat ffmpeg_info | grep end | head -n1 | cut -d'=' -f2`
|
||||
|
||||
# Find crop values for black bars
|
||||
CROP=`ffmpeg -i app.mp4 -t 1 -vf cropdetect -f null - 2>&1 | awk '/crop/ { print $NF }' | head -n1`
|
||||
|
||||
# Crop and trim black frames at start
|
||||
ffmpeg -ss $END_ONF_BLACK -i app.mp4 -vf "$CROP" app2.mp4
|
||||
mv app2.mp4 app.mp4
|
||||
|
||||
# Generate gif palette
|
||||
ffmpeg -y -i app.mp4 -vf fps=10,scale=720:-1:flags=lanczos,palettegen palette.png
|
||||
|
||||
# Create gif
|
||||
ffmpeg -i app.mp4 -i palette.png -filter_complex "fps=10,scale=720:-1:flags=lanczos[x];[x][1:v]paletteuse" app.gif
|
||||
|
||||
# Clean up
|
||||
rm ffmpeg_info palette.png
|
||||
28
uiTests.sh
28
uiTests.sh
@@ -1,20 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
function finish {
|
||||
echo "UUUUPS I crashed"
|
||||
tmux send-keys -t record q || echo "No tmux was running"
|
||||
echo kill $PID_XVFB $PID_CHROMEDRIVER $PID_MOSQUITTO
|
||||
kill $PID_XVFB $PID_CHROMEDRIVER $PID_MOSQUITTO
|
||||
}
|
||||
|
||||
trap finish EXIT
|
||||
|
||||
set -e
|
||||
|
||||
SCR=99
|
||||
# Start new window manager
|
||||
Xvfb :$SCR -screen 0 1024x800x24 -ac &
|
||||
PID_XVFB=$!
|
||||
export PID_XVFB=$!
|
||||
sleep 2
|
||||
|
||||
mosquitto &
|
||||
export PID_MOSQUITTO=$!
|
||||
|
||||
DISPLAY=:$SCR ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515 &
|
||||
PID_CHROMEDRIVER=$!
|
||||
export PID_CHROMEDRIVER=$!
|
||||
sleep 2
|
||||
|
||||
# Delete old video
|
||||
rm ./app.mp4
|
||||
rm ./app.mp4 || echo no need to delete ./app.mp4
|
||||
|
||||
# Start recoring in tmux
|
||||
tmux new-session -d -s record ffmpeg -f x11grab -video_size 1024x800 -i :$SCR -codec:v libx264 -r 20 ./app.mp4
|
||||
tmux new-session -d -s record ffmpeg -f x11grab -draw_mouse 0 -video_size 1024x800 -i :$SCR -codec:v libx264 -r 20 ./app.mp4
|
||||
|
||||
# Start tests
|
||||
node dist/src/spec/webdriverio.js
|
||||
@@ -22,4 +36,8 @@ node dist/src/spec/webdriverio.js
|
||||
# Stop recording
|
||||
tmux send-keys -t record q
|
||||
|
||||
kill $PID_XVFB $PID_CHROMEDRIVER
|
||||
# Ensure video is written
|
||||
sleep 5
|
||||
|
||||
# Process the video
|
||||
./prepareVideo.sh
|
||||
|
||||
Reference in New Issue
Block a user