@mdgate/video 0.6.8 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +133 -6
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,17 +1,144 @@
1
1
  # @mdgate/video
2
2
 
3
- Convert MP4, MOV, WebM, Matroska, and AVI video to Markdown. Outputs GitHub-Flavored Markdown. Works
4
- in Node, Edge, and browsers. No native addons, no external dependencies.
3
+ **Convert video to Markdown in TypeScript.**
5
4
 
6
- Needs an `(input) => markdown` function `@mdgate/ai` or your own. The whole file is handed to that
7
- function. `all()` does not register `video()`.
5
+ [`@mdgate/video`](https://github.com/mdgate/converters/tree/main/packages/video) recognizes MP4, M4V, MOV, WebM, Matroska, and AVI, then hands the whole file to a callback you provide.
6
+
7
+ It does not ship a video model. `video()` is not registered by `all()`.
8
+
9
+ Works in **Node.js, Cloudflare Workers, Edge runtimes, and browsers**.
10
+
11
+ ```bash
12
+ npm install @mdgate/video
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Why [`@mdgate/video`](https://github.com/mdgate/converters/tree/main/packages/video)
18
+
19
+ Video is not a document format. Documents that software can parse are handled deterministically. Video understanding needs a model.
20
+
21
+ This package keeps that split:
22
+
23
+ ```text
24
+ video bytes → your callback → Markdown
25
+ ```
26
+
27
+ * **Pure TypeScript**
28
+ * **No Python runtime**
29
+ * **No native addons**
30
+ * **No WASM runtime**
31
+ * **Zero third-party runtime dependencies in this package**
32
+ * **Detects common video types from their contents, not only the filename**
33
+ * **Not included in `all()`**
34
+
35
+ ---
36
+
37
+ ## What it does
38
+
39
+ The converter sniffs the video type, then calls your `(input) => markdown` function with `{ bytes, mime }`.
40
+
41
+ The whole file is passed through. mdgate does not decode, transcode, or extract frames.
42
+
43
+ Without a callback, conversion fails as unsupported.
44
+
45
+ ---
46
+
47
+ ## Usage
8
48
 
9
49
  ```ts
10
50
  import { create } from '@mdgate/core';
11
51
  import { video } from '@mdgate/video';
12
52
  import { ai } from '@mdgate/ai';
13
53
 
14
- const convert = create([
15
- video(ai({ baseURL, apiKey, model }).convertVideo),
54
+ const media = ai({
55
+ baseURL: 'https://api.example.com/v1',
56
+ apiKey: process.env.API_KEY!,
57
+ model: 'your-model',
58
+ });
59
+
60
+ const read = create([
61
+ video(media.convertVideo),
16
62
  ]);
63
+
64
+ const markdown = await read(bytes, {
65
+ path: 'clip.mp4',
66
+ });
17
67
  ```
68
+
69
+ Or pass any function:
70
+
71
+ ```ts
72
+ import { create } from '@mdgate/core';
73
+ import { video } from '@mdgate/video';
74
+
75
+ const read = create([
76
+ video(async (input) => {
77
+ // Send input.bytes to the video model you already use.
78
+ return '...';
79
+ }),
80
+ ]);
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Node.js
86
+
87
+ ```ts
88
+ import { readFile } from 'node:fs/promises';
89
+ import { create } from '@mdgate/core';
90
+ import { video } from '@mdgate/video';
91
+
92
+ const read = create([
93
+ video(convertVideo),
94
+ ]);
95
+
96
+ const bytes = new Uint8Array(await readFile('clip.mp4'));
97
+ const markdown = await read(bytes, { path: 'clip.mp4' });
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Cloudflare Workers and Edge runtimes
103
+
104
+ ```ts
105
+ import { create } from '@mdgate/core';
106
+ import { video } from '@mdgate/video';
107
+
108
+ const read = create([
109
+ video(convertVideo),
110
+ ]);
111
+
112
+ export default {
113
+ async fetch(request: Request) {
114
+ const bytes = new Uint8Array(await request.arrayBuffer());
115
+ const markdown = await read(bytes);
116
+
117
+ return new Response(markdown, {
118
+ headers: {
119
+ 'content-type': 'text/markdown; charset=utf-8',
120
+ },
121
+ });
122
+ },
123
+ };
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Need more than video?
129
+
130
+ If your application needs to read many different file types, use the complete converter set, then add `video()` on top. `all()` does not register it.
131
+
132
+ ```bash
133
+ npm install @mdgate/converters
134
+ ```
135
+
136
+ [`@mdgate/video`](https://github.com/mdgate/converters/tree/main/packages/video) is one of the single-format packages in the open-source [`mdgate/converters`](https://github.com/mdgate/converters) project.
137
+
138
+ For AI agents, the same converter architecture can be used to extend `read_file` from text files to real-world document formats.
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ MIT
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mdgate/video",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "mdgate video converter",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "homepage": "https://demo.mdgate.dev",
7
+ "homepage": "https://convert.mdgate.dev",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/mdgate/converters.git",
@@ -28,7 +28,7 @@
28
28
  "prepublishOnly": "bun run build"
29
29
  },
30
30
  "dependencies": {
31
- "@mdgate/core": "0.6.8"
31
+ "@mdgate/core": "0.6.10"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"