@mediaproc/video 1.0.1 ā 1.1.1
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/README.md +487 -89
- package/dist/commands/compress.d.ts.map +1 -1
- package/dist/commands/compress.js +172 -65
- package/dist/commands/compress.js.map +1 -1
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +19 -3
- package/dist/commands/extract.js.map +1 -1
- package/dist/commands/merge.d.ts.map +1 -1
- package/dist/commands/merge.js +90 -12
- package/dist/commands/merge.js.map +1 -1
- package/dist/commands/resize.d.ts.map +1 -1
- package/dist/commands/resize.js +220 -85
- package/dist/commands/resize.js.map +1 -1
- package/dist/commands/transcode.d.ts.map +1 -1
- package/dist/commands/transcode.js +7 -1
- package/dist/commands/transcode.js.map +1 -1
- package/dist/commands/trim.d.ts.map +1 -1
- package/dist/commands/trim.js +177 -82
- package/dist/commands/trim.js.map +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +7 -9
- package/dist/register.js.map +1 -1
- package/dist/utils/ffmpeg-output.d.ts +9 -0
- package/dist/utils/ffmpeg-output.d.ts.map +1 -0
- package/dist/utils/ffmpeg-output.js +94 -0
- package/dist/utils/ffmpeg-output.js.map +1 -0
- package/dist/utils/ffmpeg.d.ts +1 -1
- package/dist/utils/ffmpeg.d.ts.map +1 -1
- package/dist/utils/ffmpeg.js +12 -7
- package/dist/utils/ffmpeg.js.map +1 -1
- package/dist/utils/ffmpegLogger.d.ts +16 -0
- package/dist/utils/ffmpegLogger.d.ts.map +1 -0
- package/dist/utils/ffmpegLogger.js +66 -0
- package/dist/utils/ffmpegLogger.js.map +1 -0
- package/dist/utils/helpFormatter.d.ts +51 -0
- package/dist/utils/helpFormatter.d.ts.map +1 -0
- package/dist/utils/helpFormatter.js +134 -0
- package/dist/utils/helpFormatter.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/commands/resize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/commands/resize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAczC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA+QrD"}
|
package/dist/commands/resize.js
CHANGED
|
@@ -1,112 +1,247 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { stat } from 'fs/promises';
|
|
3
|
-
import { runFFmpeg, getVideoMetadata, checkFFmpeg, formatFileSize,
|
|
4
|
-
import {
|
|
3
|
+
import { runFFmpeg, getVideoMetadata, checkFFmpeg, formatFileSize, } from '../utils/ffmpeg.js';
|
|
4
|
+
import { parseInputPaths, resolveOutputPaths } from '../utils/pathValidator.js';
|
|
5
|
+
import { logFFmpegOutput } from '../utils/ffmpegLogger.js';
|
|
6
|
+
import { createStandardHelp } from '../utils/helpFormatter.js';
|
|
7
|
+
import ora from 'ora';
|
|
5
8
|
export function resizeCommand(videoCmd) {
|
|
6
9
|
videoCmd
|
|
7
|
-
.command('resize
|
|
8
|
-
.description('Resize video resolution')
|
|
9
|
-
.option('-
|
|
10
|
-
.option('-
|
|
11
|
-
.option('-
|
|
12
|
-
.option('--
|
|
13
|
-
.option('--
|
|
14
|
-
.option('--
|
|
15
|
-
.option('-
|
|
10
|
+
.command('resize [input]')
|
|
11
|
+
.description('Resize video to specified resolution with quality preservation')
|
|
12
|
+
.option('-s, --scale <scale>', 'Resolution: 360p, 480p, 720p, 1080p, 1440p, 2160p (4K), 4320p (8K), or WxH', '1080p')
|
|
13
|
+
.option('-o, --output <path>', 'Output file or directory path')
|
|
14
|
+
.option('-c, --codec <codec>', 'Video codec: h264, h265, vp9, av1 (default: h264)', 'h264')
|
|
15
|
+
.option('-q, --quality <quality>', 'CRF quality: 0-51, lower is better (default: 23)', parseInt, 23)
|
|
16
|
+
.option('--preset <preset>', 'Encoding preset: ultrafast, fast, medium, slow, veryslow (default: medium)', 'medium')
|
|
17
|
+
.option('-b, --bitrate <bitrate>', 'Target bitrate (e.g., 5M, 10M)')
|
|
18
|
+
.option('-a, --aspect <ratio>', 'Aspect ratio: 16:9, 4:3, 21:9, 1:1')
|
|
19
|
+
.option('--fps <fps>', 'Output frame rate (e.g., 24, 30, 60)', parseInt)
|
|
20
|
+
.option('--format <format>', 'Output format: mp4, mkv, webm, avi')
|
|
21
|
+
.option('--scale-algo <algorithm>', 'Scaling algorithm: bilinear, bicubic, lanczos, spline (default: lanczos)', 'lanczos')
|
|
22
|
+
.option('--deinterlace', 'Deinterlace video (for interlaced sources)')
|
|
23
|
+
.option('--rotate <degrees>', 'Rotate video: 90, 180, 270 degrees', parseInt)
|
|
24
|
+
.option('--flip <direction>', 'Flip video: horizontal, vertical, both')
|
|
25
|
+
.option('--crop <spec>', 'Crop video (width:height:x:y or preset: 16:9, 4:3, 1:1)')
|
|
26
|
+
.option('--threads <n>', 'Number of threads for encoding (default: auto)', parseInt)
|
|
27
|
+
.option('--hw-accel', 'Enable hardware acceleration (GPU)')
|
|
28
|
+
.option('--no-audio', 'Remove audio from output')
|
|
29
|
+
.option('--two-pass', 'Use two-pass encoding for better quality')
|
|
30
|
+
.option('--dry-run', 'Preview command without executing')
|
|
31
|
+
.option('-v, --verbose', 'Show detailed FFmpeg output')
|
|
32
|
+
.option('-h, --help', 'Display help for resize command')
|
|
16
33
|
.action(async (input, options) => {
|
|
34
|
+
// Show help if requested (before input validation)
|
|
35
|
+
if (options.help || !input) {
|
|
36
|
+
createStandardHelp({
|
|
37
|
+
commandName: 'resize',
|
|
38
|
+
emoji: 'š¬',
|
|
39
|
+
description: 'Resize videos to different resolutions while maintaining quality. Supports standard resolutions from 360p to 8K (4320p), custom dimensions, aspect ratios, and various codecs. Can process single files or entire directories.',
|
|
40
|
+
usage: [
|
|
41
|
+
'resize <input> [options]',
|
|
42
|
+
'resize video.mp4 -s 1080p',
|
|
43
|
+
'resize videos/ -s 4K -o output/'
|
|
44
|
+
],
|
|
45
|
+
options: [
|
|
46
|
+
{ flag: '-s, --scale <scale>', description: 'Resolution: 360p, 480p, 720p, 1080p, 1440p, 2160p (4K), 4320p (8K), or WxH' },
|
|
47
|
+
{ flag: '-o, --output <path>', description: 'Output file/directory (default: <input>-resized.<ext>)' },
|
|
48
|
+
{ flag: '-c, --codec <codec>', description: 'Video codec: h264, h265 (HEVC), vp9, av1 (default: h264)' },
|
|
49
|
+
{ flag: '-q, --quality <quality>', description: 'CRF quality 0-51, lower=better (default: 23)' },
|
|
50
|
+
{ flag: '--preset <preset>', description: 'Encoding preset: ultrafast, fast, medium, slow, veryslow' },
|
|
51
|
+
{ flag: '-b, --bitrate <bitrate>', description: 'Target bitrate (e.g., 5M for 5 Mbps, 10M for 10 Mbps)' },
|
|
52
|
+
{ flag: '-a, --aspect <ratio>', description: 'Aspect ratio: 16:9, 4:3, 21:9, 1:1' },
|
|
53
|
+
{ flag: '--fps <fps>', description: 'Output frame rate (e.g., 24, 30, 60)' },
|
|
54
|
+
{ flag: '--format <format>', description: 'Output format: mp4, mkv, webm, avi' },
|
|
55
|
+
{ flag: '--scale-algo <algorithm>', description: 'Scaling algorithm: bilinear, bicubic, lanczos, spline (default: lanczos)' },
|
|
56
|
+
{ flag: '--deinterlace', description: 'Deinterlace video (for interlaced sources)' },
|
|
57
|
+
{ flag: '--rotate <degrees>', description: 'Rotate video: 90, 180, 270 degrees' },
|
|
58
|
+
{ flag: '--flip <direction>', description: 'Flip video: horizontal, vertical, both' },
|
|
59
|
+
{ flag: '--crop <spec>', description: 'Crop video (width:height:x:y or preset: 16:9, 4:3, 1:1)' },
|
|
60
|
+
{ flag: '--threads <n>', description: 'Number of threads for encoding (default: auto)' },
|
|
61
|
+
{ flag: '--hw-accel', description: 'Enable hardware acceleration (GPU)' },
|
|
62
|
+
{ flag: '--no-audio', description: 'Remove audio track from output' },
|
|
63
|
+
{ flag: '--two-pass', description: 'Enable two-pass encoding for better quality' },
|
|
64
|
+
{ flag: '--dry-run', description: 'Preview FFmpeg command without executing' },
|
|
65
|
+
{ flag: '-v, --verbose', description: 'Show detailed FFmpeg output' }
|
|
66
|
+
],
|
|
67
|
+
examples: [
|
|
68
|
+
{ command: 'resize video.mp4 -s 720p', description: 'Resize to 720p HD resolution' },
|
|
69
|
+
{ command: 'resize video.mp4 -s 4K -c h265 --preset slow', description: 'Resize to 4K using HEVC with high quality' },
|
|
70
|
+
{ command: 'resize video.mp4 -s 1920x1080 -a 16:9', description: 'Resize to Full HD with 16:9 aspect ratio' },
|
|
71
|
+
{ command: 'resize videos/ -s 1080p -o output/', description: 'Resize all videos in folder to 1080p' },
|
|
72
|
+
{ command: 'resize video.mp4 -s 2160p --fps 60 -b 15M', description: 'Resize to 4K at 60fps with 15Mbps bitrate' },
|
|
73
|
+
{ command: 'resize video.mp4 -s 8K -c av1 --two-pass', description: 'Resize to 8K using AV1 codec with two-pass encoding' }
|
|
74
|
+
],
|
|
75
|
+
additionalSections: [
|
|
76
|
+
{
|
|
77
|
+
title: 'Supported Resolutions',
|
|
78
|
+
items: [
|
|
79
|
+
'360p - 640Ć360 (Low quality, mobile)',
|
|
80
|
+
'480p - 854Ć480 (SD quality)',
|
|
81
|
+
'720p - 1280Ć720 (HD ready)',
|
|
82
|
+
'1080p - 1920Ć1080 (Full HD)',
|
|
83
|
+
'1440p - 2560Ć1440 (2K/QHD)',
|
|
84
|
+
'2160p - 3840Ć2160 (4K/UHD)',
|
|
85
|
+
'4320p - 7680Ć4320 (8K/UHD)',
|
|
86
|
+
'Custom - WIDTHxHEIGHT (e.g., 1920x1080)'
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: 'Codec Recommendations',
|
|
91
|
+
items: [
|
|
92
|
+
'h264 - Best compatibility, fast encoding (recommended)',
|
|
93
|
+
'h265 - 50% better compression than h264, slower encoding',
|
|
94
|
+
'vp9 - WebM format, good for web streaming',
|
|
95
|
+
'av1 - Best compression, very slow encoding, future-proof'
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: 'Quality & Bitrate Guidelines',
|
|
100
|
+
items: [
|
|
101
|
+
'CRF 18-23 - High quality (default: 23)',
|
|
102
|
+
'CRF 24-28 - Medium quality',
|
|
103
|
+
'Bitrate: 720p=5M, 1080p=8M, 1440p=16M, 4K=35-45M, 8K=80-100M'
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
tips: [
|
|
108
|
+
'Use --dry-run to preview the FFmpeg command before executing',
|
|
109
|
+
'For folder input, all videos will be processed with same settings',
|
|
110
|
+
'Two-pass encoding produces better quality but takes twice as long',
|
|
111
|
+
'h265/HEVC provides better quality at lower file sizes than h264',
|
|
112
|
+
'Use slow/veryslow preset for archival, fast/ultrafast for quick previews'
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
const spinner = ora('Initializing...').start();
|
|
17
118
|
try {
|
|
18
|
-
console.log(chalk.blue.bold('š¬ Video Resizing\n'));
|
|
19
119
|
// Check ffmpeg
|
|
120
|
+
spinner.text = 'Checking FFmpeg...';
|
|
20
121
|
const ffmpegAvailable = await checkFFmpeg();
|
|
21
122
|
if (!ffmpegAvailable) {
|
|
22
123
|
throw new Error('ffmpeg is not installed or not in PATH');
|
|
23
124
|
}
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
125
|
+
// Parse input files
|
|
126
|
+
spinner.text = 'Finding video files...';
|
|
127
|
+
const inputFiles = parseInputPaths(input);
|
|
128
|
+
if (inputFiles.length === 0) {
|
|
129
|
+
spinner.fail(chalk.red('No valid video files found'));
|
|
130
|
+
process.exit(1);
|
|
28
131
|
}
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
132
|
+
spinner.succeed(chalk.green(`Found ${inputFiles.length} video file(s) to process`));
|
|
133
|
+
// Scale mapping with 8K support
|
|
134
|
+
const scaleMap = {
|
|
135
|
+
'360p': { width: 640, height: 360 },
|
|
136
|
+
'480p': { width: 854, height: 480 },
|
|
137
|
+
'720p': { width: 1280, height: 720 },
|
|
138
|
+
'1080p': { width: 1920, height: 1080 },
|
|
139
|
+
'1440p': { width: 2560, height: 1440 },
|
|
140
|
+
'2k': { width: 2560, height: 1440 },
|
|
141
|
+
'2K': { width: 2560, height: 1440 },
|
|
142
|
+
'2160p': { width: 3840, height: 2160 },
|
|
143
|
+
'4k': { width: 3840, height: 2160 },
|
|
144
|
+
'4K': { width: 3840, height: 2160 },
|
|
145
|
+
'uhd': { width: 3840, height: 2160 },
|
|
146
|
+
'UHD': { width: 3840, height: 2160 },
|
|
147
|
+
'4320p': { width: 7680, height: 4320 },
|
|
148
|
+
'8k': { width: 7680, height: 4320 },
|
|
149
|
+
'8K': { width: 7680, height: 4320 },
|
|
150
|
+
};
|
|
38
151
|
// Determine target resolution
|
|
39
152
|
let targetWidth;
|
|
40
153
|
let targetHeight;
|
|
41
|
-
if (options.scale) {
|
|
42
|
-
//
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
const preset = scalePresets[options.scale];
|
|
51
|
-
if (!preset) {
|
|
52
|
-
throw new Error(`Invalid scale preset: ${options.scale}. Use: 480p, 720p, 1080p, 1440p, or 4k`);
|
|
53
|
-
}
|
|
154
|
+
if (options.scale.includes('x')) {
|
|
155
|
+
// Custom dimensions like 1920x1080
|
|
156
|
+
const [w, h] = options.scale.split('x').map(Number);
|
|
157
|
+
targetWidth = w;
|
|
158
|
+
targetHeight = h;
|
|
159
|
+
}
|
|
160
|
+
else if (scaleMap[options.scale]) {
|
|
161
|
+
const preset = scaleMap[options.scale];
|
|
54
162
|
targetWidth = preset.width;
|
|
55
163
|
targetHeight = preset.height;
|
|
56
164
|
}
|
|
57
|
-
else if (options.width && options.height) {
|
|
58
|
-
// Use custom dimensions
|
|
59
|
-
targetWidth = options.width;
|
|
60
|
-
targetHeight = options.height;
|
|
61
|
-
}
|
|
62
|
-
else if (options.width) {
|
|
63
|
-
// Calculate height maintaining aspect ratio
|
|
64
|
-
targetWidth = options.width;
|
|
65
|
-
targetHeight = Math.round((options.width / metadata.width) * metadata.height);
|
|
66
|
-
}
|
|
67
|
-
else if (options.height) {
|
|
68
|
-
// Calculate width maintaining aspect ratio
|
|
69
|
-
targetHeight = options.height;
|
|
70
|
-
targetWidth = Math.round((options.height / metadata.height) * metadata.width);
|
|
71
|
-
}
|
|
72
165
|
else {
|
|
73
|
-
throw new Error(
|
|
166
|
+
throw new Error(`Invalid scale: ${options.scale}. Use: 360p-8K or WIDTHxHEIGHT`);
|
|
74
167
|
}
|
|
75
|
-
// Ensure even dimensions
|
|
168
|
+
// Ensure even dimensions
|
|
76
169
|
targetWidth = Math.round(targetWidth / 2) * 2;
|
|
77
170
|
targetHeight = Math.round(targetHeight / 2) * 2;
|
|
78
|
-
//
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
171
|
+
// Codec mapping
|
|
172
|
+
const codecMap = {
|
|
173
|
+
'h264': 'libx264',
|
|
174
|
+
'h265': 'libx265',
|
|
175
|
+
'hevc': 'libx265',
|
|
176
|
+
'vp9': 'libvpx-vp9',
|
|
177
|
+
'av1': 'libaom-av1',
|
|
178
|
+
};
|
|
179
|
+
const videoCodec = codecMap[options.codec] || 'libx264';
|
|
180
|
+
// Resolve output paths
|
|
181
|
+
const outputPaths = resolveOutputPaths(inputFiles, options.output, {
|
|
182
|
+
suffix: `-${targetWidth}x${targetHeight}`,
|
|
183
|
+
newExtension: options.format ? `.${options.format}` : undefined
|
|
184
|
+
});
|
|
185
|
+
console.log(chalk.cyan.bold(`\nš¬ Resizing ${inputFiles.length} video(s) to ${options.scale}\n`));
|
|
186
|
+
// Process each file
|
|
187
|
+
for (let i = 0; i < inputFiles.length; i++) {
|
|
188
|
+
const inputFile = inputFiles[i];
|
|
189
|
+
const outputFile = outputPaths.get(inputFile);
|
|
190
|
+
spinner.start(`[${i + 1}/${inputFiles.length}] Analyzing: ${inputFile}`);
|
|
191
|
+
// Get metadata
|
|
192
|
+
const metadata = await getVideoMetadata(inputFile);
|
|
193
|
+
const inputStat = await stat(inputFile);
|
|
194
|
+
// Build filter
|
|
195
|
+
let vf = `scale=${targetWidth}:${targetHeight}:force_original_aspect_ratio=decrease`;
|
|
196
|
+
if (options.aspect) {
|
|
197
|
+
const [w, h] = options.aspect.split(':');
|
|
198
|
+
vf += `,setdar=${w}/${h}`;
|
|
199
|
+
}
|
|
200
|
+
// Build FFmpeg args
|
|
201
|
+
const args = ['-i', inputFile, '-vf', vf, '-c:v', videoCodec];
|
|
202
|
+
// Quality/Bitrate
|
|
203
|
+
if (options.bitrate) {
|
|
204
|
+
args.push('-b:v', options.bitrate);
|
|
205
|
+
if (options.twoPass) {
|
|
206
|
+
args.push('-maxrate', options.bitrate, '-bufsize', `${parseInt(options.bitrate) * 2}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
args.push('-crf', options.quality.toString());
|
|
211
|
+
}
|
|
212
|
+
args.push('-preset', options.preset);
|
|
213
|
+
// FPS
|
|
214
|
+
if (options.fps) {
|
|
215
|
+
args.push('-r', options.fps.toString());
|
|
216
|
+
}
|
|
217
|
+
// Audio
|
|
218
|
+
if (options.audio === false) {
|
|
219
|
+
args.push('-an');
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
args.push('-c:a', 'aac', '-b:a', '192k');
|
|
223
|
+
}
|
|
224
|
+
args.push('-y', outputFile);
|
|
225
|
+
// Dry run
|
|
226
|
+
if (options.dryRun) {
|
|
227
|
+
spinner.info(chalk.yellow(`[${i + 1}/${inputFiles.length}] Dry run - would execute:`));
|
|
228
|
+
console.log(chalk.dim(' ffmpeg ' + args.join(' ') + '\n'));
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
// Execute
|
|
232
|
+
spinner.text = `[${i + 1}/${inputFiles.length}] Resizing: ${inputFile}`;
|
|
233
|
+
await runFFmpeg(args, options.verbose, (line) => {
|
|
234
|
+
if (options.verbose) {
|
|
235
|
+
logFFmpegOutput(line);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const outputStat = await stat(outputFile);
|
|
239
|
+
spinner.succeed(chalk.green(`ā [${i + 1}/${inputFiles.length}] ${metadata.width}x${metadata.height} ā ${targetWidth}x${targetHeight} | ` +
|
|
240
|
+
`${formatFileSize(inputStat.size)} ā ${formatFileSize(outputStat.size)} | ${chalk.cyan(outputFile)}`));
|
|
96
241
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (options.verbose) {
|
|
100
|
-
console.log(chalk.dim(`ffmpeg ${args.join(' ')}\n`));
|
|
242
|
+
if (!options.dryRun) {
|
|
243
|
+
console.log(chalk.green.bold(`\n⨠Successfully resized ${inputFiles.length} video(s)!`));
|
|
101
244
|
}
|
|
102
|
-
await runFFmpeg(args, options.verbose);
|
|
103
|
-
// Get output file size
|
|
104
|
-
const outputStat = await stat(output);
|
|
105
|
-
console.log();
|
|
106
|
-
console.log(chalk.green.bold('ā Resizing Complete!\n'));
|
|
107
|
-
console.log(chalk.gray(` Resolution: ${metadata.width}x${metadata.height} ā ${targetWidth}x${targetHeight}`));
|
|
108
|
-
console.log(chalk.gray(` Size: ${formatFileSize(inputStat.size)} ā ${formatFileSize(outputStat.size)}`));
|
|
109
|
-
console.log(chalk.dim(`\n ${output}`));
|
|
110
245
|
}
|
|
111
246
|
catch (error) {
|
|
112
247
|
console.error(chalk.red(`\nā Error: ${error.message}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../src/commands/resize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../../src/commands/resize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,QAAQ;SACL,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,gEAAgE,CAAC;SAC7E,MAAM,CAAC,qBAAqB,EAAE,4EAA4E,EAAE,OAAO,CAAC;SACpH,MAAM,CAAC,qBAAqB,EAAE,+BAA+B,CAAC;SAC9D,MAAM,CAAC,qBAAqB,EAAE,mDAAmD,EAAE,MAAM,CAAC;SAC1F,MAAM,CAAC,yBAAyB,EAAE,kDAAkD,EAAE,QAAQ,EAAE,EAAE,CAAC;SACnG,MAAM,CAAC,mBAAmB,EAAE,4EAA4E,EAAE,QAAQ,CAAC;SACnH,MAAM,CAAC,yBAAyB,EAAE,gCAAgC,CAAC;SACnE,MAAM,CAAC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,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,UAAU,CAAC,MAAM,YAAY,CAAC,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAe,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcode.d.ts","sourceRoot":"","sources":["../../src/commands/transcode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"transcode.d.ts","sourceRoot":"","sources":["../../src/commands/transcode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAqHxD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { stat } from 'fs/promises';
|
|
3
3
|
import { runFFmpeg, getVideoMetadata, checkFFmpeg, validateInputFile, generateOutputPath, formatFileSize, formatDuration, } from '../utils/ffmpeg.js';
|
|
4
|
+
import { styleFFmpegOutput, shouldDisplayLine } from '../utils/ffmpeg-output.js';
|
|
4
5
|
export function transcodeCommand(videoCmd) {
|
|
5
6
|
videoCmd
|
|
6
7
|
.command('transcode <input>')
|
|
@@ -13,6 +14,7 @@ export function transcodeCommand(videoCmd) {
|
|
|
13
14
|
.option('--audio-bitrate <bitrate>', 'Audio bitrate (e.g., 128k)', '128k')
|
|
14
15
|
.option('--dry-run', 'Show what would be done')
|
|
15
16
|
.option('-v, --verbose', 'Verbose output')
|
|
17
|
+
.option('--help', 'Display help for command')
|
|
16
18
|
.action(async (input, options) => {
|
|
17
19
|
try {
|
|
18
20
|
console.log(chalk.blue.bold('š¬ Video Transcoding\n'));
|
|
@@ -83,7 +85,11 @@ export function transcodeCommand(videoCmd) {
|
|
|
83
85
|
if (options.verbose) {
|
|
84
86
|
console.log(chalk.dim(`ffmpeg ${args.join(' ')}\n`));
|
|
85
87
|
}
|
|
86
|
-
await runFFmpeg(args, options.verbose)
|
|
88
|
+
await runFFmpeg(args, options.verbose, (line) => {
|
|
89
|
+
if (shouldDisplayLine(line, options.verbose || false)) {
|
|
90
|
+
console.log(styleFFmpegOutput(line));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
87
93
|
// Get output file size
|
|
88
94
|
const outputStat = await stat(output);
|
|
89
95
|
console.log();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcode.js","sourceRoot":"","sources":["../../src/commands/transcode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"transcode.js","sourceRoot":"","sources":["../../src/commands/transcode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEjF,MAAM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AO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3G,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAe,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trim.d.ts","sourceRoot":"","sources":["../../src/commands/trim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"trim.d.ts","sourceRoot":"","sources":["../../src/commands/trim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAczC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAmNnD"}
|