Hacker News

10 hours ago by kdkeyser

This would be interesting to integrate into https://github.com/openmiko/openmiko which is a firmware for the T20 based ip-cameras.

Right now, I am not aware of any cheap ip camera that can stream its H264 video to a regular web browser, with sub 500 ms latency. All manufacturers seem to have moved to an app, I guess they can show an RTSP stream in that way.

Older ip cameras had MJPEG which you could view in the browser, but that is really inefficient w.r.t. bandwidth.

9 hours ago by tssva

The stock Wyze and Xiaomi firmware for their T20 based cameras both use WebRTC to stream the video to their apps.

9 hours ago by kdkeyser

Any background info/links to this? The Wyze forum comes up empty, only some discussions on WebRTC being complex to add.

14 hours ago by diericx

In complete sincerity, how is this better than ffmpeg


13 hours ago by Randor

It's certainly not better than FFmpeg. But I had a look through the source code and the author seems to have a fairly good grasp of WebRTC. The library looks really useful for anyone that wants to quickly understand WebRTC and how to use librtp and libsrtp. It's mostly a bare-bone wrapper around those libs.

12 hours ago by riedel

Maybe it would be a good starting point for someone integrating it into ffmpeg

12 hours ago by Randor

Yep, it looks easy to replace the function h264_get_next_frame(). I think you could get really decent performance if you used ffmpeg to pre-extract all of the frames into sequential files and serve them statically.

13 hours ago by bodegajed

WebRTC with STUN is pure p2p where ffmpeg it requires a rtmp or rtsp server

8 hours ago by sublimefire

Just for completeness sake this is what docs [1] state:

"For most WebRTC applications to function a server is required for relaying the traffic between peers, since a direct socket is often not possible between the clients (unless they reside on the same local network). <...>"

[1] https://webrtc.org/getting-started/turn-server

5 hours ago by Sean-Der

It’s a little more nuanced than this.

https://medium.com/the-making-of-whereby/what-kind-of-turn-s... fippo pulled the stats and saw 17%

This also depends on your clients network. You can determine your NAT mapping type[0] and now ahead of time if you need a TURN server.

To understand NAT behaviors more check out [1]

[0] https://github.com/pion/stun/tree/master/cmd/stun-nat-behavi...

[1] https://webrtcforthecurious.com/docs/03-connecting/#nat-mapp...

4 hours ago by tinus_hn

Careful! P2P streaming video is a (completely non obvious, according to the courts) infringement of the VirNetX patent that for example Apple just had to pay a few billions of dollars for.

If you implement p2p video streaming chances are no company will want to touch it with a ten foot pole.

13 hours ago by jcelerier

... how is STUN pure p2p ? you still need to have a STUN server somewhere no ?

13 hours ago by j1elo

STUN is just for punching holes in your NAT router, and also discovering what is your public IP address. Both things will be needed for the other peer to know where to reach you. And the other way around.

Once this NAT thing has been done by both parts, and the actual communication has started directly P2P, STUN is not needed any more.

10 hours ago by fulafel

Your p2p nodes might not be behind NAT. In a lot of populations you can rely on everyone having working v6 for example.

I think the question of what's "pure" p2p is somewhat academic. If your app uses DNS, is it p2p, isn't DNS just a distributed p2p database? Does p2p require that every aspect of your app right down to discovery is distributed among nodes running your app? Is it cheating to use an existing DHT? etc.

13 hours ago by bodegajed

You can just use google stun servers they are free to use

13 hours ago by diericx

Ahh I see

9 hours ago by undefined


12 hours ago by defied

If you're using ffmpeg with rtp, you can use Pion to make it a WebRTC stream: https://github.com/pion/webrtc/tree/master/examples/rtp-to-w...

14 hours ago by crakenzak

I'm not very familiar with WebRTC & how the browser pulls video usually, in what way is this better?

Also, what benefits does WebRTC give over other protocols?

13 hours ago by rapsey

WebRTC is generally for video conferencing as that requires real time communication.

