TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JSMpeg – Decode It Like It's 1999

235 pointsby phoboslabover 8 years ago

26 comments

cs2818over 8 years ago
The &quot;Why Use JSMPEG&quot; section hits the nail on the head with respect to the needs of some projects I have worked on.<p>Particularly, I once needed to stream video from a UAV to multiple tablets and phones on a local network to allow collaborative annotations. Since it was a disaster response system there was no depending on external services, which at the time put WebRTC out of the picture (all of the easy to use implementations required internet access to use existing signaling services).<p>We ended up using MJPEG and then later a JavaScript implementation of a MPEG-1 decoder. This library certainly would have made my life a little easier at the time!
评论 #13555224 未加载
评论 #13554048 未加载
评论 #13555978 未加载
评论 #13554899 未加载
评论 #13555534 未加载
peterhajasover 8 years ago
Video decoding in JS is very impressive - really highlights the speed of modern interpreters. I especially love that a Björk track from the 90&#x27;s is featured.<p>I recently worked on a personal project which had to play back .webm files, and I used a similar utility:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;brion&#x2F;ogv.js&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;brion&#x2F;ogv.js&#x2F;</a><p>It decodes .webm files and plays them in the web. I believe it&#x27;s also used by Wikipedia to play bag Ogg files.
评论 #13552244 未加载
stepik777over 8 years ago
Yet another people who cannot correctly decode video. Videos are not in sRGB color space and must be converted to it for displaying in browser. Also videos do not use full range 0-255, instead they use narrow range 15-235 where color (15, 15, 15) means black and (235, 235, 235) means white; this should be converted to the full range which is used in web-canvas.
评论 #13557054 未加载
Tade0over 8 years ago
I remember toying with this idea when I was doing some web-based slot-machine mobile games.<p>We had a ridiculous amount of assets(mostly animations) that had to be compressed, because one of the sales representatives noticed, that it&#x27;s impossible to play any of the games if you&#x27;re connected to a 2G network.<p>Eventually we didn&#x27;t go with this solution, because it considerably reduced battery life and made the devices heat up too much.
chadnickbokover 8 years ago
This is really cool! But the compression quality of MPEG1 is really nowhere close to h264.<p>If you&#x27;re interested in this sorta thing, try taking a look at Broadway JS: <a href="https:&#x2F;&#x2F;github.com&#x2F;mbebenita&#x2F;Broadway" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mbebenita&#x2F;Broadway</a><p>Here&#x27;s a simple demo page they have setup: <a href="http:&#x2F;&#x2F;mbebenita.github.io&#x2F;Broadway&#x2F;foxDemo.html" rel="nofollow">http:&#x2F;&#x2F;mbebenita.github.io&#x2F;Broadway&#x2F;foxDemo.html</a><p>Its entirely possible to use WebSockets to stream H264 to a browser and decode using broadway, and the performance is pretty good, even on mobile.
评论 #13556810 未加载
评论 #13554370 未加载
评论 #13556004 未加载
评论 #13556233 未加载
Mizzaover 8 years ago
This has also opened up some awesome new browser experiments, such as playing GTAV in the browser (on an iPhone!)<p><a href="http:&#x2F;&#x2F;phoboslab.org&#x2F;log&#x2F;2015&#x2F;07&#x2F;play-gta-v-in-your-browser-sort-of" rel="nofollow">http:&#x2F;&#x2F;phoboslab.org&#x2F;log&#x2F;2015&#x2F;07&#x2F;play-gta-v-in-your-browser-...</a>
mborchover 8 years ago
Cisco&#x27;s got a royalty-free codec that would let you decode like it&#x27;s 2017. <a href="https:&#x2F;&#x2F;github.com&#x2F;cisco&#x2F;thor" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cisco&#x2F;thor</a>
评论 #13554680 未加载
评论 #13560009 未加载
yeurekaover 8 years ago
This is very cool! In 1999 my degree final year project was to implement an mpeg decoder in software. My only source of information was the MPEG technical reference manuals. It took me 3 months to be able to decode my first frame. It ran at less than 10fps on an AMD K6, but I learn a lot about video and compression.
评论 #13555503 未加载
rucas__over 8 years ago
The talk about JSMpeg is an awesome learning experience. <a href="https:&#x2F;&#x2F;fronteers.nl&#x2F;congres&#x2F;2015&#x2F;sessions&#x2F;jsmpeg-by-dominic-szablewski" rel="nofollow">https:&#x2F;&#x2F;fronteers.nl&#x2F;congres&#x2F;2015&#x2F;sessions&#x2F;jsmpeg-by-dominic...</a>
shabbyrobeover 8 years ago
Watch out! Some of this code may be GPL-encumbered. The decoder for JSMpeg is based in part on &quot;Java MPEG-1 Video Decoder and Player&quot; [1], which is licensed under the GPLv2. I am not a lawyer, but an argument could be made that the sections of JSMpeg&#x27;s decoder that are directly ported from that project are a derivative work.<p><pre><code> [1]: https:&#x2F;&#x2F;sourceforge.net&#x2F;projects&#x2F;javampeg1video&#x2F;</code></pre>
eriknstrover 8 years ago
I notice that the demo video stops when I switch tabs. Is this by design or by accident? Can I use JSMpeg but have it play in the background? Another thing; can I have video controls?<p>PS: That video has a very late nineties, early double-ohs feel to it indeed. Good choice of video :)
评论 #13552486 未加载
评论 #13552405 未加载
VeejayRampayover 8 years ago
Combine this with webtorrent and you have yourself a real nice distribution platform.
bagelsover 8 years ago
I don&#x27;t know where they get the &quot;5 seconds&quot; of latency for dash videos. There&#x27;s definitely a startup latency, but it&#x27;s not 5 seconds, and can be avoided with some simple techniques.
评论 #13569576 未加载
flukusover 8 years ago
Advertisers will use this to get around video blocking in 3...2...1...
dalanmillerover 8 years ago
It is incredibly hard to stream video from say, a Raspberry Pi to the web in a way&#x2F;format that&#x27;s easy to consume on multiple devices or using just the browser. This is awesome.
Retr0spectrumover 8 years ago
This begs the question, which codec is optimal in terms of &quot;cpu-cycles-to-decode per second&quot; for a given image quality ( for some subjective measure of quality)?
评论 #13554313 未加载
评论 #13555731 未加载
评论 #13552857 未加载
评论 #13553312 未加载
colek42over 8 years ago
You can actually do this with H264 as well. I did it for a hack-a-thon a couple months back. We are actually looking at doing this in production for a video streaming on an internal network now that NPAPI is deprecated.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;colek42&#x2F;streamingDemo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;colek42&#x2F;streamingDemo</a>
评论 #13557386 未加载
tambourine_manover 8 years ago
<i>A stack that you can understand from top to bottom.</i><p>Love it
faljseover 8 years ago
Awesome work. I´m using it for an e-learning&#x2F;robotics platform for low latency live streaming where it does a great job.<p>I´d like to know how reverse playback could be achieved. Is there a way to &quot;undo&quot; a P-Frame calculation, or is a second (reverse) mpeg file a possible solution?
markwillis82over 8 years ago
I used JSMPEG to process a live 360 camera feed and then a canvas to convert the output to the format to work with a google cardboard.<p>I was pleasantly surprised with the quality of the output and speed of which the devices could decode and render the new output.
edwinyzhover 8 years ago
What does &quot;Decode It Like It&#x27;s 1999&quot; mean? Thanks.
评论 #13553109 未加载
评论 #13553125 未加载
评论 #13556774 未加载
brian_hermanover 8 years ago
sounds like the internet archive would love something like this.
评论 #13551943 未加载
ilurkedhereover 8 years ago
How power efficient is this? Just curious because iOS was mentioned as a target.
评论 #13556257 未加载
z3t4over 8 years ago
Imagine all cool stuff you can build with this. And it&#x27;s JavaScript!!!
adrianNover 8 years ago
This stutters a bit on my 2009 Macbook. If I weren&#x27;t plugged in it&#x27;d probably kill my battery really fast.<p>It&#x27;s a nice hack to get this kind of video on the iPhone, but somehow I feel that for decoding video JS is a bit high on the stack.
streamer45over 8 years ago
main problem I see are bandwidth requirements to keep a decent quality. That said, very interesting project and well executed.