Skip to main content

PeerTube

PeerTube is a decentralized video hosting platform, similar to YouTube.

Overview

PropertyValue
LanguageTypeScript (Node.js)
DatabasePostgreSQL
LicenseAGPL-3.0
Repositorygithub.com/Chocobozzz/PeerTube
Documentationdocs.joinpeertube.org

ActivityPub Implementation

Actor Types

Person (User):

{
"type": "Person",
"id": "https://peertube.example/accounts/alice",
"preferredUsername": "alice",
"name": "Alice",
"inbox": "https://peertube.example/accounts/alice/inbox",
"outbox": "https://peertube.example/accounts/alice/outbox"
}

Group (Channel):

{
"type": "Group",
"id": "https://peertube.example/video-channels/tech_reviews",
"preferredUsername": "tech_reviews",
"name": "Tech Reviews",
"attributedTo": "https://peertube.example/accounts/alice",
"inbox": "https://peertube.example/video-channels/tech_reviews/inbox"
}

Video Object

{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{ "pt": "https://joinpeertube.org/ns#" }
],
"type": "Video",
"id": "https://peertube.example/videos/watch/abc123",
"name": "Introduction to ActivityPub",
"duration": "PT15M30S",
"published": "2024-01-15T10:00:00Z",
"attributedTo": "https://peertube.example/video-channels/tech_reviews",
"content": "<p>In this video we explore...</p>",
"mediaType": "text/html",
"url": [
{
"type": "Link",
"mediaType": "video/mp4",
"href": "https://peertube.example/static/videos/abc123.mp4",
"height": 1080,
"size": 150000000,
"fps": 30
},
{
"type": "Link",
"mediaType": "application/x-mpegURL",
"href": "https://peertube.example/static/streaming/abc123/master.m3u8"
}
],
"icon": [
{
"type": "Image",
"url": "https://peertube.example/static/thumbnails/abc123.jpg",
"width": 560,
"height": 315
}
],
"tag": [
{ "type": "Hashtag", "name": "#activitypub" }
],
"views": 1500,
"likes": "https://peertube.example/videos/watch/abc123/likes",
"dislikes": "https://peertube.example/videos/watch/abc123/dislikes",
"comments": "https://peertube.example/videos/watch/abc123/comments"
}

Comments

Video comments are Notes:

{
"type": "Note",
"id": "https://peertube.example/videos/watch/abc123/comments/456",
"inReplyTo": "https://peertube.example/videos/watch/abc123",
"attributedTo": "https://mastodon.social/users/bob",
"content": "<p>Great video!</p>"
}

Supported Activities

ActivityContextNotes
CreateVideo, NoteUpload, comment
UpdateVideoEdit metadata
DeleteVideo, NoteRemoval
LikeVideoUpvote
DislikeVideoDownvote
FollowPerson, GroupSubscribe
AnnounceVideoShare
ViewVideoView tracking

View Activity

PeerTube tracks views via ActivityPub:

{
"type": "View",
"actor": "https://peertube.example/accounts/alice",
"object": "https://peertube.example/videos/watch/abc123"
}

Custom Extensions

PeerTube uses its own namespace for video properties:

PropertyNamespaceDescription
pt:uuidPeerTubeUnique video ID
pt:categoryPeerTubeVideo category
pt:licencePeerTubeContent license
pt:languagePeerTubeVideo language
pt:downloadEnabledPeerTubeAllow downloads
pt:waitTranscodingPeerTubeTranscoding status

Video Streaming

PeerTube supports multiple formats:

{
"url": [
{
"type": "Link",
"mediaType": "video/mp4",
"href": "...",
"height": 1080
},
{
"type": "Link",
"mediaType": "video/mp4",
"href": "...",
"height": 720
},
{
"type": "Link",
"mediaType": "application/x-mpegURL",
"href": "..."
},
{
"type": "Link",
"mediaType": "application/x-bittorrent",
"href": "..."
}
]
}

Federation

With Mastodon

  • Videos appear as posts with video attachments
  • Comments federate as replies
  • Likes/dislikes become favorites

Channel Following

Users can follow PeerTube channels:

Actor (Mastodon) → Follow → Group (PeerTube Channel)

See Also