From a5ef4747db64ca57143b37abfb9664a8c7ea2b58 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 10 Jan 2025 17:15:34 -0500 Subject: [PATCH 1/8] chmod +x ./cli.js --- src/cli.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/cli.ts diff --git a/src/cli.ts b/src/cli.ts old mode 100644 new mode 100755 From 94cd62c3c514a56e0c16f38eb4208937f8f44498 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 10 Jan 2025 17:08:44 -0500 Subject: [PATCH 2/8] Remove example that is missing assets --- examples/losslesscut.json5 | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 examples/losslesscut.json5 diff --git a/examples/losslesscut.json5 b/examples/losslesscut.json5 deleted file mode 100644 index c69c3d99..00000000 --- a/examples/losslesscut.json5 +++ /dev/null @@ -1,36 +0,0 @@ -{ - // fast: false, - outPath: './losslesscut.mp4', - // verbose: true, - // enableFfmpegLog: true, - fps: 30, - audioFilePath: './Believe - Roa [Vlog No Copyright Music]-qldyHxWPFUY.m4a', - defaults: { - transition: { name: 'crossZoom', duration: 1 }, - layer: { fontPath: './assets/Patua_One/PatuaOne-Regular.ttf' }, - }, - clips: [ - { duration: 3, layers: [{ type: 'title-background', text: 'LosslessCut', background: { type: 'linear-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/intro.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Capture full resolution screenshots', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/capture screenshots.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Extract tracks as individual files', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/extract tracks as individual files.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Keyframes and zoom', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/keyframes and zoom.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Label segments', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/label segments.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Lossless rotation', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/lossless rotation.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Thumbnails', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/thumbnails.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Audio waveforms', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/audio waveform.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Track information', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/track information.mov' }] }, - { duration: 3, layers: [{ type: 'title-background', text: 'Tracks editor and audio swap', background: { type: 'radial-gradient' } }] }, - { layers: [{ type: 'video', path: '/Users/mifi/Desktop/losslesscut-usage/tracks editor and replace audio.mov' }] }, - { duration: 4, layers: [{ type: 'title-background', text: 'Get it from\nMac App Store\nWindows Store', background: { type: 'color', color: 'black' } }] }, - { duration: 2, layers: [{ type: 'editly-banner' }] }, - ], -} From 9cc56f02e5ca9bf42e8418ca91c6e42236d1861b Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 10 Jan 2025 17:07:10 -0500 Subject: [PATCH 3/8] Add workflow to run all examples --- .github/workflows/examples.yml | 61 ++++++++++++++++++++++++++++++++++ examples/README.md | 13 +++----- examples/run | 20 +++++++++++ examples/run-all-examples.sh | 10 ------ 4 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/examples.yml create mode 100755 examples/run delete mode 100755 examples/run-all-examples.sh diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 00000000..4d602e81 --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,61 @@ +name: Examples + +on: + push: + branches: [main] + pull_request: + +jobs: + list-examples: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: echo "::set-output name=matrix::$(cd examples && ls *.{ts,json5} | jq -R -s -c 'split("\n")[:-1]')" + examples: + needs: list-examples + runs-on: ubuntu-latest + strategy: + matrix: + example: ${{ fromJson(needs.list-examples.outputs.matrix) }} + fail-fast: false + name: ${{ matrix.example }} + env: + DISPLAY: :0 + steps: + - run: | + sudo apt-get update && sudo apt-get install -y \ + build-essential \ + ffmpeg \ + libcairo2-dev \ + libgif-dev \ + libglew-dev \ + libglu1-mesa-dev \ + libjpeg-dev \ + libpango1.0-dev \ + librsvg2-dev \ + libxi-dev \ + pkg-config + - run: sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 & + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: mifi/editly-assets + path: examples/assets + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "yarn" + cache-dependency-path: ./package.json + - run: yarn install + - run: | + cd examples + ./run "${{ matrix.example }}" + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.example }} + path: "*.{png,gif,mp4}" + compression-level: 0 + if-no-files-found: error diff --git a/examples/README.md b/examples/README.md index b880e351..c3f2fde4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -5,15 +5,12 @@ This folder contains examples and tests for different features. How to run examples: ```bash -npm i -g editly - git clone https://github.com/mifi/editly.git - -cd editly/examples - +cd editly +npm install +cd examples git clone https://github.com/mifi/editly-assets.git assets - -editly --fast commonFeatures.json5 +./run commonFeatures.json5 ``` ## Image slideshow with Ken Burns zoom @@ -94,4 +91,4 @@ https://user-images.githubusercontent.com/907138/214545896-ab420beb-bd50-4974-9b ## LosslessCut tutorial -[This video](https://www.youtube.com/watch?v=pYHMxXy05Jg) was created with [losslesscut.json5](https://github.com/mifi/editly/blob/master/examples/losslesscut.json5) \ No newline at end of file +[This video](https://www.youtube.com/watch?v=pYHMxXy05Jg) was created with [losslesscut.json5](https://github.com/mifi/editly/blob/master/examples/losslesscut.json5) diff --git a/examples/run b/examples/run new file mode 100755 index 00000000..4ffd667e --- /dev/null +++ b/examples/run @@ -0,0 +1,20 @@ +#/bin/bash +## Run an example or all examples +# Usage: ./run [example1.ts] [example2.json5] ... +set -e + +# Get list of examples from args or all files in examples directory +if [ "$#" -eq 0 ]; then + examples=$(ls *.{ts,json5}) +else + examples=$@ +fi + +for example in $examples; do + echo "Running $example" + if [[ $example == *.ts ]]; then + npx tsx "$example" + else + node ../dist/cli.js --fast --json "$example" + fi +done diff --git a/examples/run-all-examples.sh b/examples/run-all-examples.sh deleted file mode 100755 index 8a94dff9..00000000 --- a/examples/run-all-examples.sh +++ /dev/null @@ -1,10 +0,0 @@ -#/bin/bash -set -ex - -node ../dist/cli.js --json gl.json5 -node ../dist/cli.js --json image.json5 -node ../dist/cli.js --json speedTest.json5 -node ../dist/cli.js --json subtitle.json5 -node ../dist/cli.js --json transitionEasing.json5 -node ../dist/cli.js --json transparentGradient.json5 -node ../dist/cli.js --json commonFeatures.json5 From 3dd05754c6bccf77dd87de8530b0678adc228c42 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 17 Jan 2025 21:44:19 -0500 Subject: [PATCH 4/8] Disable compression for test artifact --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16095409..9e5d4bec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,3 +57,5 @@ jobs: with: name: video-${{ runner.os }} path: editly-out.mp4 + compression-level: 0 + if-no-files-found: error From 33c4c25c1fed810ab65f5a99b570a74547a16124 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 17 Jan 2025 21:49:45 -0500 Subject: [PATCH 5/8] Fix artifact path --- .github/workflows/examples.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 4d602e81..699f63e7 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -56,6 +56,9 @@ jobs: - uses: actions/upload-artifact@v4 with: name: ${{ matrix.example }} - path: "*.{png,gif,mp4}" + path: | + examples/*.png + examples/*.gif + examples/*.mp4 compression-level: 0 if-no-files-found: error From 87b2955dc280758cdef71cc73079af9401e2f60d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 17 Jan 2025 21:55:00 -0500 Subject: [PATCH 6/8] Add webp to list of output files --- .github/workflows/examples.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 699f63e7..c4fbb0d7 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -60,5 +60,6 @@ jobs: examples/*.png examples/*.gif examples/*.mp4 + examples/*.webp compression-level: 0 if-no-files-found: error From b824eb2c7ffacd8833fd46b2ca56c33d7729a375 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Sat, 18 Jan 2025 09:01:56 -0500 Subject: [PATCH 7/8] Remove examples with missing assets --- examples/lowerThirds1Line.json5 | 12 ------------ examples/lowerThirds2Lines.json5 | 13 ------------- 2 files changed, 25 deletions(-) delete mode 100644 examples/lowerThirds1Line.json5 delete mode 100644 examples/lowerThirds2Lines.json5 diff --git a/examples/lowerThirds1Line.json5 b/examples/lowerThirds1Line.json5 deleted file mode 100644 index a37a4e41..00000000 --- a/examples/lowerThirds1Line.json5 +++ /dev/null @@ -1,12 +0,0 @@ -{ - width: 1280, - height: 720, - outPath: './lowerThirds1Line.mp4', - clips: [ - { duration: 7, layers: [ - { type: 'fill-color', color: '#555' }, - { type: 'video', path: 'assets/lowerthirds/UHD_DMGMORI_Lwr3rd_1Line.mov', resizeMode: 'contain' }, - { type: 'slide-in-text', text: 'Lower Line Regular Source Text', position: { x: 0.035, y: 0.930, originX: 'left', originY: 'bottom' }, color: '#000', fontSize: 0.021, charSpacing: 0.025, fontPath: './assets/lowerthirds/FF DIN Pro Light.otf' }, - ] }, - ], -} diff --git a/examples/lowerThirds2Lines.json5 b/examples/lowerThirds2Lines.json5 deleted file mode 100644 index ebc85d37..00000000 --- a/examples/lowerThirds2Lines.json5 +++ /dev/null @@ -1,13 +0,0 @@ -{ - width: 1280, - height: 720, - outPath: './lowerThirds2Lines.mp4', - clips: [ - { duration: 7, layers: [ - { type: 'fill-color', color: '#555' }, - { type: 'video', path: 'assets/lowerthirds/UHD_DMGMORI_Lwr3rd_2Lines.webm', resizeMode: 'contain' }, - { type: 'slide-in-text', text: 'Upper Line Bold Source Text', position: { x: 0.035, y: 0.877, originX: 'left', originY: 'bottom' }, color: '#000', fontSize: 0.021, charSpacing: 0.03, fontPath: './assets/lowerthirds/FF DIN Pro Medium.otf' }, - { type: 'slide-in-text', text: 'Lower Line Regular Source Text', position: { x: 0.035, y: 0.930, originX: 'left', originY: 'bottom' }, color: '#000', fontSize: 0.021, charSpacing: 0.025, fontPath: './assets/lowerthirds/FF DIN Pro Light.otf' }, - ] }, - ], -} From 75054a028e35e5fa5aa9d989441d0d3cdc72b12f Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Sat, 18 Jan 2025 09:22:58 -0500 Subject: [PATCH 8/8] Fix shebang in examples/run Co-authored-by: Mikael Finstad --- examples/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/run b/examples/run index 4ffd667e..50e9b103 100755 --- a/examples/run +++ b/examples/run @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash ## Run an example or all examples # Usage: ./run [example1.ts] [example2.json5] ... set -e