changed codec to VP9 and fixed ffmpeg cmd

This commit is contained in:
Quentin Roussel
2024-08-18 20:26:45 +08:00
parent b9a6b4e3f0
commit 4f81509799
4 changed files with 12 additions and 9 deletions

View File

@@ -33,8 +33,5 @@ jobs:
- name: Upload files - name: Upload files
run: rsync -rvp --chown=quentin:users --chmod=777 --exclude=.gitea --exclude=.git ${{ vars.RSYNC_ARGS }} . remote:${{ vars.DESTINATION_DIR }} 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 - name: Run container
run: ssh remote 'cd ${{ vars.DESTINATION_DIR }} && make run' run: ssh remote 'cd ${{ vars.DESTINATION_DIR }} && make run'

View File

@@ -5,21 +5,27 @@ DEBUG_OUTPUT_DIR = $(PWD)/out
build: build:
docker build . -t $(APP_NAME) docker build . -t $(APP_NAME)
debug:build clean:
mkdir -p $(OUTPUT_DIR) 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/raw
mkdir -p $(PWD)/images/final mkdir -p $(PWD)/images/final
docker run \ docker run \
-it \ -it \
--mount type=bind,source=$(PWD)/images,target=/home/node/app/images \ --mount type=bind,source=$(PWD)/images,target=/home/node/app/images \
--mount type=bind,source=$(DEBUG_OUTPUT_DIR),target=/home/node/app/out \ --mount type=bind,source=$(DEBUG_OUTPUT_DIR),target=/home/node/app/out \
--name $(APP_NAME) \
$(APP_NAME) $(APP_NAME)
run:build run: clean build
mkdir -p $(OUTPUT_DIR) mkdir -p $(OUTPUT_DIR)
docker run \ docker run \
-d \ -d \
--mount type=bind,source=$(OUTPUT_DIR),target=/home/node/app/out \ --mount type=bind,source=$(OUTPUT_DIR),target=/home/node/app/out \
--name $(APP_NAME) \
$(APP_NAME) $(APP_NAME)
.PHONY: build debug run .PHONY: build debug run clean

BIN
out/output.webm Normal file

Binary file not shown.

View File

@@ -39,13 +39,13 @@ export async function createVideo() {
await generateFinalImages(); await generateFinalImages();
//remove video //remove video
try { try {
fs.unlinkSync('out/output.mp4'); fs.unlinkSync('out/output.webm');
} catch (error) { } catch (error) {
console.log('No video to delete'); console.log('No video to delete');
} }
//run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4 //run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4
return new Promise((resolve, reject) => { 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) { if (err) {
reject(err); reject(err);
return; return;