@@ -8,15 +8,21 @@ import { getSettings } from 'csdm/node/settings/get-settings';
8
8
import { getDemoFromFilePath } from 'csdm/node/demo/get-demo-from-file-path' ;
9
9
import { generateVideo } from 'csdm/node/video/generation/generate-video' ;
10
10
import type { Sequence } from 'csdm/common/types/sequence' ;
11
- import type { EncoderSoftware } from 'csdm/common/types/encoder-software' ;
11
+ import { EncoderSoftware } from 'csdm/common/types/encoder-software' ;
12
12
import { isValidEncoderSoftware } from 'csdm/common/types/encoder-software' ;
13
- import type { RecordingSystem } from 'csdm/common/types/recording-system' ;
13
+ import { RecordingSystem } from 'csdm/common/types/recording-system' ;
14
14
import { isValidRecordingSystem } from 'csdm/common/types/recording-system' ;
15
- import type { RecordingOutput } from 'csdm/common/types/recording-output' ;
15
+ import { RecordingOutput } from 'csdm/common/types/recording-output' ;
16
16
import { isValidRecordingOutput } from 'csdm/common/types/recording-output' ;
17
17
import type { VideoContainer } from 'csdm/common/types/video-container' ;
18
18
import { isValidVideoContainer } from 'csdm/common/types/video-container' ;
19
19
import { InvalidArgument } from 'csdm/cli/errors/invalid-argument' ;
20
+ import { isHlaeInstalled } from 'csdm/node/video/hlae/is-hlae-installed' ;
21
+ import { installHlae } from 'csdm/node/video/hlae/install-hlae' ;
22
+ import { isVirtualDubInstalled } from 'csdm/node/video/virtual-dub/is-virtual-dub-installed' ;
23
+ import { downloadAndExtractVirtualDub } from 'csdm/node/video/virtual-dub/download-and-extract-virtual-dub' ;
24
+ import { isFfmpegInstalled } from 'csdm/node/video/ffmpeg/is-ffmpeg-installed' ;
25
+ import { installFfmpeg } from 'csdm/node/video/ffmpeg/install-ffmpeg' ;
20
26
21
27
export class VideoCommand extends Command {
22
28
public static Name = 'video' ;
@@ -72,7 +78,7 @@ export class VideoCommand extends Command {
72
78
private cfg : string | undefined ;
73
79
74
80
public getDescription ( ) {
75
- return 'Generate a video from a demo .' ;
81
+ return 'Generate videos from demos .' ;
76
82
}
77
83
78
84
public printHelp ( ) {
@@ -132,6 +138,25 @@ export class VideoCommand extends Command {
132
138
cfg : this . cfg ,
133
139
} ;
134
140
141
+ const recordingSystem = this . recordingSystem ?? settings . video . recordingSystem ;
142
+ if ( recordingSystem === RecordingSystem . HLAE && ! ( await isHlaeInstalled ( ) ) ) {
143
+ console . log ( 'Installing HLAE...' ) ;
144
+ await installHlae ( ) ;
145
+ }
146
+
147
+ const recordingOutput = this . recordingOutput ?? settings . video . recordingOutput ;
148
+ const shouldGenerateVideo = recordingOutput !== RecordingOutput . Images ;
149
+ const encoderSoftware = this . encoderSoftware ?? settings . video . encoderSoftware ;
150
+ if ( shouldGenerateVideo && encoderSoftware === EncoderSoftware . VirtualDub && ! ( await isVirtualDubInstalled ( ) ) ) {
151
+ console . log ( 'Installing VirtualDub...' ) ;
152
+ await downloadAndExtractVirtualDub ( ) ;
153
+ }
154
+
155
+ if ( shouldGenerateVideo && encoderSoftware === EncoderSoftware . FFmpeg && ! ( await isFfmpegInstalled ( ) ) ) {
156
+ console . log ( 'Installing FFmpeg...' ) ;
157
+ await installFfmpeg ( ) ;
158
+ }
159
+
135
160
const videoId = randomUUID ( ) ;
136
161
const controller = new AbortController ( ) ;
137
162
@@ -140,9 +165,9 @@ export class VideoCommand extends Command {
140
165
checksum : demo . checksum ,
141
166
game : demo . game ,
142
167
tickrate : demo . tickrate ,
143
- recordingSystem : this . recordingSystem ?? settings . video . recordingSystem ,
144
- recordingOutput : this . recordingOutput ?? settings . video . recordingOutput ,
145
- encoderSoftware : this . encoderSoftware ?? settings . video . encoderSoftware ,
168
+ recordingSystem,
169
+ recordingOutput,
170
+ encoderSoftware,
146
171
framerate : this . framerate ?? settings . video . framerate ,
147
172
width : this . width ?? settings . video . width ,
148
173
height : this . height ?? settings . video . height ,
0 commit comments