Hi HN,
I love new web tech, and was excited to see ffmpeg ported to WebAssembly so decided to build a free tool that uses it to:
- Clip/trim videos - Overlay text and images - Resize - Create GIFs or convert to a web-friendly MP4
All of this done in your browser, without ever uploading a file to a web server! (* Except Safari, it doesn't support SharedArrayBuffers)
A little more:
I've been building a video creation app with my cofounder, and being a 2-man team, we wanted to think outside of the box on an "eng as marketing" strategy.
As a techy on a budget, ffmpeg.wasm sounded like the perfect library to make a powerful free tool without requiring a ton of server resources.
So we looked up some common tasks people want to do with videos and set out to build a quick tool to accomplish them.
I think there's a ton more we can build into this - it's been about a 2 week project, but thought it was cool enough to do an initial release now.
Hope you like it, and have suggestions on what we can improve!
I have previously tinkered with ffmpeg in the browser and implemented a workaround[1] for the (then) missing pthread support. It turned out quite clunky, but worked.
- First they were disabled due to Spectre. - Chrome reenabled them. - New HTTP headers were added for cross-origin resource partitioning. - FF/Chrome are both requiring those headers (FF now, Chrome next month)
That's awesome that you've played around with this, too. It was quite a bit of fun :)
We had to "optimize" loading it twice.
The first time, I moved it from auto-loading to when the user clicks convert to save on bandwidth.
The second time, I moved it to after a file is selected. That gives it time to load while users are presented with options before converting.
It's definitely a trade-off. For us, the choice was easy-ish because we want to keep the budget down as Indie Hackers, so we can't just offer a free tool that costs a ton in backend/serverless charges.
Even our mp4s aren't very well-optimized right now.
If you work with video a bit and think this tool might be helpful to you, let me know!
I'm using ffmpeg.wasm, it's basically ffmpeg compiled for the browser, and it's a simple layer where you basically treat it like the ffmpeg command, eg:
ffmpeg.run(['-i', 'input.gif', ..., 'output.gif').then(() => { // handle output file })
That sounds like a great use case for us to handle! Although I think ffmpeg in the browser loses some efficiency over the command line.
I think we added cropping as a possible future feature. I'll bet ffmpeg makes that really easy to do.
I think we should also work on optimizing the output size. I think we use a pretty high (err, low) -crf, which can result in ridiculous file sizes.
Thanks for the comment! Appreciate hearing use cases :)
Our tool definitely isn't as slick, but I think that has its benefits too. Like our trim interface doesn't look as nice, but shows a live preview of where you're at in the video.
I want their UI and style haha
Would love to chat about what you guys doing.Potentially collab and improve both our products!
Reach out rahul@modfy.video
Our app plug: 7 years back we did a quick tool to shrink JPG's in browser (Again needs Chrome or Firefox) without uploading images to server: http://shrinkjpeg.com
It's so cool to do it all in the browser!
I even built a simple landing page creator that let you change text and images, then created a zip file that you could extract to your web host - no backend needed!
I think for me, CORS is the biggest hindrance to some of my ideas, esp. around editing, creation, and working with the content.
But also get it if you mean you're not in a good place to test the tool at the moment haha
To improve the tool it would be nice to play the part clipped with the sound to check if it's ok. Also the tool failed to load one video.
Good job !
There are some pretty crazy security restrictions (no external scripts!) just to get ffmpeg running. I can't imagine the additional security precautions that would prevent exploits for WebGPU.
EDIT: working again now, looks pretty cool!
This description is absolutely killing me.
Adding the ability to loop the gif back and forth would be great!
I haven't checked the exact hit, but that's mostly because our focus for this tool was on people who would never touch ffmpeg or a command line.
Also, the alternative for us would've been to upload remotely and run on Lambda or similar, which I think would lack hardware acceleration as well.
Unfortunately, of course, they then want to get paid during playback, but that's the reality for everyone already.