Skip to content

Recommended Media Attachment Format

The first three example are our recommendation on how to format image, video, and audio media attachments. Further properties are possible, and might make it into this recommendation at one point. Examples:

  • Focal point and blurhash, see Mastodon
  • fps (frames per second) for videos

The final example cannot be recommended yet as it is not widely supported. However, it illustrates how one can provide multiple versions of the media attachments. A high quality and low quality video in this case. The low quality video is enough for most use cases, and is 40 times smaller.

Info

This recommendation is work in progress. A description of why these choices will hopefully appear as a FEP

Objects

Object 1

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "attachment": [
    {
      "digestMultibase": "zQmaeDPzhNL32WQZnnzB1H6QJWvvFNEHdViDB71yrxyXU1t",
      "height": 162,
      "mediaType": "image/jpeg",
      "name": "A beautiful cow",
      "size": 9045,
      "type": "Image",
      "url": "http://pasture-one-actor/assets/cow.jpg",
      "width": 100
    }
  ],
  "attributedTo": "http://actor.example",
  "content": "Recommended Image Format",
  "id": "http://actor.example/CM_iD_PPD0Y",
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public"
  ],
  "type": "Note"
}

Object 2

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "attachment": [
    {
      "digestMultibase": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
      "duration": "PT3S",
      "height": 144,
      "mediaType": "video/mp4",
      "name": "A beautiful cow eating",
      "size": 54373,
      "type": "Video",
      "url": "http://pasture-one-actor/assets/cow_eating.mp4",
      "width": 256
    }
  ],
  "attributedTo": "http://actor.example",
  "content": "Recommended Video Attachment",
  "id": "http://actor.example/CkZsAPSd1l0",
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public"
  ],
  "type": "Note"
}

Object 3

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "attachment": [
    {
      "digestMultibase": "zQmSXTyLCPqoiGoUUwKRMKgFdddaAUkvQNr29nhB6tahb9Z",
      "duration": "PT2.1S",
      "mediaType": "audio/mpeg",
      "name": "A cow mooing",
      "size": 67709,
      "type": "Audio",
      "url": "http://pasture-one-actor/assets/cow_moo.mp3"
    }
  ],
  "attributedTo": "http://actor.example",
  "content": "Recommended Audio Format",
  "id": "http://actor.example/EJI8bxxsXVg",
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public"
  ],
  "type": "Note"
}

Object 4

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "attachment": [
    {
      "duration": "PT3S",
      "name": "A beautiful cow eating",
      "type": "Video",
      "url": [
        {
          "digest": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
          "height": 144,
          "href": "http://pasture-one-actor/assets/cow_eating.mp4",
          "mediaType": "video/mp4",
          "size": 54373,
          "type": "Link",
          "width": 256
        },
        {
          "digest": "zQme2X4rgWuRdmAtGGMSEbdoeRQ2NAL2VptcdRGTYDZbSKG",
          "height": 1080,
          "href": "http://pasture-one-actor/assets/cow_eating_hd.mp4",
          "mediaType": "video/mp4",
          "size": 2271723,
          "type": "Link",
          "width": 1920
        }
      ]
    }
  ],
  "attributedTo": "http://actor.example",
  "content": "Multiple formats for video",
  "id": "http://actor.example/y8zqVgXWrSo",
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public"
  ],
  "type": "Note"
}

Activities

Activity 1

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "actor": "http://actor.example",
  "id": "http://actor.example/CLOQrBUDQXg",
  "object": {
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "attachment": [
      {
        "digestMultibase": "zQmaeDPzhNL32WQZnnzB1H6QJWvvFNEHdViDB71yrxyXU1t",
        "height": 162,
        "mediaType": "image/jpeg",
        "name": "A beautiful cow",
        "size": 9045,
        "type": "Image",
        "url": "http://pasture-one-actor/assets/cow.jpg",
        "width": 100
      }
    ],
    "attributedTo": "http://actor.example",
    "content": "Recommended Image Format",
    "id": "http://actor.example/95TEeiMDlXM",
    "published": "2025-01-13T19:51:01Z",
    "to": [
      "as:Public",
      "http://remote.example/"
    ],
    "type": "Note"
  },
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public",
    "http://remote.example/"
  ],
  "type": "Create"
}

Activity 2

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "actor": "http://actor.example",
  "id": "http://actor.example/wvRN-M9QcN4",
  "object": {
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "attachment": [
      {
        "digestMultibase": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
        "duration": "PT3S",
        "height": 144,
        "mediaType": "video/mp4",
        "name": "A beautiful cow eating",
        "size": 54373,
        "type": "Video",
        "url": "http://pasture-one-actor/assets/cow_eating.mp4",
        "width": 256
      }
    ],
    "attributedTo": "http://actor.example",
    "content": "Recommended Video Attachment",
    "id": "http://actor.example/gDAJfCyn40U",
    "published": "2025-01-13T19:51:01Z",
    "to": [
      "as:Public",
      "http://remote.example/"
    ],
    "type": "Note"
  },
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public",
    "http://remote.example/"
  ],
  "type": "Create"
}

Activity 3

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "actor": "http://actor.example",
  "id": "http://actor.example/HXnjoCi_Wt4",
  "object": {
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "attachment": [
      {
        "digestMultibase": "zQmSXTyLCPqoiGoUUwKRMKgFdddaAUkvQNr29nhB6tahb9Z",
        "duration": "PT2.1S",
        "mediaType": "audio/mpeg",
        "name": "A cow mooing",
        "size": 67709,
        "type": "Audio",
        "url": "http://pasture-one-actor/assets/cow_moo.mp3"
      }
    ],
    "attributedTo": "http://actor.example",
    "content": "Recommended Audio Format",
    "id": "http://actor.example/gPSq6wMUchE",
    "published": "2025-01-13T19:51:01Z",
    "to": [
      "as:Public",
      "http://remote.example/"
    ],
    "type": "Note"
  },
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public",
    "http://remote.example/"
  ],
  "type": "Create"
}

Activity 4

{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "actor": "http://actor.example",
  "id": "http://actor.example/RpnF6B70cLU",
  "object": {
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "attachment": [
      {
        "duration": "PT3S",
        "name": "A beautiful cow eating",
        "type": "Video",
        "url": [
          {
            "digest": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
            "height": 144,
            "href": "http://pasture-one-actor/assets/cow_eating.mp4",
            "mediaType": "video/mp4",
            "size": 54373,
            "type": "Link",
            "width": 256
          },
          {
            "digest": "zQme2X4rgWuRdmAtGGMSEbdoeRQ2NAL2VptcdRGTYDZbSKG",
            "height": 1080,
            "href": "http://pasture-one-actor/assets/cow_eating_hd.mp4",
            "mediaType": "video/mp4",
            "size": 2271723,
            "type": "Link",
            "width": 1920
          }
        ]
      }
    ],
    "attributedTo": "http://actor.example",
    "content": "Multiple formats for video",
    "id": "http://actor.example/9fMMrnsX9Ow",
    "published": "2025-01-13T19:51:01Z",
    "to": [
      "as:Public",
      "http://remote.example/"
    ],
    "type": "Note"
  },
  "published": "2025-01-13T19:51:01Z",
  "to": [
    "as:Public",
    "http://remote.example/"
  ],
  "type": "Create"
}