whammy | A real time javascript webm encoder based on a canvas hack
kandi X-RAY | whammy Summary
kandi X-RAY | whammy Summary
This is sort of a conceptual reversal (or not, this might just be making the description needlessly confusing) of one of my older projects, Weppy. First, what Weppy did was it added support for WebP in browsers which didn't support it by converting it into a single-frame video. This is instead predicated on the assumption that the browser already has support for WebP (at this point, it means it only works on Chrome since it's the only browser which actually supports WebP), not only decoding WebP but encoding it as well. The cool thing about WebP which was exploited in Weppy is that it's actually based on the same codec as WebM, On2's VP8. That means the actual image data, when the container formats are ignored, are virtually interchangable. With a catch: it's intraframe only. So it's a video encoder in that it generates .webm files which should play in just about any program or device which supports the WebM format. But interframe compression is actually a fairly important thing which could reduce the file size by an order of magnitude or more. But, there isn't too much you can do on the client side in the ways of encoding stuff. And whatever you do, you basically can't do interframe compression (aside from some really rudimentary delta encoding). More or less, when your only alternative is to maintain an array of DataURL encoded frames or encoding it (rather slowly) as a GIF, a fast but inefficient WebM encoder stops looking too bad.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert the WebML buffer to WebML
- generate EBML from JSON
- Parse rdf file
- Parse the RSS file .
- Generate an EBML file
- sums the lengths of the frames
- Generate a block of data .
- Convert an array into a flat array
- Convert a number to a string .
- Convert a string to Buffer
whammy Key Features
whammy Examples and Code Snippets
Community Discussions
Trending Discussions on whammy
QUESTION
I'm trying to convert a website to use S3 storage instead of local (expensive) disk storage. I solved the download problem using a stream wrapper interface on the S3Client. The upload problem is harder.
It seems to me that when I post to a PHP endpoint, the $_FILES object is already populated and copied to /tmp/ before I can even intercept it!
On top of that, the S3Client->upload() expects a file on the disk already!
Seems like a double-whammy against what I'm trying to do, and most advice I've found uses NodeJS or Java streaming so I don't know how to translate.
It would be better if I could intercept the code that populates $_FILES and then send up 5MB chunks from memory with the S3\ObjectUploader, but how do you crack open the PHP multipart handler?
Thoughts?
EDIT: It is a very low quantity of files, 0-20 per day, mostly 1-5MB sometimes hitting 40~70MB. Periodically (once every few weeks) a 1-2GB file will be uploaded. Hence the desire to move off an EC2 instance and into heroku/beanstalk type PaaS where I won't have much /tmp/ space.
...ANSWER
Answered 2021-Dec-16 at 04:53It's hard to comment on your specific situation without knowing the performance requirements of the application and the volume of users needed to access it so I'll try to answer assuming a basic web app uploading profile avatars.
There are some good reasons for this, the file is streamed to the disk for multiple purposes one of which is to conserve memory use. If your file is not on the disk than it is in memory(think disk usage is expensive? bump up your memory usage and see how expensive that gets), which is fine for a single user uploading a small file, but not so great for a bunch of users uploading small files or worse: large files. You'll likely see the best performance if you use the defaults on these libraries and let them stream to and from the disk.
But again I don't know your use case and you may actually need to avoid the disk at all costs for some unknown reason.
QUESTION
I'm driving myself crazy yet again. :) I'm using SQL Server Report Builder. I have two datasets where I use one of them as a lookup. The lookup works fine, but it also shows blank and null dates. I only want the report to show if there is a date, not the blanks.
This is my lookup
...ANSWER
Answered 2020-Oct-29 at 13:59If this does not help, please see my comment above.
Select the entire row using the row header handle, right-click and choose row visibilty.
Select "Show or hide based on an expression" then set the expression to something like
QUESTION
I have a heating system with three thermostats. If my first thermostat gets too hot it may cause my second to get too hot (although therm 2 could get too hot from other sources), if my second gets too hot it may cause my third to get too hot. What I would like to know is...if my first thermostat gets too hot (recorded as an Event
with a date_start
and date_end
) how often do events in my second AND third thermostat co-occur (what I'm calling a triple whammy event)?
I would define a triple whammy event as such...The date_start
of Temp2
AND Temp3
would have to occur between the date_start
and date_end
of Temp1.
ANSWER
Answered 2020-Aug-07 at 06:14One way to do this is using lubridate functions interval
and %within%
. They're pretty clearly named; interval
creates a time period and %within%
checks whether a supplied time point is within that interval.
Assuming that df1...df3
are actual data frames and not lists of dataframes as they appear to be in the question, we firstly add an interval
variable to df1
, which is our reference interval. We also need to transform the start
dates of df2
and df3
into date
objects with ymd
:
QUESTION
I am getting the following errors when running my application in elastic beanstalk: [error] 3636#0: *295 upstream prematurely closed connection while reading response header from upstream
and [error] 3636#0: *295 connect() failed (111: Connection refused) while connecting to upstream
Its strange because if I hit those routes independently it works fine. It only appears to error when firing those routes from my vuex action.
The following is the log from the AWS elastic beanstalk.
The following is the network tab when it hits my FFmpeg route:
The following is the generate video action as fired from vuex.
...ANSWER
Answered 2020-Jul-30 at 15:17After some digging I found out that I did not set the ffmpeg path. Once this was done it worked great.
QUESTION
I'm working on a simple marbles game for my friends and I to play in Google Sheets.
My script for rolling dice is working well, but when you "roll" the same number as you had before, there's no visual cue that anything happened other than the "script running..." messages at the top of the screen. I'd really like for something noticeable to happen in the merged cells where the die character is, even if that's just clear-pause-new die face. Is there a way to introduce a pause between actions?
Initially, I had the number created by the script visible, and I tried the following methods to create something visual during the script. Now, I've got a nicer looking =CHOOSE formula that calls the Die Face character based on the result of the script.
I've tried:
- Clearing the cell - it happens too fast to see
- Changing the background color and die face several times to simulate a "no-whammy, no-whammy" kind of animation. - also no visual effect
- Introducing Utilities.sleep(200) between color changes - it delayed the entire script running for the correct amount of time, but none of the intermediate steps were visible.
- Browser.msgBox - this works, but is annoying and distracting.
Thanks for your ideas!
...ANSWER
Answered 2020-Apr-30 at 10:15A simple way would be to use toast.
A popup window would appear in the lower right corner of the spreadsheet with a custom message and, optionally, a title:
QUESTION
so I am trying to mimic this code pen https://codepen.io/airnan/pen/ZLVJmq but when I try to load the same animation in with lottie-web npm package everything works great until the last animation. Then it all gets messed up. I'm trying to figure it out but I am so confused. Any ideas as to why? The JSON file is exactly the same except for text_data variable. I just import the whole thing and access it directly. Heres the code. it's just the last frame that doesn't work. it doesn't animate the text at all instead it looks like this.
...ANSWER
Answered 2020-Apr-07 at 21:50You must use keyframes in order to get the animation to render properly once you do that you will have no issues.
QUESTION
Hey everyone so I have a very complex canvas editor that allows a user to pick a video background, add text, gifs and Lottie animations using the Konvajs and Gifler libraries. It has come a long way however I am trying to speed up the performance of my canvas application. I've read a lot about offscreen canvas but I don't quite understand it. Say I have a regular HTML canvas object how would I create an offscreen canvas and spit that back out to the browser? I would ideally like to be able to get images from the canvas in an array at 30 fps with no latency. I also have another concern that offscreen canvas as of yet does not seem to be widely supported according to caniuse.com. Whenever I try to create an offscreen canvas from my canvas I always get:
...ANSWER
Answered 2020-Mar-28 at 03:32Just like you can't request a context 'B' after you got a context 'A', you can't transfer a DOM canvas's control to an OffscreenCanvas after you did request a context from that canvas.
Here you are using Konva.js library (that I don't particularly know) to initialize your DOM canvas. This library will need to access one of the available contexts (apparently the "2D" one) from that canvas. This means that when you will gain access to that canvas, a context will already have been requested by the library and that you won't be able to transfer its control to an OffscreenCanvas.
There is this issue on the library's repo, which points out that no later than 12 days ago they added some initial support for OffscreenCanvases. So I invite you to look at their example on how to proceed with that library.
About OffscreenCanvas PerformancesAn OffscreenCanvas in itself doesn't offer any performance boost compared to a regular canvas. It won't magically make your code that was running at 10FPS to run at 60FPS.
What it allows is to not block the main thread, and to not be blocked by the main thread. And for this, you need to transfer it to a Web Worker.
This means you may use it
- if you are afraid your canvas code can block the UI but you don't really require smooth animation always.
- if you are afraid your main thread may slow down your canvas animation - e.g if you have a lot of other stuff going on on the page.
But in your case, it seems that there is only your code running. So you will probably not win anything by going this route.
About OffscreenCanvas limitationsWe saw that to really take advantages of an OffscreenCanvas, we need to run it in a parallel thread from a Web Worker. But Web Workers don't have access to the DOM.
This is a huge limitation and will make a lot of things way more harder to handle.
For instance, to draw your video, you currently have no other way than to use a element to play it first. The Worker script can't access that
element, and it can't create one on its own thread. So the only solution is to create an ImageBitmap from the main thread and to pass it back to your Worker script.
All the hard work (video decoding + bitmap generation) is done on the main thread. It is worth noting that even though the createImageBitmap()
method returns a Promise, when we use a video as source, the browser has no other choice than to create the Bitmap from the video synchronously.
So while getting that ImageBitmap for use in your worker, you are actually overloading the main thread, and if the main thread is locked doing something else, you will obviously have to wait it's done before getting your frame from the video.
An other big limitation is that currently* Web Workers can't react to DOM events. So you have to set up a proxy to pass the events received in the main thread to your Worker thread. Once again this requires your main thread to be free and a lot of new code.
About your codeBecause, yeah, I believe this is where you should be looking if you want performance improvements.
I only gave it a quick look, but I already saw that you are using setInterval
in a few places at high rate. Don't. If you need to animate something visible always use requestAnimationFrame
, if you don't need the full speed, then add an inner logic to skip frames, but keep using rAF as the main engine.
You are asking the browser to do heavy actions every frames. For instance your svg part is creating a full new svg markup from the DOM node at every frame, then this markup is loaded in an (this mean the browser has to launch an entire new DOM for that image), and rasterized on a canvas.
This in itself will be hard to cope at high frame-rate, and an OffscreenCanvas won't help.
You are storing all the images as stills to produce your final video. This will take a lot of memory.
There is probably a lot of other stuff like that in your code, so review it thoroughly and search for what make your code not able to reach the screen refresh rate. Improve what can be, search for alternatives (for instance MediaRecorder might be better than Whammy when supported) and good luck.
*There is an ongoing proposal to fix that issue
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install whammy
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page