News for hackers. Stuff that matters.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by mtrimpe on Friday November 15, 2013 @10:38AM (#6739982)
So we took a performance-sensitive embarrasingly-parallel problem and made it run on a slow single-threaded language?

Sounds like fun ;)

Re:Process videos in browser using FFmpeg compiled to JavaSc... by joeld42 on Friday November 15, 2013 @11:59AM (#6740505)
Or you could think of it as taking a compute-intensive problem and distributing it widely.

Or taking a bandwidth-bound problem and completely eliminating that bottleneck.

If you've got 1000 people converting videos at once, the embarrassingly parallel isn't going to help you much on the server.

This does look like fun, and really a nice validation for emscripten, and there's a ton of practical application.

Re:Process videos in browser using FFmpeg compiled to JavaSc... by Osmium on Friday November 15, 2013 @07:12PM (#6742934)
True; this seems a bit silly at first glance, but imagine how much money a YouTube-like site could save if videos were converted in the user's browser before upload, rather than by the server.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by mtrimpe on Saturday November 16, 2013 @01:23PM (#6745816)
It's also an excellent new benchmark for JavaScript VMs. If we can get near-native performance on this it'll enable a whole new class of application.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by CSDude on Friday November 15, 2013 @11:09AM (#6740154)
Computation intensive applications can be done in multithread by easily using web workers. It is been around for a long time. See the following site for a quick benchmark. [1]

[1]: http://pmav.eu/stuff/javascript-webworkers/

Here are my results: 8 Workers, Test: 2^1024000000 mod 97777 = 20631, 1515 ms 4 Workers, Test: 2^1024000000 mod 97777 = 20631, 2899 ms 2 Workers, Test: 2^1024000000 mod 97777 = 20631, 5773 ms 1 Worker, Test: 2^1024000000 mod 97777 = 20631, 11508 ms

Re:Process videos in browser using FFmpeg compiled to JavaSc... by mtrimpe on Friday November 15, 2013 @11:24AM (#6740242)
That doesn't work with Emscriptem though because web workers don't support shared state. [1]

If they manage to move FFMPEG encoding into multiple web workers I'd love to read their writeup though!

[1] https://github.com/kripken/emscripten/issues/953

Re:Process videos in browser using FFmpeg compiled to JavaSc... by kevingadd on Saturday November 16, 2013 @05:18AM (#6744343)
Video encoding/decoding are in fact not embarassingly parallel. Lots of modern codecs have complex interdependencies between frames and sections of frames that make it harder to do things in parallel, as I understand it.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by mtrimpe on Saturday November 16, 2013 @10:08AM (#6744975)
It might not be truly embarrassingly parallel anymore but H264 and VP8, the web's bread-and-butter codecs, both support multithreaded encoding and will comfortably max out all your cores.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by NatW on Friday November 15, 2013 @11:02AM (#6740116)
:) well, technically they did use a web worker in their demo, so it's on a background thread, at least.
Re:Process videos in browser using FFmpeg compiled to JavaSc... by darkchasma on Friday November 15, 2013 @12:29PM (#6740716)
So you're saying that people should never do anything unless it has an immediate useful result?
Re:Process videos in browser using FFmpeg compiled to JavaSc... by mtrimpe on Friday November 15, 2013 @01:09PM (#6740994)
I said I thought it was fun! I probably should've made up and added /!s after all :)
Re:Process videos in browser using FFmpeg compiled to JavaSc... by gngeal on Friday November 15, 2013 @01:28PM (#6741151)
If you combine fixed-point arithmetics, tiled memory access patterns, asm.js, and dynamic image processing pipeline compilation (the way that, for example, VirtualDub did it), you'll probably discover that the "slow single-threaded language" probably isn't slow at all for image processing tasks. (And WebCL is still on the horizon.)