Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.07k stars 1.5k forks source link

Support Owncast Streams #3522

Closed zcdunn closed 3 years ago

zcdunn commented 3 years ago

Allow viewing Owncast streams within Peertube and when the stream is complete save the video as a Peertube video.

I imagine this would require linking a Peertube account with an Owncastaccount. Validation of this relation ship could be handled by checking for a link in each account description or other metadata with a rel=me attribute pointing to the other account. Rel=me is how related accounts are handled in the IndieWeb and in Mastodon. (EDIT: Just found an issue on Owncast repo about supporting rel=me links too, https://github.com/owncast/owncast/issues/511)

This would be really useful for anyone who already has an Owncast account. It would enable them to easily get a VOD of their stream into the fediverse and a way for Peertube to get new viewers.

rigelk commented 3 years ago

What is Overcast? You are linking to owncast, for which https://github.com/owncast/owncast/issues/458 will help both platforms display each other's live streams.

I understand you want something a bit different: when an owncast steam ends, for it to be published as a PeerTube video. I'd argue this is more fitting as an owncast feature request too, since owncast would act as a PeerTube client to upload the video when it's own steam ends.

zcdunn commented 3 years ago

Overcast is unrelated. Sorry for the typo.

While the main focus was Owncast, I was hoping it would lead to a more general solution allowing any livestream to be displayed and saved in Peertube, regardless of ActivityPub support. I don't know much about the way the streaming works, but my understanding is that Peertube and Owncast use RTMP streams and these can be manipulated to enable rebroadcasting and saving. Building this on RTMP means it would support any software that also uses RTMP for streaming. Then any new services wouldn't have to explicitly build support for Peertube.

rigelk commented 3 years ago

In your scenario, a PeerTube instance would store Owncast streams based on a rel=me tag, but you don't adress how the page is discovered, nor how PeerTube accesses the RTMP stream made to the Owncast server or the Owncast-generated stream for lack of another source (but then it would be Owncast-specific and defeat the purpose). I know RTMP is like a swiss-army knife but it doesn't mean everything magically connects 🙂

An easier scenario is having OBS stream to multiple targets (Owncast and PeerTube) at the same time, via this plugin. Likely other RTMP clients should be able to do the same with some tuning.

Chocobozzz commented 3 years ago

Hello,

Thanks for this issue but it's out of the scope of PeerTube to inject remote player in the interface. ActivityPub should be the way to handle this use case. See also https://github.com/Chocobozzz/PeerTube/issues/3517 for the restream feature.

kontrollanten commented 2 years ago

I'd like to reopen this issue. What I ask for is to link a PeerTube account with an OwnCast account, that would mean that when a live is published at OwnCast it's published on PeerTube (but it streams directly from OwnCast) and the live chat is embedded (or just integrated by API). When the live ends it gets transcoded and published as a regular PT video.

Why?

OwnCast is streaming HLS and is a part of fediverse, which should help the integration a lot.

kontrollanten commented 2 years ago

I've looked further into this and think it can be doable with a PeerTube plugin without any huge changes in PeerTube.

Scenario with a plugin:

  1. User installs plugin and configures Owncast URL and API token
  2. User creates a live video at PeerTube and marks a checkbox (in the video update page) that the stream should be received from OwnCast
  3. The plugin registers an Owncast hook to listen for STREAM_STARTED (the hook needs to return the playlist URL, which it doesn't do today) and STREAM_STOPED.
  4. When STREAM_STARTED is triggered the following occurs:
    1. The video playlist URL is changed to the Owncast playlist URL
    2. Segment validator is disabled (consumeOnly = true and segmentsValidator to noop, via videojs options hook)
  5. When STREAM_STOPED is triggered the live ends.

But with this solution there's no replay available. I know that OwnCast works on the replay feature (https://github.com/owncast/owncast/issues/102), but then it has to be a way to import it into PeerTube. A solution can be to make the video-live-ending job to be able to be created with the REST API, and instead of passing replayDirectory we pass a replayUrl pointing to the master playlist of the playlist. This would also make it possible for remote workers to process the job.

Update: I manage to publish an Owncast live on PeerTube by creating a PT live, pointing the playlist URL to Owncast demo playlist and set the video to remote = true. Then I had to remove the checks in checkVideoFollowConstraints since my PT isn't following the Owncast instance.