Browse Source

fix gif issues

new-features-2020
Mikael Finstad 6 years ago
parent
commit
788be17f4d
  1. 3
      README.md
  2. 4
      index.js
  3. 2
      sources/fabric.js

3
README.md

@ -1,4 +1,4 @@
# editly 🏄‍♀️
# EDITLY 🏄‍♀️
[![demo](https://github.com/mifi/gifs/raw/master/commonFeatures.gif)](https://youtu.be/LNeclLkxUEY) [![demo](https://github.com/mifi/gifs/raw/master/commonFeatures.gif)](https://youtu.be/LNeclLkxUEY)
@ -27,6 +27,7 @@ Inspired by [ffmpeg-concat](https://github.com/transitive-bullshit/ffmpeg-concat
- Overlay transparent images or even videos with alpha channel - Overlay transparent images or even videos with alpha channel
- Show different sub-clips for parts of a clips duration (B-roll) - Show different sub-clips for parts of a clips duration (B-roll)
- Automatic audio crossfading - Automatic audio crossfading
- Picture-in-picture
## Use cases ## Use cases

4
index.js

@ -165,7 +165,7 @@ const Editly = async (config = {}) => {
// https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality // https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
const outputArgs = isGif ? [ const outputArgs = isGif ? [
'-vf', '-vf',
`fps=${fps},scale=${width}:${height}:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse`,
`format=rgb24,fps=${fps},scale=${width}:${height}:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse`,
'-loop', 0, '-loop', 0,
'-y', outPath, '-y', outPath,
] : [ ] : [
@ -193,7 +193,7 @@ const Editly = async (config = {}) => {
...(audioFilePath ? [...loopAudioArgs, '-i', audioFilePath, '-shortest'] : []), ...(audioFilePath ? [...loopAudioArgs, '-i', audioFilePath, '-shortest'] : []),
'-map', '0:v:0',
...(!isGif ? ['-map', '0:v:0'] : []),
...(audioFilePath ? ['-map', '1:a:0'] : []), ...(audioFilePath ? ['-map', '1:a:0'] : []),
...(audioFilePath ? ['-acodec', 'aac', '-b:a', '128k'] : []), ...(audioFilePath ? ['-acodec', 'aac', '-b:a', '128k'] : []),

2
sources/fabric.js

@ -43,7 +43,9 @@ function createFabricCanvas({ width, height }) {
} }
async function renderFabricCanvas(canvas) { async function renderFabricCanvas(canvas) {
// console.time('canvas.renderAll');
canvas.renderAll(); canvas.renderAll();
// console.timeEnd('canvas.renderAll');
const rgba = fabricCanvasToRgba(canvas); const rgba = fabricCanvasToRgba(canvas);
canvas.clear(); canvas.clear();
canvas.dispose(); canvas.dispose();

Loading…
Cancel
Save