@elizaos/plugin-video 2.0.0-beta.1 → 2.0.3-beta.6

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,68 @@
1
- # @elizaos/plugin-video Video Service
2
-
3
- The VideoService provides comprehensive video processing capabilities with a focus on efficient handling and transcription:
4
-
5
- **Key Features:**
6
- - **Video Download**: Supports both YouTube videos and direct MP4 URLs
7
- - **Format Handling**:
8
- - Automatic format detection and conversion
9
- - MP4 to MP3 conversion for audio processing
10
- - Support for various video platforms (YouTube, Vimeo)
11
- - **Transcription Pipeline**:
12
- 1. Attempts to extract manual subtitles (SRT format)
13
- 2. Falls back to automatic captions if available
14
- 3. Uses audio transcription as final fallback
15
- - **Performance Optimizations**:
16
- - Queue-based processing for multiple videos
17
- - Built-in caching system for processed results
18
- - Efficient temporary file management
19
- - **Error Handling**:
20
- - Graceful fallbacks for different transcription methods
21
- - Comprehensive error reporting
22
- - Automatic cleanup of temporary files
23
-
24
- **Usage Example:**
1
+ # @elizaos/plugin-video
2
+
3
+ Video download, processing, and transcription plugin for elizaOS agents.
4
+
5
+ ## What it does
6
+
7
+ This plugin adds a `VideoService` to any Eliza agent's service registry. Once loaded, other plugins and actions can call `runtime.getService<IVideoService>(ServiceType.VIDEO)` to:
8
+
9
+ - **Download video** from YouTube, Vimeo, or any direct MP4 URL.
10
+ - **Extract audio** from a video file (MP4 → MP3 via ffmpeg).
11
+ - **Generate thumbnails** from a specific timestamp.
12
+ - **Convert video** to a different format, resolution, bitrate, codec, or time range.
13
+ - **Fetch available formats** for a URL via yt-dlp.
14
+ - **Process a video URL end-to-end** into a `Media` object with title, description, source, and a full transcript. Transcription priority:
15
+ 1. Manual subtitles (SRT), if available.
16
+ 2. Automatic captions, if available.
17
+ 3. Audio transcription via `ServiceType.TRANSCRIPTION` (requires a loaded plugin that registers an `ITranscriptionService`).
18
+
19
+ Results are cached under `./content_cache/` by content hash. yt-dlp is automatically kept up to date: on known extractor failures the plugin re-downloads the latest yt-dlp release from GitHub and retries.
20
+
21
+ ## Enabling the plugin
22
+
23
+ Add `@elizaos/plugin-video` to the agent's plugin list in its character file or runtime configuration:
24
+
25
+ ```json
26
+ {
27
+ "plugins": ["@elizaos/plugin-video"]
28
+ }
29
+ ```
30
+
31
+ ## Usage
32
+
25
33
  ```typescript
34
+ import { IVideoService, ServiceType } from "@elizaos/core";
35
+
36
+ // Inside an action or provider handler:
26
37
  const videoService = runtime.getService<IVideoService>(ServiceType.VIDEO);
38
+ if (!videoService) throw new Error("plugin-video not loaded");
39
+
40
+ // Fetch full transcript + metadata:
41
+ const media = await videoService.processVideo("https://www.youtube.com/watch?v=...", runtime);
42
+ // media.text contains the transcript
43
+ // media.title, media.source, media.description have metadata
27
44
 
28
- // Process a video URL
29
- const result = await videoService.processVideo(videoUrl, runtime);
30
- // Returns: Media object with id, url, title, source, description, and transcript
45
+ // Download only:
46
+ const filePath = await videoService.downloadVideo("https://www.youtube.com/watch?v=...");
47
+
48
+ // Extract audio from a local file:
49
+ const mp3Path = await videoService.extractAudio("/path/to/video.mp4");
31
50
  ```
51
+
52
+ ## Required environment variables
53
+
54
+ None are required. The plugin resolves binaries automatically.
55
+
56
+ | Variable | Purpose | Default |
57
+ |----------|---------|---------|
58
+ | `ELIZA_YT_DLP_PATH` | Path to a specific yt-dlp binary | Auto-resolved |
59
+ | `ELIZA_YT_DLP_PREFER_PATH` | `1` to prefer system `yt-dlp` over the managed cache | `0` |
60
+ | `ELIZA_DISABLE_YTDLP_AUTOUPDATE` | `1` to disable automatic yt-dlp updates on failure | `0` |
61
+ | `ELIZA_FFMPEG_PATH` | Path to a specific ffmpeg binary | Auto-resolved |
62
+ | `ELIZA_BINARIES_DIR` | Directory where managed yt-dlp is cached | `<stateDir>/binaries` |
63
+
64
+ ## System dependencies
65
+
66
+ - **ffmpeg** — required for audio extraction, thumbnail generation, and video conversion. Resolved from `ELIZA_FFMPEG_PATH`, then system PATH, then the bundled `ffmpeg-static` npm package.
67
+ - **yt-dlp** — required for YouTube/Vimeo downloads and subtitle extraction. Resolved from `ELIZA_YT_DLP_PATH`, system PATH, or automatically downloaded and cached from GitHub releases.
68
+ - **Transcription service** — needed only for the audio-transcription fallback path. Any plugin that registers an `ITranscriptionService` under `ServiceType.TRANSCRIPTION` will work.
package/build.ts ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bun
2
+ import { rmSync } from "node:fs";
3
+ import { $ } from "bun";
4
+ import { externalsFromPackageJson } from "../plugin-build-externals.ts";
5
+
6
+ const external = await externalsFromPackageJson("./package.json", {
7
+ extra: ["node:*", "bun:*"],
8
+ });
9
+
10
+ console.log("🔨 Building @elizaos/plugin-video...");
11
+ const start = Date.now();
12
+
13
+ rmSync("dist", { recursive: true, force: true });
14
+
15
+ const result = await Bun.build({
16
+ entrypoints: ["src/index.ts"],
17
+ outdir: "dist",
18
+ target: "node",
19
+ format: "esm",
20
+ sourcemap: "external",
21
+ external,
22
+ minify: false,
23
+ });
24
+
25
+ if (!result.success) {
26
+ for (const log of result.logs) {
27
+ console.error(log);
28
+ }
29
+ process.exit(1);
30
+ }
31
+
32
+ console.log("📝 Generating TypeScript declarations...");
33
+ await $`tsc --emitDeclarationOnly --declaration --declarationDir dist --noCheck -p tsconfig.json`.quiet();
34
+
35
+ console.log(
36
+ `✅ Build complete in ${((Date.now() - start) / 1000).toFixed(2)}s`,
37
+ );
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { Plugin } from '@elizaos/core';
2
-
1
+ import type { Plugin } from "@elizaos/core";
3
2
  declare const videoPlugin: Plugin;
4
-
5
- export { videoPlugin as default };
3
+ export default videoPlugin;