Live streams or videos on the web are most commonly hls or dash protocols. Just mp4 file play while download also works.

Hls/dash are not built for lower latencies. They are built for easy CDN distribution and flexible switching between different resolutions and bitrates. Live streams generally are at least a few seconds behind.

5 hours ago by Sean-Der

If you have the time give WebRTC for the Curious[0] a read. I try and explain what WebRTC is and how it actually works. The big advantages that I see are.

* Can do P2P (and Client/Server)

* Mandatory Encryption

* Handles codec/track negotation. You don't need to know ahead of time what is being sent.

* Data channels. Can also be configured to be lossy/unordered for kind of performance needed for gaming.

* Uses existing protocols. Really easy to bridge with SIP/RTSP. This software/hardware goes all the way back to the late 90s

* Multiple implementations and available in the browser. No other protocol comes close in availability.

[0] https://webrtcforthecurious.com/docs/01-what-why-and-how/

3 hours ago by pratio

Excellent website btw, thank you.

6 hours ago by zip1234

My understanding: Most IP cameras only have an RTSP stream, which would need to be proxied expensively by some server if you want to view it over the internet or be exposed directly to the internet. WebRTC would allow the server to help negotiate a connection directly from client to camera, thereby bypassing having to host expensive proxy.

14 hours ago by ianlevesque

People mostly do this for lower latency.

12 hours ago by chin123

I've seen a few WebRTC server implementations pop up recently but the only clients I have seen are web browsers. Does anyone know of any WebRTC client implementations apart from the browser? Or am I misunderstanding the WebRTC architecture completely?

2 hours ago by EGreg

What about Node.js clients??

To record meetings without sacrificing end to end encryption

11 hours ago by kingosticks

6 hours ago by the_only_law

I believe that clients are available for most native MobileMe platforms as well.



12 hours ago by ajb

At a low level, webrtc interoperates with VoIP. But because webrtc doesn't mandate a signalling protocol and VoIP uses SIP, generally you need a browser to run whatever proprietary signalling the site decided to implement in JS.

11 hours ago by superdisk

Matrix can also function as a signaling layer for WebRTC.

11 hours ago by SahAssar

Anything can function as the signaling layer since all you need is to exchange pieces of text. I think the point was that most sites choose to implement it using JS and browser API's like ajax, websocket or SSE.

13 hours ago by genericacct

Can you provide an example that streams from a v4l device?

12 hours ago by londons_explore

How the world has changed that running something on a raspberry pi counts as "embedded".

I was expecting this to be on some microcontroller...

2 hours ago by mywittyname

Admittedly, I'm no expert on this subject, but this code looks like it could run on an embedded device. I don't see any system calls, and it looks to rely mostly on the standard library. glib.h is used in dtls_transport, but I suspect you can replace the certificate mechanism with something else.

11 hours ago by the-dude

For how many years do you want to keep defining embedded as single core, no MMU with a relatively low clock?

And in the same vein : settopboxes are considered embedded. TiVo's are.

2 minutes ago by a1369209993

> For how many years do you want to keep defining embedded as single core, no MMU with a relatively low clock?

All of the years; all of them forever.

8 hours ago by tempodox

For how many years do you want to keep blurring the line between running on top of a cushy OS and running on bare metal with no OS at all?

8 hours ago by regularfry

"Embedded" is a property of how the box is deployed, not what's inside it. The lines are blurring because the word "embedded" has been overloaded with an interpretation it doesn't merit for too long. If you mean "bare metal", say "bare metal". Mind you, if you're going to argue "no OS at all" is part of the criteria, FreeRTOS and the like are banned, right?

6 hours ago by PragmaticPulp

Nothing has changed. Small Linux systems have been a staple of the embedded systems world for a long time.

6 hours ago by Redoubts

> How the world has changed...

Was this before of after the release of Windows XP Embedded?

8 hours ago by tediousdemise

