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": [
    "https://www.w3.org/ns/activitystreams#Public",
    "http://mastodon/users/hippo"
  ],
  "id": "http://pasture-one-actor/actor/XxL11iOpexo",
  "published": "2025-04-11T08:09:47Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://mastodon/users/hippo"
    ],
    "id": "http://pasture-one-actor/actor/qs1qTIZFtGU",
    "published": "2025-04-11T08:09:47Z",
    "@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
      }
    ]
  }
}
mastodon
{
  "id": "114318310604944525",
  "created_at": "2025-04-11T08:09:47.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/qs1qTIZFtGU",
  "url": "http://pasture-one-actor/actor/qs1qTIZFtGU",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "content": "Recommended Image Format",
  "filtered": [],
  "reblog": null,
  "account": {
    "id": "114318308993722163",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": false,
    "bot": false,
    "discoverable": false,
    "indexable": false,
    "group": false,
    "created_at": "2025-04-11T00:00:00.000Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "uri": "http://pasture-one-actor/actor",
    "avatar": "http://mastodon/avatars/original/missing.png",
    "avatar_static": "http://mastodon/avatars/original/missing.png",
    "header": "http://mastodon/headers/original/missing.png",
    "header_static": "http://mastodon/headers/original/missing.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 24,
    "last_status_at": "2025-04-11",
    "hide_collections": true,
    "emojis": [],
    "fields": []
  },
  "media_attachments": [
    {
      "id": "114318310597337884",
      "type": "image",
      "url": "http://localhost:2970/system/cache/media_attachments/files/114/318/310/597/337/884/original/9fb929633ed80ce1.jpg",
      "preview_url": "http://localhost:2970/system/cache/media_attachments/files/114/318/310/597/337/884/small/9fb929633ed80ce1.jpg",
      "remote_url": "http://pasture-one-actor/assets/cow.jpg",
      "preview_remote_url": null,
      "text_url": null,
      "meta": {
        "original": {
          "width": 200,
          "height": 164,
          "size": "200x164",
          "aspect": 1.2195121951219512
        },
        "small": {
          "width": 200,
          "height": 164,
          "size": "200x164",
          "aspect": 1.2195121951219512
        }
      },
      "description": "A beautiful cow",
      "blurhash": "UjL4Z_Di_3s._4%gNHRkyEWBMxt7kDV@aJbH"
    }
  ],
  "mentions": [],
  "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": [
    "https://www.w3.org/ns/activitystreams#Public",
    "http://mastodon/users/hippo"
  ],
  "id": "http://pasture-one-actor/actor/LM07aPD3w4o",
  "published": "2025-04-11T08:09:48Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://mastodon/users/hippo"
    ],
    "id": "http://pasture-one-actor/actor/IOTMUQGWuD4",
    "published": "2025-04-11T08:09:48Z",
    "@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"
      }
    ]
  }
}
mastodon
{
  "id": "114318310687197120",
  "created_at": "2025-04-11T08:09:48.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/IOTMUQGWuD4",
  "url": "http://pasture-one-actor/actor/IOTMUQGWuD4",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "content": "Recommended Video Attachment",
  "filtered": [],
  "reblog": null,
  "account": {
    "id": "114318308993722163",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": false,
    "bot": false,
    "discoverable": false,
    "indexable": false,
    "group": false,
    "created_at": "2025-04-11T00:00:00.000Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "uri": "http://pasture-one-actor/actor",
    "avatar": "http://mastodon/avatars/original/missing.png",
    "avatar_static": "http://mastodon/avatars/original/missing.png",
    "header": "http://mastodon/headers/original/missing.png",
    "header_static": "http://mastodon/headers/original/missing.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 25,
    "last_status_at": "2025-04-11",
    "hide_collections": true,
    "emojis": [],
    "fields": []
  },
  "media_attachments": [
    {
      "id": "114318310659700623",
      "type": "gifv",
      "url": "http://localhost:2970/system/cache/media_attachments/files/114/318/310/659/700/623/original/aaa1b6b3eb1bcaf7.mp4",
      "preview_url": "http://localhost:2970/system/cache/media_attachments/files/114/318/310/659/700/623/small/aaa1b6b3eb1bcaf7.png",
      "remote_url": "http://pasture-one-actor/assets/cow_eating.mp4",
      "preview_remote_url": null,
      "text_url": null,
      "meta": {
        "original": {
          "width": 256,
          "height": 144,
          "frame_rate": "25/1",
          "duration": 3.0,
          "bitrate": 144994
        },
        "small": {
          "width": 256,
          "height": 144,
          "size": "256x144",
          "aspect": 1.7777777777777777
        }
      },
      "description": "A beautiful cow eating",
      "blurhash": "UTEMdgveNaXU-trVWCOFKRNFnPWCKPNdn#xE"
    }
  ],
  "mentions": [],
  "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": [
    "https://www.w3.org/ns/activitystreams#Public",
    "http://mastodon/users/hippo"
  ],
  "id": "http://pasture-one-actor/actor/CEkYYyopmdg",
  "published": "2025-04-11T08:09:49Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://mastodon/users/hippo"
    ],
    "id": "http://pasture-one-actor/actor/9AvFY1v_TlI",
    "published": "2025-04-11T08:09:49Z",
    "@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"
      }
    ]
  }
}
mastodon
{
  "id": "114318310754383517",
  "created_at": "2025-04-11T08:09:49.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/9AvFY1v_TlI",
  "url": "http://pasture-one-actor/actor/9AvFY1v_TlI",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "content": "Recommended Audio Format",
  "filtered": [],
  "reblog": null,
  "account": {
    "id": "114318308993722163",
    "username": "actor",
    "acct": "actor@pasture-one-actor",
    "display_name": "Test Actor",
    "locked": false,
    "bot": false,
    "discoverable": false,
    "indexable": false,
    "group": false,
    "created_at": "2025-04-11T00:00:00.000Z",
    "note": "",
    "url": "http://pasture-one-actor/actor",
    "uri": "http://pasture-one-actor/actor",
    "avatar": "http://mastodon/avatars/original/missing.png",
    "avatar_static": "http://mastodon/avatars/original/missing.png",
    "header": "http://mastodon/headers/original/missing.png",
    "header_static": "http://mastodon/headers/original/missing.png",
    "followers_count": 0,
    "following_count": 0,
    "statuses_count": 26,
    "last_status_at": "2025-04-11",
    "hide_collections": true,
    "emojis": [],
    "fields": []
  },
  "media_attachments": [
    {
      "id": "114318310742819462",
      "type": "audio",
      "url": "http://localhost:2970/system/cache/media_attachments/files/114/318/310/742/819/462/original/d92408eae9633615.mp3",
      "preview_url": null,
      "remote_url": "http://pasture-one-actor/assets/cow_moo.mp3",
      "preview_remote_url": null,
      "text_url": null,
      "meta": {
        "original": {
          "duration": 2.142041,
          "bitrate": 131018
        }
      },
      "description": "A cow mooing",
      "blurhash": null
    }
  ],
  "mentions": [],
  "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": [
    "https://www.w3.org/ns/activitystreams#Public",
    "http://mastodon/users/hippo"
  ],
  "id": "http://pasture-one-actor/actor/B8zEA6BJJnc",
  "published": "2025-04-11T08:09:50Z",
  "object": {
    "type": "Note",
    "attributedTo": "http://pasture-one-actor/actor",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public",
      "http://mastodon/users/hippo"
    ],
    "id": "http://pasture-one-actor/actor/ig3_M-FUvkg",
    "published": "2025-04-11T08:09:50Z",
    "@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"
      }
    ]
  }
}

no result