1
1
# FFmpeg Video Composer
2
2
3
- [ ![ Node.js Version] ( https://img.shields.io/badge/node-%3E%3D18 .x-brightgreen.svg )] ( https://nodejs.org/en/ ) [ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
3
+ [ ![ Node.js Version] ( https://img.shields.io/badge/node-%3E%3D22 .x-brightgreen.svg )] ( https://nodejs.org/en/ ) [ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
4
4
5
5
` ffmpeg-video-composer ` is a tool designed to streamline the process of video compilation and audio mixing using FFmpeg. It enables dynamic template generation, video rendering, and audio composition, making it a comprehensive solution for creating personalized multimedia content programmatically.
6
6
@@ -14,24 +14,67 @@ https://github.com/heristop/assets/6bcd0578-7dee-4630-aa6b-c730cf5cec17
14
14
15
15
## 🚀 Features
16
16
17
- * Dynamic video and audio template generation
18
- * Easy video compilation and audio mixing using FFmpeg
19
- * Flexible JSON-based template descriptor system
20
- * CLI for quick video creation
21
- * JSON configuration for complex project setups
22
- * Custom project configurations support
23
- * Audio overlay and mixing capabilities
24
- * Automated video editing and composition
17
+ - Dynamic video and audio template generation
18
+ - Easy video compilation and audio mixing using FFmpeg
19
+ - Flexible JSON-based template descriptor system
20
+ - CLI for quick video creation
21
+ - JSON configuration for complex project setups
22
+ - Custom project configurations support
23
+ - Audio overlay and mixing capabilities
24
+ - Automated video editing and composition
25
25
26
- ## 🛠 Installation
26
+ ## ⚠️ Prerequisites
27
+
28
+ This tool requires ** FFmpeg** to be installed on your system and available in your PATH. FFmpeg is used directly for all video and audio processing operations.
29
+
30
+ ### FFmpeg Installation Guide
31
+
32
+ #### macOS
33
+
34
+ Using [ Homebrew] ( https://brew.sh/ ) :
35
+
36
+ ``` bash
37
+ brew install ffmpeg
38
+ ```
39
+
40
+ #### Linux
41
+
42
+ For Debian/Ubuntu:
43
+
44
+ ``` bash
45
+ sudo apt update && sudo apt install ffmpeg
46
+ ```
47
+
48
+ For Fedora:
49
+
50
+ ``` bash
51
+ sudo dnf install ffmpeg
52
+ ```
53
+
54
+ For Arch Linux:
55
+
56
+ ``` bash
57
+ sudo pacman -S ffmpeg
58
+ ```
59
+
60
+ #### Verify Installation
61
+
62
+ After installation, verify that FFmpeg is properly installed:
63
+
64
+ ``` bash
65
+ ffmpeg -version
66
+ ffprobe -version
67
+ ```
68
+
69
+ ## 📦 Installation
27
70
28
71
### Using npm (or yarn/pnpm)
29
72
30
73
``` bash
31
74
pnpm add ffmpeg-video-composer
32
75
```
33
76
34
- ### Cloning the Repository
77
+ ### Development Setup
35
78
36
79
``` bash
37
80
git clone https://github.com/heristop/ffmpeg-video-composer.git
@@ -101,7 +144,7 @@ pnpm test
101
144
}
102
145
}}%%
103
146
104
- graph TB
147
+ graph TD
105
148
%% Style Definitions
106
149
classDef core fill:#EDF7FF,stroke:#4B83B8,stroke-width:2px
107
150
classDef abstract fill:#F9F3FF,stroke:#9D7AB8,stroke-width:2px,stroke-dasharray: 5 5
@@ -110,79 +153,67 @@ graph TB
110
153
classDef builder fill:#FFE8E8,stroke:#E88B8B,stroke-width:2px
111
154
classDef title fill:none,stroke:none
112
155
113
- %% Entry Points and Director Pattern
114
- subgraph Flow ["🚀 Application Flow"]
115
- direction LR
116
- main[("main.ts")]:::entry -->
117
- index["index.ts"]:::entry
118
-
119
- subgraph DirectorPattern ["👷 Builder Pattern Implementation"]
120
- direction TB
121
- director["TemplateDirector.ts"]:::builder
122
- template_builder["TemplateConcreteBuilder.ts"]:::builder
123
- director --> template_builder
124
- end
125
-
126
- index --> director
156
+ %% Entry Points
157
+ subgraph Flow ["🚀 Application Entry"]
158
+ direction TB
159
+ main[("main.ts")]:::entry --> index["index.ts"]:::entry
127
160
end
128
161
129
162
%% Core Domain
130
- subgraph Core ["💎 Core Domain"]
163
+ subgraph Core ["💎 Domain Layer "]
131
164
direction TB
132
- subgraph Models ["Domain Models"]
133
- direction TB
134
- models_title["Core Business Objects"]:::title
165
+ subgraph CoreModels ["Domain Models"]
135
166
core_project["Project.ts"]:::core
136
167
core_segment["Segment.ts"]:::core
137
168
core_template["Template.ts"]:::core
138
169
end
139
170
140
- subgraph Utils ["Core Utilities"]
141
- direction TB
142
- utils_title["Support Types & Config"]:::title
171
+ subgraph CoreUtils ["Core Utilities"]
143
172
core_types["types.ts"]:::core
144
173
core_config["default.config.ts"]:::core
145
- core_format["FormatHelper.ts"]:::core
146
174
end
147
175
end
148
176
177
+ %% Director Pattern
178
+ subgraph Builder ["👷 Builder Pattern"]
179
+ direction TB
180
+ director["TemplateDirector.ts"]:::builder
181
+ template_builder["TemplateConcreteBuilder.ts"]:::builder
182
+ end
183
+
149
184
%% Platform Layer
150
185
subgraph Platform ["⚡ Platform Layer"]
151
186
direction TB
152
- subgraph Abstractions ["Interface Definitions"]
153
- direction TB
154
- abstractions_title["Abstract Interfaces"]:::title
187
+ subgraph PlatformCore ["Core Platform"]
188
+ platform_bridge["PlatformBridge.ts"]:::implementation
189
+ event_manager["EventManager.ts"]:::implementation
190
+ end
191
+
192
+ subgraph Abstractions ["Interfaces"]
155
193
abstract_ffmpeg["AbstractFFmpeg.ts"]:::abstract
156
194
abstract_music["AbstractMusic.ts"]:::abstract
157
195
abstract_fs["AbstractFilesystem.ts"]:::abstract
158
196
abstract_logger["AbstractLogger.ts"]:::abstract
159
197
end
160
198
161
- subgraph Adapters ["Concrete Implementations"]
162
- direction TB
163
- adapters_title["Platform Adapters"]:::title
199
+ subgraph Adapters ["Platform Adapters"]
164
200
ffmpeg_node["FFmpegNodeAdapter.ts"]:::implementation
165
201
music_node["MusicNodeAdapter.ts"]:::implementation
166
202
fs_node["FilesystemNodeAdapter.ts"]:::implementation
167
203
pino_adapter["PinoLogAdapter.ts"]:::implementation
168
204
end
169
-
170
- platform_bridge["PlatformBridge.ts"]:::implementation
171
- event_manager["EventManager.ts"]:::implementation
172
205
end
173
206
174
207
%% Editor Components
175
208
subgraph Editor ["🎥 Video Processing"]
176
209
direction TB
177
- subgraph EditorCore ["Core Editor Components"]
178
- editor_title["Main Processing Units"]:::title
210
+ subgraph EditorCore ["Core Processing"]
179
211
video_editor["VideoEditor.ts"]:::implementation
180
212
music_composer["MusicComposer.ts"]:::implementation
181
213
segment_builder["SegmentBuilder.ts"]:::implementation
182
214
end
183
215
184
- subgraph VideoSegments ["Video Segment Types"]
185
- segments_title["Segment Implementations"]:::title
216
+ subgraph Segments ["Video Segments"]
186
217
segment_factory["SegmentFactory.ts"]:::implementation
187
218
video_segment["VideoSegment.ts"]:::implementation
188
219
color_bg_segment["ColorBackgroundSegment.ts"]:::implementation
@@ -194,39 +225,42 @@ graph TB
194
225
%% Resource Management
195
226
subgraph Resources ["📊 Resource Management"]
196
227
direction TB
197
- resources_title["Resource Managers"]:::title
198
228
asset_manager["AssetManager.ts"]:::implementation
199
229
filter_manager["FilterManager.ts"]:::implementation
200
230
formatter_manager["FormatterManager.ts"]:::implementation
201
231
map_manager["MapManager.ts"]:::implementation
202
232
var_manager["VariableManager.ts"]:::implementation
203
233
end
204
234
205
- %% Key Relationships
206
- director --> |"orchestrates"| event_manager
207
- director --> |"uses"| video_editor
208
- template_builder --> |"creates"| segment_builder
209
- template_builder --> |"uses"| segment_factory
235
+ %% Main Flow
236
+ index --> director
237
+ director --> template_builder
238
+ director --> video_editor
239
+ director --> event_manager
210
240
211
- segment_factory --> |"creates"| video_segment & color_bg_segment & image_bg_segment & project_video_segment
212
- video_segment & color_bg_segment & image_bg_segment & project_video_segment --> |"builds via"| segment_builder
241
+ %% Builder Pattern Flow
242
+ template_builder --> segment_builder
243
+ template_builder --> segment_factory
213
244
214
- video_editor --> |"uses"| music_composer
245
+ %% Segment Creation Flow
246
+ segment_factory --> video_segment & color_bg_segment & image_bg_segment & project_video_segment
247
+ video_segment & color_bg_segment & image_bg_segment & project_video_segment --> segment_builder
215
248
216
- %% Platform Implementation Relations
217
- platform_bridge --> |"implements"| ffmpeg_node & music_node & fs_node & pino_adapter
249
+ %% Platform Relations
250
+ platform_bridge --> ffmpeg_node & music_node & fs_node & pino_adapter
251
+ ffmpeg_node --> abstract_ffmpeg
252
+ music_node --> abstract_music
253
+ fs_node --> abstract_fs
254
+ pino_adapter --> abstract_logger
218
255
219
- ffmpeg_node --> |"implements"| abstract_ffmpeg
220
- music_node --> |"implements"| abstract_music
221
- fs_node --> |"implements"| abstract_fs
222
- pino_adapter --> |"implements"| abstract_logger
256
+ %% Resource Management
257
+ segment_builder --> asset_manager & filter_manager & formatter_manager & map_manager & var_manager
223
258
224
- %% Resource Management Relations
225
- segment_builder --> |"manages"| asset_manager & filter_manager & formatter_manager & map_manager & var_manager
259
+ %% Core Dependencies
260
+ core_project --> core_config & core_types
226
261
227
- %% Core Relations
228
- core_project --> |"uses"| core_config
229
- core_project --> |"uses"| core_types
262
+ %% Editor Flow
263
+ video_editor --> music_composer
230
264
231
265
%% Link Styling
232
266
linkStyle default stroke:#7C8D9D,stroke-width:1px
0 commit comments