nip71 imeta

This commit is contained in:
kieran 2024-05-27 12:18:27 +01:00
parent 85df9b0e89
commit 53afaaece6
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
2 changed files with 71 additions and 59 deletions

117
71.md
View File

@ -20,21 +20,60 @@ The format uses a parameterized replaceable event kind `34235` for horizontal vi
The `.content` of these events is a summary or description on the video content.
The list of tags are as follows:
* `d` (required) universally unique identifier (UUID). Generated by the client creating the video event.
* `url` (required) the url to the video file
* `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.
The primary source of video information is the `imeta` tags which is defined in [NIP-92](92.md)
Each `imeta` tag can be used to specify a variant of the video by the `dim` & `m` properties.
Example:
```json
[
["imeta",
"dim 1920x1080",
"url https://myvideo.com/1080/12345.mp4",
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
"m video/mp4",
"image https://myvideo.com/1080/12345.jpg",
"image https://myotherserver.com/1080/12345.jpg",
"fallback https://myotherserver.com/1080/12345.mp4",
"fallback https://andanotherserver.com/1080/12345.mp4",
"service nip96",
],
["imeta",
"dim 1280x720",
"url https://myvideo.com/720/12345.mp4",
"x e1d4f808dae475ed32fb23ce52ef8ac82e3cc760702fca10d62d382d2da3697d",
"m video/mp4",
"image https://myvideo.com/720/12345.jpg",
"image https://myotherserver.com/720/12345.jpg",
"fallback https://myotherserver.com/720/12345.mp4",
"fallback https://andanotherserver.com/720/12345.mp4",
"service nip96",
],
["imeta",
"dim 1280x720",
"url https://myvideo.com/720/12345.m3u8",
"x 704e720af2697f5d6a198ad377789d462054b6e8d790f8a3903afbc1e044014f",
"m application/x-mpegURL",
"image https://myvideo.com/720/12345.jpg",
"image https://myotherserver.com/720/12345.jpg",
"fallback https://myotherserver.com/720/12345.m3u8",
"fallback https://andanotherserver.com/720/12345.m3u8",
"service nip96",
],
]
```
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.
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`.
Additionally `service nip96` may be included to allow clients to search the authors NIP-96 server list to find the file using the hash.
### Other tags:
* `title` (required) title of the video
* `"published_at"`, for the timestamp in unix seconds (stringified) of the first time the video was published
* `x` containing the SHA-256 hexencoded string of the file.
* `size` (optional) size of file in bytes
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
* `published_at`, for the timestamp in unix seconds (stringified) of the first time the video was published
* `duration` (optional) video duration in seconds
* `magnet` (optional) URI to magnet file
* `i` (optional) torrent infohash
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
* `thumb` (optional) url of thumbnail with same aspect ratio
* `image` (optional) url of preview image with same dimensions
* `content-warning` (optional) warning about content of NSFW video
* `alt` (optional) description for accessibility
* `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:
["d", "<UUID>"],
["title", "<title of video>"],
["thumb", "<thumbnail image for video>"],
["published_at", "<unix timestamp>"],
["alt", <description>],
// Video Data
["url",<string with URI of file>],
["m", <MIME type>],
["x",<Hash SHA-256>],
["size", <size of file in bytes>],
["imeta",
"dim 1920x1080",
"url https://myvideo.com/1080/12345.mp4",
"x 3093509d1e0bc604ff60cb9286f4cd7c781553bc8991937befaacfdc28ec5cdc",
"m video/mp4",
"image https://myvideo.com/1080/12345.jpg",
"image https://myotherserver.com/1080/12345.jpg",
"fallback https://myotherserver.com/1080/12345.mp4",
"fallback https://andanotherserver.com/1080/12345.mp4",
"service nip96",
],
["duration", <duration of video in seconds>],
["dim", <size of file in pixels>],
["magnet",<magnet URI> ],
["i",<torrent infohash>],
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
["content-warning", "<reason>"],
["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
@ -83,36 +126,4 @@ The list of tags are as follows:
["r", "<url>"]
]
}
```
## Video View
A video event view is a response to a video event to track a user's view or progress viewing the video.
### Format
The format uses a parameterized replaceable event kind `34237`.
The `.content` of these events is optional and could be a free-form note that acts like a bookmark for the user.
The list of tags are as follows:
* `a` (required) reference tag to kind `34235` or `34236` video event being viewed
* `d` (required) same as `a` reference tag value
* `viewed` (optional, repeated) timestamp of the user's start time in seconds, timestamp of the user's end time in seconds
```json
{
"id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
"created_at": <Unix timestamp in seconds>,
"kind": 34237,
"content": "<note>",
"tags": [
["a", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>", "<optional relay url>"],
["e", "<event-id", "<relay-url>"]
["d", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>"],
["viewed", <start>, <end>],
]
}
```
```

13
94.md
View File

@ -26,6 +26,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
* `summary` (optional) text excerpt
* `alt` (optional) description for accessibility
* `fallback` (optional) zero or more fallback file sources in case `url` fails
* `service` (optional) service type which is serving the file (eg. [NIP-96](96.md))
```json
{
@ -33,15 +34,15 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr
"tags": [
["url",<string with URI of file>],
["m", <MIME type>],
["x",<Hash SHA-256>],
["ox",<Hash SHA-256>],
["x", <Hash SHA-256>],
["ox", <Hash SHA-256>],
["size", <size of file in bytes>],
["dim", <size of file in pixels>],
["magnet",<magnet URI> ],
["i",<torrent infohash>],
["magnet", <magnet URI> ],
["i", <torrent infohash>],
["blurhash", <value>],
["thumb", <string with thumbnail URI>],
["image", <string with preview URI>],
["thumb", <string with thumbnail URI>, <Hash SHA-256>],
["image", <string with preview URI>, <Hash SHA-256>],
["summary", <excerpt>],
["alt", <description>]
],