Can you use webtorrent for distributed live video broadcasting
Asked Answered
U

1

12

I want to use p2p webrtc for live video streaming through webtorrent.

https://github.com/feross/webtorrent

It can apparently stream video but can it take as input webcams and other sources?

How would you do that?

Thanks.

Unsung answered 10/1, 2015 at 4:19 Comment(2)
I'd be very interested in the answer to this. I'm actually distributing a stream of JSON blobs but it has two things in common with streaming a webcam: 1) For high efficiency the chunk sizes should be variable. 2) The stream is endless. For (2) I might try giving a named pipe as the input file and tell webtorrent that the file length is 1<<64. That doesn't deal with (1). ieeexplore.ieee.org/xpl/…Celestyn
It also doesn't deal with the fact that new people joining the torrent aren't interested in old data.Celestyn
R
11

Torrents are immutable, meaning that they can't change over time. You can built live streaming on top of torrents, though. You just need to pick a time interval (say 15 seconds), and create a torrent for each interval. The broadcaster should publish the .torrent files, or at least the magnet links to a central server somewhere that the clients can keep checking to get the latest content.

See https://github.com/feross/webtorrent/issues/448#issuecomment-159147568 for some discussion about how this might work.

As the creator of WebTorrent, I will say this. Live video streaming is out-of-scope for WebTorrent and should be built as a separate package on top of WebTorrent.

Ryals answered 24/12, 2015 at 6:45 Comment(3)
And then how could we merge files/chunks on the fly? I'm not sure where to look atCraggy
You're going to need to use the MediaSource API for streaming into the video tag, so you'll need to manually merge the video chunks.Ryals
Any plan for doing so?Colorless

© 2022 - 2024 — McMap. All rights reserved.