Comments (3)
ah my apologies for the delay I think this would work for me thanks a lot!
from whammy.
Had the same problem when compiling complex videos (with globalOpacity and lots of frames).
The easiest workaround I've found is to just add an empty frame to the video, that way, the last part gets cut instead of the actual content you want to put in the video.
So in this case, it would be:
var video = new Whammy.Video;
video.duration = 15000;
video.quality = 1;
//assuming here that we have an image from a canvas to use:
video.add(context);
// Fill the canvas with a black rectangle
context.fillStyle = "#000000"
context.fillRect(0, 0, context.canvas.width, context.canvas.height)
video.add(context, 1) // Doesn't matter what duration you put here, still gets cut to the first frame
video.compile();
EDIT:
The solution I proposed has one flaw, it leaves a black screen as the last frame.
Also, using context.clearRect
does not work. You have to have image data on the canvas for whammy to add the frame to the video. The next best performant thing would probably be just doing context.fillRect(0, 0, 1, 1)
but that doesn't work either.
You could experiment to find out what would be the smallest rectangle you could draw so you could improve performance, but it's only one frame anyway.
from whammy.
@drabinowitz Please indicate if my solution helped you so the owner can close the issue 🙂
from whammy.
Related Issues (20)
- should be able to add a blob HOT 2
- callback is not a function line 556 HOT 4
- clock.html demo does not work in Firefox and Chromium HOT 2
- Adding text HOT 2
- a way for passing chunks
- Webgl context
- Cannot use 'in' operator to search for 'canvas' in data:image/webp;base64... HOT 2
- InvalidCharacterError: String contains an invalid character HOT 1
- Video and Canvas merging HOT 6
- Compile Error
- To people who care about this project. Recommend use ts-whammy. HOT 1
- opus packets
- Simple Block timestamp going negative when time given explicitly using add function HOT 3
- what have i do to change time duration video?
- Webm with transparency
- Webm with sound
- Whammy gives Black Screen Webm video on latest Google Chrome HOT 6
- Has anyone got Whammy to work recently? HOT 2
- Error 'Frame 2 has a different width' since Chrome version 108 HOT 1
- js is a a html tagged file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whammy.