Skip to content

Commit 1cda2dc

Browse files
authored
Merge pull request #1261 from nostr-protocol/nip71-imeta
NIP-71: `imeta`
2 parents e381b57 + 1e2f198 commit 1cda2dc

File tree

2 files changed

+71
-59
lines changed

2 files changed

+71
-59
lines changed

71.md

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,60 @@ The format uses an _addressable event_ kind `34235` for horizontal videos and `3
2020

2121
The `.content` of these events is a summary or description on the video content.
2222

23-
The list of tags are as follows:
24-
* `d` (required) universally unique identifier (UUID). Generated by the client creating the video event.
25-
* `url` (required) the url to the video file
26-
* `m` a string indicating the data type of the file. The [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) format must be used, and they should be lowercase.
23+
The primary source of video information is the `imeta` tags which is defined in [NIP-92](92.md)
24+
25+
Each `imeta` tag can be used to specify a variant of the video by the `dim` & `m` properties.
26+
27+
Example:
28+
```json
29+
[
30+
["imeta",
31+
"dim 1920x1080",
32+
"url https://myvideo.com/1080/12345.mp4",
33+
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
34+
"m video/mp4",
35+
"image https://myvideo.com/1080/12345.jpg",
36+
"image https://myotherserver.com/1080/12345.jpg",
37+
"fallback https://myotherserver.com/1080/12345.mp4",
38+
"fallback https://andanotherserver.com/1080/12345.mp4",
39+
"service nip96",
40+
],
41+
["imeta",
42+
"dim 1280x720",
43+
"url https://myvideo.com/720/12345.mp4",
44+
"x e1d4f808dae475ed32fb23ce52ef8ac82e3cc760702fca10d62d382d2da3697d",
45+
"m video/mp4",
46+
"image https://myvideo.com/720/12345.jpg",
47+
"image https://myotherserver.com/720/12345.jpg",
48+
"fallback https://myotherserver.com/720/12345.mp4",
49+
"fallback https://andanotherserver.com/720/12345.mp4",
50+
"service nip96",
51+
],
52+
["imeta",
53+
"dim 1280x720",
54+
"url https://myvideo.com/720/12345.m3u8",
55+
"x 704e720af2697f5d6a198ad377789d462054b6e8d790f8a3903afbc1e044014f",
56+
"m application/x-mpegURL",
57+
"image https://myvideo.com/720/12345.jpg",
58+
"image https://myotherserver.com/720/12345.jpg",
59+
"fallback https://myotherserver.com/720/12345.m3u8",
60+
"fallback https://andanotherserver.com/720/12345.m3u8",
61+
"service nip96",
62+
],
63+
]
64+
```
65+
66+
Where `url` is the primary server url and `fallback` are other servers hosting the same file, both `url` and `fallback` should be weighted equally and clients are recommended to use any of the provided video urls.
67+
68+
The `image` tag contains a preview image (at the same resolution). Multiple `image` tags may be used to specify fallback copies in the same way `fallback` is used for `url`.
69+
70+
Additionally `service nip96` may be included to allow clients to search the authors NIP-96 server list to find the file using the hash.
71+
72+
### Other tags:
2773
* `title` (required) title of the video
28-
* `"published_at"`, for the timestamp in unix seconds (stringified) of the first time the video was published
29-
* `x` containing the SHA-256 hexencoded string of the file.
30-
* `size` (optional) size of file in bytes
31-
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
74+
* `published_at`, for the timestamp in unix seconds (stringified) of the first time the video was published
3275
* `duration` (optional) video duration in seconds
33-
* `magnet` (optional) URI to magnet file
34-
* `i` (optional) torrent infohash
3576
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
36-
* `thumb` (optional) url of thumbnail with same aspect ratio
37-
* `image` (optional) url of preview image with same dimensions
3877
* `content-warning` (optional) warning about content of NSFW video
3978
* `alt` (optional) description for accessibility
4079
* `segment` (optional, repeated) start timestamp in format `HH:MM:SS.sss`, end timestamp in format `HH:MM:SS.sss`, chapter/segment title, chapter thumbnail-url
@@ -53,19 +92,23 @@ The list of tags are as follows:
5392
["d", "<UUID>"],
5493

5594
["title", "<title of video>"],
56-
["thumb", "<thumbnail image for video>"],
5795
["published_at", "<unix timestamp>"],
5896
["alt", <description>],
5997

6098
// Video Data
61-
["url",<string with URI of file>],
62-
["m", <MIME type>],
63-
["x",<Hash SHA-256>],
64-
["size", <size of file in bytes>],
99+
["imeta",
100+
"dim 1920x1080",
101+
"url https://myvideo.com/1080/12345.mp4",
102+
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
103+
"m video/mp4",
104+
"image https://myvideo.com/1080/12345.jpg",
105+
"image https://myotherserver.com/1080/12345.jpg",
106+
"fallback https://myotherserver.com/1080/12345.mp4",
107+
"fallback https://andanotherserver.com/1080/12345.mp4",
108+
"service nip96",
109+
],
110+
65111
["duration", <duration of video in seconds>],
66-
["dim", <size of file in pixels>],
67-
["magnet",<magnet URI> ],
68-
["i",<torrent infohash>],
69112
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
70113
["content-warning", "<reason>"],
71114
["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
@@ -83,36 +126,4 @@ The list of tags are as follows:
83126
["r", "<url>"]
84127
]
85128
}
86-
```
87-
88-
## Video View
89-
90-
A video event view is a response to a video event to track a user's view or progress viewing the video.
91-
92-
### Format
93-
94-
The format uses an _addressable event_ kind `34237`.
95-
96-
The `.content` of these events is optional and could be a free-form note that acts like a bookmark for the user.
97-
98-
The list of tags are as follows:
99-
* `a` (required) reference tag to kind `34235` or `34236` video event being viewed
100-
* `d` (required) same as `a` reference tag value
101-
* `viewed` (optional, repeated) timestamp of the user's start time in seconds, timestamp of the user's end time in seconds
102-
103-
104-
```json
105-
{
106-
"id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
107-
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
108-
"created_at": <Unix timestamp in seconds>,
109-
"kind": 34237,
110-
"content": "<note>",
111-
"tags": [
112-
["a", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>", "<optional relay url>"],
113-
["e", "<event-id", "<relay-url>"]
114-
["d", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>"],
115-
["viewed", <start>, <end>],
116-
]
117-
}
118-
```
129+
```

94.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
2626
* `summary` (optional) text excerpt
2727
* `alt` (optional) description for accessibility
2828
* `fallback` (optional) zero or more fallback file sources in case `url` fails
29+
* `service` (optional) service type which is serving the file (eg. [NIP-96](96.md))
2930

3031
```jsonc
3132
{
3233
"kind": 1063,
3334
"tags": [
3435
["url",<string with URI of file>],
3536
["m", <MIME type>],
36-
["x",<Hash SHA-256>],
37-
["ox",<Hash SHA-256>],
37+
["x", <Hash SHA-256>],
38+
["ox", <Hash SHA-256>],
3839
["size", <size of file in bytes>],
3940
["dim", <size of file in pixels>],
40-
["magnet",<magnet URI> ],
41-
["i",<torrent infohash>],
41+
["magnet", <magnet URI> ],
42+
["i", <torrent infohash>],
4243
["blurhash", <value>],
43-
["thumb", <string with thumbnail URI>],
44-
["image", <string with preview URI>],
44+
["thumb", <string with thumbnail URI>, <Hash SHA-256>],
45+
["image", <string with preview URI>, <Hash SHA-256>],
4546
["summary", <excerpt>],
4647
["alt", <description>]
4748
],

0 commit comments

Comments
 (0)