Video & Music streaming

Can anyone provide some examples how to implement video live streaming via IPFS.
Simple example with webcam as a source and web browser with js-ipfs as a client would be very appreciated.

3 Likes

This is something that I’m actually working on and wanted to come here to make a post to see if there are any other devs that want to help build a live stream community platform on IPFS using libp2p. The project would be very similar to blab which no longer exists (example image below), but live stream users can set up their own room/channel and other users can easily call in to have multiple streams in the same room. Will also have chat for the rest of the users in the room. If anyone is interested let me know and I’ll link the repo once I’ve made some progress.

5 Likes

@joey-trucast this is awesome! and I love the sample videos. They’re hillarious.

I also think it’s time for someone to make a Vine clone on IPFS, now that Twitter have killed Vine.

3 Likes

I would love to see someone start working on building a live streaming video service on ipfs. Now that we have pubsub this can start to happen (though to get a really solid scalable service, we will need to improve our pubsub routing mechanisms)

@joey-trucast if you run into technical obstacles making live streaming work in the short term, a Vine clone might be a good first-pass, since it doesn’t require p2p live streaming and instead relies on passing around little video files that you can write onto IPFS.

2 Likes

I like the idea and have been wanting to do something similar, but I’m not sure if libp2p is ready for live streaming at this point - I think it be really cool to do a quick POC to check if its even feasible to live stream in its current state. I do like the idea of vine/youtube clone and been itching to work on something like that for a while and given the above concerns I think its much more feasible/safe. I think the biggest concern with video streaming and hosting is copyright violations, which is a interesting topic to tackle with a blockchains as well. Overall it would be a really cool project.

I agree. I’m not sure if IPFS is ready for live streams yet, but I’ll play around with it. I know livepeer is working on a decentralized media server that should work with IPFS, but I want to see if I can hack together a simple serverless app since it’s part of my long term goal anyways. Another part of my project is digital asset management which will be better suited for IPFS, but I’d like to build it all on the same platform if possible so we’ll see.

1 Like

Yep, serverless is what drove me to IPFS as well and it suits it nicely. My availability is quite limited at the moment but I’d love to help brainstorm and contribute in any way I can, if you have a repo please share it so we can start a more technical discussion there.

I’d also like to start talking about distribute web apps architecture on IPFS/libp2p in general, there are already several approaches that have been brought up, but so far I haven’t seen them being captured in one single place. I think capturing and further distilling them into howtos/guides would be tremendously helpful to get the community building more stuff on IPFS.

@flyingzumwalt is there a preferred place to hold such discussion?

@dryajov, that’s something I’m very interested in as well! I think this repository (https://github.com/ipfs/apps) is supposed to be that place, but there is not much activity there anymore.

Could be a good candidate for migrating that content over here as well, with a new category.

1 Like

Awesome pointer, thanks @VictorBjelkholm! I think that repo is indeed a good candidate to be migrated over here, I completely missed it until you pointed out. Discourse seems to have better discoverability features out of the box, so it should help others find those discussions.

This repo is also somewhat relevant - https://github.com/ipfs/in-web-browsers and I tried to start the conversation there at one point - https://github.com/ipfs/in-web-browsers/issues/51.

All i wanted is some basic example of how to stream a video from a single live (not pre-recorded) source like a webcam and share it to a very large number of viewers without need of having fiber optic internet connection :slight_smile:

1 Like

share it to a very large number of viewers without need of having fiber optic internet connection

That would be difficult but not impossible, maybe offering some server-side program that anyone can run and point to their channel, to help with scaling.

All i wanted is some basic example of how to stream a video from a single live (not pre-recorded) source like a webcam

To give you a concrete answer how to do live-video over IPFS, this is something you can try today but might not scale good enough. Have yet to test this, so let us know if something doesn’t work

startIPFSNode(() => {
  node.pubsub.subscribe('live', (msg) => {
    const hash = msg.data.toString()
    const data = ipfs.files.get(hash)
    renderToCanvas(element, data)
  })
  setInterval(() => {
    const imageData = canvas.getImageData()
    const hash = ipfs.files.add(imageData)
    ipfs.pubsub.publish(hash)
  }, 100)
})

This assumes that you have already grabbed the user media and render it to a hidden canvas or something like that. Take a look at Capture audio and video in HTML5  |  Articles  |  web.dev for more information.

The basic idea is to grab the image data of the current frame, add it to ipfs, send the hash over pubsub, receive it on the other end, fetch that file and then render that to another canvas element. In theory, this should work, although probably gonna be a bit slow.

But please, try it out and let us know if there something we can help with.

@dryajov Here’s a repo I set up https://github.com/TruCast/livestream-IPFS-poc.

I added a few files as a simple starting point that works locally on chrome using simple-peer and budo, but I’ll start testing with some of the libp2p libraries and the example code above to see what I can come up with.

2 Likes

Cool thanks! I’ll take. Look at it later, hopefully this weekend. It should be possible to build a quick poc with what @VictorBjelkholm outlined.

1 Like

Hi all, I’m wondering how this turned out. Were you able to set up a proof of concept?

I also would like to know what options for live video streaming we have at the moment with IPFS?

Here is a tiny proof of concept for webcam streaming between multiple peers. It’s inefficient since it sends the data directly to each peer, instead of sending a hash identifying the content then helping everyone pulling it down. But it works.

Repository: https://github.com/victorbjelkholm/resort
Demo: https://ipfs.io/ipfs/QmaK1BRzvYU7F2taQ5qAazKKDGqSgZ9vu2vSYyw1L852ws/

1 Like

I see, thank you.
Is there active development on this side of IPFS? Do you need help from a team of devs on that?
I might have few with spare time that can contribute.

However is there estimation of how hard/time consuming it would be to make it production ready?

I think d.tube is what you meant. May be.