tphim 1.0.7 → 2.0.2
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/package.json +2 -2
- package/pipeline.mjs +31 -6
- package/pro-terminal.mjs +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tphim",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "TPHIM - Ultimate Video Pipeline: Download, Transcode HLS, AI Subtitles, and Cloud Upload.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"chalk": "^5.6.2",
|
|
54
54
|
"cli-progress": "^3.12.0",
|
|
55
55
|
"dotenv": "^17.3.1",
|
|
56
|
-
"ffmpeg-static": "^5.
|
|
56
|
+
"ffmpeg-static": "^5.3.0",
|
|
57
57
|
"ffprobe-static": "^3.1.0",
|
|
58
58
|
"figlet": "^1.10.0",
|
|
59
59
|
"log-symbols": "^7.0.1",
|
package/pipeline.mjs
CHANGED
|
@@ -247,25 +247,31 @@ export async function executePipeline({ input, slug, title, langArg = 'vi' }) {
|
|
|
247
247
|
|
|
248
248
|
selectedQualities.forEach((q, i) => {
|
|
249
249
|
maps += `-map 0:v -map 0:a `;
|
|
250
|
-
outputs += `-c:v:${i} libx264 -preset veryfast -b:v:${i} ${q.bv} -s:v:${i} ${q.w}x${q.h} -c:a:${i} aac -b:a:${i} ${q.ba} `;
|
|
250
|
+
outputs += `-c:v:${i} libx264 -preset veryfast -tune fastdecode -b:v:${i} ${q.bv} -s:v:${i} ${q.w}x${q.h} -c:a:${i} aac -b:a:${i} ${q.ba} `;
|
|
251
251
|
varStreamMapArr.push(`v:${i},a:${i}`);
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
+
// Generate encoded segment name with timestamp
|
|
255
|
+
const timestamp = Date.now();
|
|
256
|
+
const encodedPrefix = Buffer.from(`txa_${timestamp}`).toString('base64').replace(/[^a-zA-Z0-9]/g, '').substring(0, 8);
|
|
257
|
+
|
|
254
258
|
const ffmpegCmd = [
|
|
255
|
-
`"${FFMPEG_BIN}"`, '-i', `"${mp4Path}"`,
|
|
259
|
+
`"${FFMPEG_BIN}"`, '-i', `"${mp4Path}"`,
|
|
260
|
+
'-threads 0', '-preset ultrafast', '-tune fastdecode',
|
|
256
261
|
maps,
|
|
257
262
|
outputs,
|
|
258
263
|
'-var_stream_map', `"${varStreamMapArr.join(' ')}"`,
|
|
259
264
|
'-master_pl_name', `"${masterName}"`,
|
|
260
|
-
'-f hls -hls_time
|
|
261
|
-
'-hls_segment_filename', `"${outDir}/%v
|
|
265
|
+
'-f hls -hls_time 4 -hls_list_size 0 -hls_segment_type mpegts',
|
|
266
|
+
'-hls_segment_filename', `"${outDir}/%v/${encodedPrefix}_%04d.ts"`,
|
|
262
267
|
`"${outDir}/%v/index.m3u8"`
|
|
263
268
|
].join(' ');
|
|
264
269
|
|
|
265
270
|
execSync(ffmpegCmd, { stdio: 'inherit', ...SHELL_OPTS });
|
|
266
|
-
console.log('
|
|
271
|
+
console.log(' HLS Master generated.');
|
|
267
272
|
|
|
268
273
|
// --- BƯỚC 2.1: XUẤT 3GP CHO MÁY CỔ (NOKIA S40/S60) ---
|
|
274
|
+
console.log(' [2.1/5] Exporting 3GP legacy format...');
|
|
269
275
|
console.log(' 📱 [2.1/5] Exporting 3GP legacy format...');
|
|
270
276
|
const nokiaCmd = `"${FFMPEG_BIN}" -i "${mp4Path}" -s 320x240 -vcodec mpeg4 -acodec aac -ar 16000 -ac 1 -b:v 250k -b:a 32k -f 3gp "${nokia3gpPath}"`;
|
|
271
277
|
try {
|
|
@@ -320,7 +326,26 @@ export async function executePipeline({ input, slug, title, langArg = 'vi' }) {
|
|
|
320
326
|
|
|
321
327
|
// ─── BƯỚC 5: Upload Tebi.io ─────────────────────────────────── // --- STEP 5: UPLOAD ---
|
|
322
328
|
console.log('\n🚀 [5/5] Deploying to Quantum Cloud (Tebi.io)...');
|
|
323
|
-
|
|
329
|
+
|
|
330
|
+
// Optimize upload with parallel processing
|
|
331
|
+
const uploadCmd = `node ${path.join(__dirname, 'scripts', 'upload-tebi.mjs')} "${slug}"`;
|
|
332
|
+
|
|
333
|
+
// Run upload with higher process priority and optimized settings
|
|
334
|
+
try {
|
|
335
|
+
execSync(uploadCmd, {
|
|
336
|
+
stdio: 'inherit',
|
|
337
|
+
cwd: process.cwd(),
|
|
338
|
+
maxBuffer: 1024 * 1024, // Increase buffer size
|
|
339
|
+
env: {
|
|
340
|
+
...process.env,
|
|
341
|
+
NODE_OPTIONS: '--max-old-space-size=4096', // Optimize Node.js memory
|
|
342
|
+
UV_THREADPOOL_SIZE: '16' // Increase libuv thread pool
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
} catch (uploadError) {
|
|
346
|
+
console.error(' ⚠ Upload failed:', uploadError.message);
|
|
347
|
+
throw uploadError;
|
|
348
|
+
}
|
|
324
349
|
|
|
325
350
|
// --- FINAL STEP: GENERATE MASTER README.md ---
|
|
326
351
|
const finalReadmePath = path.join('hls', slug, 'README.md');
|
package/pro-terminal.mjs
CHANGED
|
@@ -111,7 +111,7 @@ function showHelp() {
|
|
|
111
111
|
)
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
console.log(chalk.gray(' ⚡
|
|
114
|
+
console.log(chalk.gray(' ⚡ TPHIM ULTIMATE VIDEO CORE v2.0.2 | STATUS: READY ⚡\n'));
|
|
115
115
|
|
|
116
116
|
console.log(`${neonPurple('📖 CÁCH SỬ DỤNG:')}`);
|
|
117
117
|
console.log(chalk.cyan(' ntxa help - Hiển thị help này'));
|
|
@@ -124,19 +124,21 @@ function showHelp() {
|
|
|
124
124
|
console.log(chalk.cyan(' TEBI_ACCESS_KEY_ID - Access key'));
|
|
125
125
|
console.log(chalk.cyan(' TEBI_SECRET_ACCESS_KEY - Secret key'));
|
|
126
126
|
console.log(chalk.cyan(' TEBI_BUCKET - Bucket name'));
|
|
127
|
-
console.log(chalk.cyan(' TEBI_PUBLIC_URL - Public URL
|
|
127
|
+
console.log(chalk.cyan(' TEBI_PUBLIC_URL - Public URL'));
|
|
128
|
+
console.log(chalk.cyan(' PROXY_LIST - Danh sách proxy (ip:port:user:pass|...)'));
|
|
128
129
|
|
|
129
130
|
console.log(`${neonPurple('⚡ TÍNH NĂNG:')}`);
|
|
130
131
|
console.log(chalk.cyan(' • Download video từ multiple sources'));
|
|
131
|
-
console.log(chalk.cyan(' • Transcode
|
|
132
|
+
console.log(chalk.cyan(' • Transcode HLS 4-6 qualities'));
|
|
132
133
|
console.log(chalk.cyan(' • AI Subtitle generation (Whisper)'));
|
|
133
134
|
console.log(chalk.cyan(' • Upload cloud storage (Tebi.io)'));
|
|
134
135
|
console.log(chalk.cyan(' • Batch processing support'));
|
|
135
|
-
console.log(chalk.cyan(' •
|
|
136
|
+
console.log(chalk.cyan(' • Proxy rotation tự động'));
|
|
137
|
+
console.log(chalk.cyan(' • Encoded segment names (base64)'));
|
|
136
138
|
|
|
137
139
|
console.log(`${neonPurple('👤 DEVELOPER:')}`);
|
|
138
140
|
console.log(chalk.cyan(' TXA - Ultimate Video Pipeline 2030'));
|
|
139
|
-
console.log(chalk.gray(' Licensed under ISC
|
|
141
|
+
console.log(chalk.gray(' Licensed under ISC - See LICENSE.md'));
|
|
140
142
|
|
|
141
143
|
console.log(`${neonPink('🚀 Ready to rock! Try: ntxa')}`);
|
|
142
144
|
}
|