The code contains things that make any modern C++ or Rust developer cringe: naked pointers, unsafe type casts, raw loops, using malloc/free to manually allocate memory for buffers, and calls to unsafe free functions like strcat. So much slow boilerplate is required to do things like handling memory allocation. The increased source code size for even the simplest things becomes harder to maintain.

Danger is waiting around every corner for you to commit a buffer overflow or type confusion error after a long day of work. Infinite chances are offered for you to leak memory. The alternative is that you could be using a language that uses highly optimized RAII types on the stack which are impossible to leak, and written by some of the best programmers in the world so you don’t have to juggle chainsaws.

C invites disaster through seemingly normal use of the language. Just embrace modernity; your code will be smaller, more expressive, more performant, and you’ll be grateful.

7 hours ago by throwaway8581

You literally go from thread to thread posting the same pro-Rust anti-C drivel, derailing every thread.

Sorry to be crude, but can you people take this self-righteous bs elsewhere? Not every thread needs to be about the superiority of Rust or your gripes with C.

This cancer is ruining every thread on HN now.

4 hours ago by lucb1e

Let's not call genuine opinions 'cancer' please. If this were some viagra spam bot, then maybe though it would still not be constructive, but let's keep in mind there's a human on the other end of the line.

7 hours ago by tediousdemise

As far as I can tell, this is an open forum. If people keep repeating the same mistakes when they use C, I’ll keep promoting the alternatives.

I’m not trying to eschew flamebait, it just so happens that people get upset when their ideas are challenged. If it makes people uncomfortable, then that’s fantastic, because no one who was comfortable ever learned anything.

I get it: learning new things and new languages is hard. But like I said before, it will pay dividends, and save time for the people in the future who come hunting down your bugs.

6 hours ago by galenlynch

It seems you think their mistake was using C in the first place, and not the way they used C.

Calling people out for not using a language that you prefer is not helping them learn, nor is it bitter medicine to those who find learning your preferred language "hard".

7 hours ago by userbinator

Perhaps you'd like to point out an actual bug you've found...?

This sort of dogmatic cargo-culting paranoia-rant is exactly why people are getting sick of hearing about the "modern" BS.

7 hours ago by villasv

The modern C++ techniques being referred are 10 years old at this point already and have stayed in consensus. No need to get salty.

7 hours ago by tediousdemise

I already have to debug C/legacy C++ code (“C with classes”) on a daily basis for my day job, so I sure certainly am not going to waste my free time doing it. The best I can do is be an evangelist for better practices, a fly on the ass of people who still pump C into the garbage stream of the internet.

7 hours ago by scoutt

Since the text in your parent post is more or less the same of your last comment from 10 hours ago, I agree you are in a sort of "keyword oriented" evangelization crusade against good'ol C. The question would be, why caring so much?

Hey, as long as people keeps writing C and C with classes, you'll have a day job.

6 hours ago by higerordermap

> Be me

> Rewrite h.264 in rust

> Depends on swap_bits crate by Wladimir Jinping Jr.

> NIH hacked by unknown people

> NYT title next day "Cargo cult package manager behind NIH hack"

6 hours ago by tediousdemise

Very true. This is why I appreciate C++’s lack of a universal package manager.

8 hours ago by slezyr

> The alternative is that you could be using a language that uses highly optimized RAII types on the stack which are impossible to leak, and written by some of the best programmers in the world so you don’t have to juggle chainsaws.

Please, tell "the best programmers" that it's "impossible to leak" memory. Apparently they do not know this.


8 hours ago by tediousdemise

Thanks for sharing, I’m unfamiliar with the nuances of Rust’s implementation of RAII as I’m primarily a modern C++ developer. Modern C++ mostly guarantees against leaks since it encourages the stack as much possible.


7 hours ago by allo37

It's the same deal as creating a circular references using `std::shared_ptr` in C++.

8 hours ago by orf

Leak can mean different things. None of those types in the link are stack allocated, I think.

Daily digest email

Get a daily email with the the top stories from Hacker News. No spam, unsubscribe at any time.