11

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.

Wingman4l7
  • 649
  • 1
  • 8
  • 23
Harry
  • 52,711
  • 71
  • 177
  • 261
  • 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). http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=6467344&url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6451323%2F6466779%2F06467344.pdf%3Farnumber%3D6467344 – Max Murphy Nov 25 '15 at 18:55
  • It also doesn't deal with the fact that new people joining the torrent aren't interested in old data. – Max Murphy Nov 25 '15 at 18:56

1 Answers1

10

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.

Feross
  • 1,541
  • 14
  • 17