diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index aebad67..1c439f6 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -33,8 +33,5 @@ jobs: - name: Upload files run: rsync -rvp --chown=quentin:users --chmod=777 --exclude=.gitea --exclude=.git ${{ vars.RSYNC_ARGS }} . remote:${{ vars.DESTINATION_DIR }} - - name: Remove old container - run: docker kill $(docker ps -aq --filter ancestor=sg_rain_radar) && docker rm $(docker ps -aq --filter ancestor=sg_rain_radar) - - name: Run container run: ssh remote 'cd ${{ vars.DESTINATION_DIR }} && make run' diff --git a/Makefile b/Makefile index 81a7efc..27e3470 100644 --- a/Makefile +++ b/Makefile @@ -5,21 +5,27 @@ DEBUG_OUTPUT_DIR = $(PWD)/out build: docker build . -t $(APP_NAME) -debug:build - mkdir -p $(OUTPUT_DIR) +clean: + docker stop $(APP_NAME) + docker rm $(APP_NAME) + +debug: clean build + mkdir -p $(DEBUG_OUTPUT_DIR) mkdir -p $(PWD)/images/raw mkdir -p $(PWD)/images/final docker run \ -it \ --mount type=bind,source=$(PWD)/images,target=/home/node/app/images \ --mount type=bind,source=$(DEBUG_OUTPUT_DIR),target=/home/node/app/out \ + --name $(APP_NAME) \ $(APP_NAME) -run:build +run: clean build mkdir -p $(OUTPUT_DIR) docker run \ -d \ --mount type=bind,source=$(OUTPUT_DIR),target=/home/node/app/out \ + --name $(APP_NAME) \ $(APP_NAME) -.PHONY: build debug run \ No newline at end of file +.PHONY: build debug run clean \ No newline at end of file diff --git a/out/output.webm b/out/output.webm new file mode 100644 index 0000000..701f4ff Binary files /dev/null and b/out/output.webm differ diff --git a/video.mjs b/video.mjs index e1f59eb..d9e8373 100644 --- a/video.mjs +++ b/video.mjs @@ -39,13 +39,13 @@ export async function createVideo() { await generateFinalImages(); //remove video try { - fs.unlinkSync('out/output.mp4'); + fs.unlinkSync('out/output.webm'); } catch (error) { console.log('No video to delete'); } //run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4 return new Promise((resolve, reject) => { - exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libvpx -r 30 out/output.webm', (err, stdout, stderr) => { + exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libvpx-vp9 -b:v 1M -r 30 out/output.webm', (err, stdout, stderr) => { if (err) { reject(err); return;