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

Examples

Example 1

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://gotosocial/users/cookie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/actor/zPgCHDsVM4w",
  "published": "2024-12-04T17:57:05Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://gotosocial/users/cookie"
    ],
    "id": "http://pasture-one-actor/actor/IGVCLinlYg0",
    "published": "2024-12-04T17:57:05Z",
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "content": "Recommended Image Format",
    "attachment": [
      {
        "type": "Image",
        "name": "A beautiful cow",
        "url": "http://pasture-one-actor/assets/cow.jpg",
        "width": 100,
        "height": 162,
        "mediaType": "image/jpeg",
        "digestMultibase": "zQmaeDPzhNL32WQZnnzB1H6QJWvvFNEHdViDB71yrxyXU1t",
        "size": 9045
      }
    ],
    "tag": [
      {
        "type": "Mention",
        "href": "http://gotosocial/users/cookie"
      }
    ]
  }
}
gotosocial
{
  "id": "01JE9D31B81WY685QGC9NHCKRF",
  "created_at": "2024-12-04T17:57:05.000Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": null,
  "uri": "http://pasture-one-actor/actor/IGVCLinlYg0",
  "url": "http://pasture-one-actor/actor/IGVCLinlYg0",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "content": "Recommended Image Format",
  "reblog": null,
  "account": {
    "id": "01JE9D28EG7DDB9G7JGPT4RQWR",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": true,
    "discoverable": false,
    "bot": false,
    "created_at": "2024-12-04T17:56:39.515Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "avatar": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "avatar_static": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "header": "http://gotosocial/assets/default_header.png",
    "header_static": "http://gotosocial/assets/default_header.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 23,
    "last_status_at": "2024-12-04T17:57:05.000Z",
    "emojis": [],
    "fields": []
  },
  "media_attachments": [
    {
      "id": "01JE9D31FJ0S6EZR51V0MPSCBQ",
      "type": "image",
      "url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/original/01JE9D31FJ0S6EZR51V0MPSCBQ.jpg",
      "text_url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/original/01JE9D31FJ0S6EZR51V0MPSCBQ.jpg",
      "preview_url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/small/01JE9D31FJ0S6EZR51V0MPSCBQ.jpg",
      "remote_url": "http://pasture-one-actor/assets/cow.jpg",
      "preview_remote_url": null,
      "meta": {
        "original": {
          "width": 200,
          "height": 164,
          "size": "200x164",
          "aspect": 1.2195122
        },
        "small": {
          "width": 200,
          "height": 164,
          "size": "200x164",
          "aspect": 1.2195122
        },
        "focus": {
          "x": 0,
          "y": 0
        }
      },
      "description": "A beautiful cow",
      "blurhash": "LnL4d3I9?cxt_4%NR+WB%ha}Mxt7"
    }
  ],
  "mentions": [
    {
      "id": "01GDD6QXCF4BJZT90ZTC9GXNJG",
      "username": "cookie",
      "url": "http://gotosocial/@cookie",
      "acct": "cookie"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}

Example 2

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://gotosocial/users/cookie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/actor/2Zninjy7SQo",
  "published": "2024-12-04T17:57:05Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://gotosocial/users/cookie"
    ],
    "id": "http://pasture-one-actor/actor/Cfo3rVMIyag",
    "published": "2024-12-04T17:57:05Z",
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "content": "Recommended Video Attachment",
    "attachment": [
      {
        "type": "Video",
        "url": "http://pasture-one-actor/assets/cow_eating.mp4",
        "name": "A beautiful cow eating",
        "width": 256,
        "height": 144,
        "mediaType": "video/mp4",
        "digestMultibase": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
        "size": 54373,
        "duration": "PT3S"
      }
    ],
    "tag": [
      {
        "type": "Mention",
        "href": "http://gotosocial/users/cookie"
      }
    ]
  }
}
gotosocial
{
  "id": "01JE9D31B811PFDCV6Z8CH0MD9",
  "created_at": "2024-12-04T17:57:05.000Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": null,
  "uri": "http://pasture-one-actor/actor/Cfo3rVMIyag",
  "url": "http://pasture-one-actor/actor/Cfo3rVMIyag",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "content": "Recommended Video Attachment",
  "reblog": null,
  "account": {
    "id": "01JE9D28EG7DDB9G7JGPT4RQWR",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": true,
    "discoverable": false,
    "bot": false,
    "created_at": "2024-12-04T17:56:39.515Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "avatar": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "avatar_static": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "header": "http://gotosocial/assets/default_header.png",
    "header_static": "http://gotosocial/assets/default_header.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 24,
    "last_status_at": "2024-12-04T17:57:05.000Z",
    "emojis": [],
    "fields": []
  },
  "media_attachments": [
    {
      "id": "01JE9D324VW05CSG6GZYZ54ZHW",
      "type": "video",
      "url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/original/01JE9D324VW05CSG6GZYZ54ZHW.mp4",
      "text_url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/original/01JE9D324VW05CSG6GZYZ54ZHW.mp4",
      "preview_url": "http://gotosocial/fileserver/01JE9D28EG7DDB9G7JGPT4RQWR/attachment/small/01JE9D324VW05CSG6GZYZ54ZHW.jpg",
      "remote_url": "http://pasture-one-actor/assets/cow_eating.mp4",
      "preview_remote_url": null,
      "meta": {
        "original": {
          "width": 256,
          "height": 144,
          "frame_rate": "25/1",
          "duration": 3,
          "bitrate": 140376
        },
        "small": {
          "width": 256,
          "height": 144,
          "size": "256x144",
          "aspect": 1.7777778
        }
      },
      "description": "A beautiful cow eating",
      "blurhash": "L00000fQfQfQfQfQfQfQfQfQfQfQ"
    }
  ],
  "mentions": [
    {
      "id": "01GDD6QXCF4BJZT90ZTC9GXNJG",
      "username": "cookie",
      "url": "http://gotosocial/@cookie",
      "acct": "cookie"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}

Example 3

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://gotosocial/users/cookie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/actor/kzpBalR6JyI",
  "published": "2024-12-04T17:57:06Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://gotosocial/users/cookie"
    ],
    "id": "http://pasture-one-actor/actor/QdM_FGCD-o4",
    "published": "2024-12-04T17:57:06Z",
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "content": "Recommended Audio Format",
    "attachment": [
      {
        "type": "Audio",
        "url": "http://pasture-one-actor/assets/cow_moo.mp3",
        "name": "A cow mooing",
        "mediaType": "audio/mpeg",
        "digestMultibase": "zQmSXTyLCPqoiGoUUwKRMKgFdddaAUkvQNr29nhB6tahb9Z",
        "size": 67709,
        "duration": "PT2.1S"
      }
    ],
    "tag": [
      {
        "type": "Mention",
        "href": "http://gotosocial/users/cookie"
      }
    ]
  }
}
gotosocial
{
  "id": "01JE9D32AGN2Z0B5A1THVE0SVX",
  "created_at": "2024-12-04T17:57:06.000Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": null,
  "uri": "http://pasture-one-actor/actor/QdM_FGCD-o4",
  "url": "http://pasture-one-actor/actor/QdM_FGCD-o4",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "content": "Recommended Audio Format<hr><p><i lang=\"en\">\u2139\ufe0f Note from gotosocial: 1 attachment in this status could not be downloaded. Treat the following external link with care:</i></p><ul><li><a href=\"http://pasture-one-actor/assets/cow_moo.mp3\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">cow_moo.mp3</a> [A cow mooing]</li></ul>",
  "reblog": null,
  "account": {
    "id": "01JE9D28EG7DDB9G7JGPT4RQWR",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": true,
    "discoverable": false,
    "bot": false,
    "created_at": "2024-12-04T17:56:39.515Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "avatar": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "avatar_static": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "header": "http://gotosocial/assets/default_header.png",
    "header_static": "http://gotosocial/assets/default_header.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 25,
    "last_status_at": "2024-12-04T17:57:06.000Z",
    "emojis": [],
    "fields": []
  },
  "media_attachments": [],
  "mentions": [
    {
      "id": "01GDD6QXCF4BJZT90ZTC9GXNJG",
      "username": "cookie",
      "url": "http://gotosocial/@cookie",
      "acct": "cookie"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}

Example 4

activity
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "Hashtag": "as:Hashtag",
      "sensitive": "as:sensitive"
    }
  ],
  "type": "Create",
  "actor": "http://pasture-one-actor/actor",
  "to": [
    "http://gotosocial/users/cookie",
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "id": "http://pasture-one-actor/actor/bt7aRT9FaQI",
  "published": "2024-12-04T17:57:07Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://gotosocial/users/cookie"
    ],
    "id": "http://pasture-one-actor/actor/TIcbRe5zskc",
    "published": "2024-12-04T17:57:07Z",
    "@context": [
      "https://www.w3.org/ns/activitystreams",
      "https://www.w3.org/ns/credentials/v2",
      {
        "size": "https://joinpeertube.org/ns#size"
      }
    ],
    "content": "Multiple formats for video",
    "attachment": [
      {
        "type": "Video",
        "name": "A beautiful cow eating",
        "url": [
          {
            "type": "Link",
            "size": 54373,
            "digest": "zQmSzK5qEe5tpjwGMhmjx9RvVoPkWhEmCwxP2s7wPMpKMoK",
            "width": 256,
            "height": 144,
            "href": "http://pasture-one-actor/assets/cow_eating.mp4",
            "mediaType": "video/mp4"
          },
          {
            "type": "Link",
            "size": 2271723,
            "digest": "zQme2X4rgWuRdmAtGGMSEbdoeRQ2NAL2VptcdRGTYDZbSKG",
            "width": 1920,
            "height": 1080,
            "href": "http://pasture-one-actor/assets/cow_eating_hd.mp4",
            "mediaType": "video/mp4"
          }
        ],
        "duration": "PT3S"
      }
    ],
    "tag": [
      {
        "type": "Mention",
        "href": "http://gotosocial/users/cookie"
      }
    ]
  }
}
gotosocial
{
  "id": "01JE9D339R8YW0SAECYFNMFC2M",
  "created_at": "2024-12-04T17:57:07.000Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": null,
  "uri": "http://pasture-one-actor/actor/TIcbRe5zskc",
  "url": "http://pasture-one-actor/actor/TIcbRe5zskc",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "content": "Multiple formats for video",
  "reblog": null,
  "account": {
    "id": "01JE9D28EG7DDB9G7JGPT4RQWR",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": true,
    "discoverable": false,
    "bot": false,
    "created_at": "2024-12-04T17:56:39.515Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "avatar": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "avatar_static": "http://gotosocial/assets/default_avatars/GoToSocial_icon2.png",
    "header": "http://gotosocial/assets/default_header.png",
    "header_static": "http://gotosocial/assets/default_header.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 26,
    "last_status_at": "2024-12-04T17:57:07.000Z",
    "emojis": [],
    "fields": []
  },
  "media_attachments": [],
  "mentions": [
    {
      "id": "01GDD6QXCF4BJZT90ZTC9GXNJG",
      "username": "cookie",
      "url": "http://gotosocial/@cookie",
      "acct": "cookie"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}