GUI-STUDIO commited on
Commit ·
3b1112d
1
Parent(s): 9020b03
changes
Browse files- src/lib/ffmpeg.ts +10 -12
- src/sub-router/showtime.ts +6 -3
src/lib/ffmpeg.ts
CHANGED
|
@@ -39,8 +39,8 @@ hw_encoder =
|
|
| 39 |
|
| 40 |
console.log(`🚀 Using hardware encoder: ${hw_encoder}`);
|
| 41 |
|
| 42 |
-
const TIMEOUT_MS =
|
| 43 |
-
const PROBE_TIMEOUT_MS =
|
| 44 |
|
| 45 |
function get_hardware_encoder() {
|
| 46 |
return new Promise((resolve) => {
|
|
@@ -223,12 +223,17 @@ async function F_probe_v2(arg0: {
|
|
| 223 |
playback_url: URL;
|
| 224 |
playback_type?: string;
|
| 225 |
context?: Context;
|
|
|
|
| 226 |
file_mode?: {
|
| 227 |
path: string;
|
| 228 |
};
|
| 229 |
}) {
|
| 230 |
const { playback_url, context, file_mode } = arg0;
|
| 231 |
-
let { playback_headers } = arg0;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
if (!playback_headers) {
|
| 234 |
playback_headers = {};
|
|
@@ -369,7 +374,7 @@ async function F_probe_v2(arg0: {
|
|
| 369 |
// add the input flag and URL
|
| 370 |
command.push("-i", file_mode?.path || playback_url.href);
|
| 371 |
|
| 372 |
-
console.log("[PROBE CMD]", command, "\n");
|
| 373 |
|
| 374 |
const proc = Bun.spawn(command, {
|
| 375 |
stdout: "pipe",
|
|
@@ -1064,14 +1069,7 @@ async function F_build_ffmpeg_command_v3(arg0: {
|
|
| 1064 |
|
| 1065 |
// command.push("-rw_timeout", timeoutVal, "-timeout", timeoutVal);
|
| 1066 |
// command.push("-rw_timeout", timeoutVal);
|
| 1067 |
-
command.push(
|
| 1068 |
-
"-rw_timeout",
|
| 1069 |
-
timeoutVal,
|
| 1070 |
-
"-timeout",
|
| 1071 |
-
timeoutVal,
|
| 1072 |
-
"-stimeout",
|
| 1073 |
-
timeoutVal
|
| 1074 |
-
);
|
| 1075 |
|
| 1076 |
if (has_tcp_progress) {
|
| 1077 |
command.push("-multiple_requests", "1");
|
|
|
|
| 39 |
|
| 40 |
console.log(`🚀 Using hardware encoder: ${hw_encoder}`);
|
| 41 |
|
| 42 |
+
const TIMEOUT_MS = 20_000; // probe + transcode timeout
|
| 43 |
+
const PROBE_TIMEOUT_MS = 30_000; // probe + transcode timeout
|
| 44 |
|
| 45 |
function get_hardware_encoder() {
|
| 46 |
return new Promise((resolve) => {
|
|
|
|
| 223 |
playback_url: URL;
|
| 224 |
playback_type?: string;
|
| 225 |
context?: Context;
|
| 226 |
+
_log?: boolean;
|
| 227 |
file_mode?: {
|
| 228 |
path: string;
|
| 229 |
};
|
| 230 |
}) {
|
| 231 |
const { playback_url, context, file_mode } = arg0;
|
| 232 |
+
let { playback_headers, _log } = arg0;
|
| 233 |
+
|
| 234 |
+
if (typeof _log !== "boolean") {
|
| 235 |
+
_log = true;
|
| 236 |
+
}
|
| 237 |
|
| 238 |
if (!playback_headers) {
|
| 239 |
playback_headers = {};
|
|
|
|
| 374 |
// add the input flag and URL
|
| 375 |
command.push("-i", file_mode?.path || playback_url.href);
|
| 376 |
|
| 377 |
+
if (_log) console.log("[PROBE CMD]", command, "\n");
|
| 378 |
|
| 379 |
const proc = Bun.spawn(command, {
|
| 380 |
stdout: "pipe",
|
|
|
|
| 1069 |
|
| 1070 |
// command.push("-rw_timeout", timeoutVal, "-timeout", timeoutVal);
|
| 1071 |
// command.push("-rw_timeout", timeoutVal);
|
| 1072 |
+
command.push("-rw_timeout", timeoutVal, "-timeout", timeoutVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1073 |
|
| 1074 |
if (has_tcp_progress) {
|
| 1075 |
command.push("-multiple_requests", "1");
|
src/sub-router/showtime.ts
CHANGED
|
@@ -556,6 +556,8 @@ async function F_handle_process(arg0: {
|
|
| 556 |
} else if (last_failed) {
|
| 557 |
throw new Error("Something went wrong: with last try");
|
| 558 |
} else {
|
|
|
|
|
|
|
| 559 |
// CHECK DOCUMENTED FILES
|
| 560 |
const _file_data = await check_documented_file();
|
| 561 |
|
|
@@ -635,10 +637,13 @@ async function F_handle_process(arg0: {
|
|
| 635 |
promise: NS_ffmpeg.F_probe_v2({
|
| 636 |
playback_url: new URL(playback_url),
|
| 637 |
context: ctx as any,
|
| 638 |
-
playback_headers
|
|
|
|
| 639 |
})
|
| 640 |
});
|
| 641 |
|
|
|
|
|
|
|
| 642 |
if (E_ || !R_ || !R_.probe_data) {
|
| 643 |
const { status, message } = NS_error.F_collect_error_status_n_message({
|
| 644 |
ERR: E_
|
|
@@ -1579,8 +1584,6 @@ async function F_handle_process(arg0: {
|
|
| 1579 |
console.log("\n");
|
| 1580 |
console.log(
|
| 1581 |
`FFMPEG finished -> ${schemed_data?.current_filesize} ${tmp_download_path}`,
|
| 1582 |
-
"\n",
|
| 1583 |
-
bun_proc.resourceUsage(),
|
| 1584 |
"\n"
|
| 1585 |
);
|
| 1586 |
break;
|
|
|
|
| 556 |
} else if (last_failed) {
|
| 557 |
throw new Error("Something went wrong: with last try");
|
| 558 |
} else {
|
| 559 |
+
console.log("🪣 CHECKING BUCKET DB ...", "\n");
|
| 560 |
+
|
| 561 |
// CHECK DOCUMENTED FILES
|
| 562 |
const _file_data = await check_documented_file();
|
| 563 |
|
|
|
|
| 637 |
promise: NS_ffmpeg.F_probe_v2({
|
| 638 |
playback_url: new URL(playback_url),
|
| 639 |
context: ctx as any,
|
| 640 |
+
playback_headers,
|
| 641 |
+
_log: false
|
| 642 |
})
|
| 643 |
});
|
| 644 |
|
| 645 |
+
console.log("410 PROBE: ", { E_ }, { R_ });
|
| 646 |
+
|
| 647 |
if (E_ || !R_ || !R_.probe_data) {
|
| 648 |
const { status, message } = NS_error.F_collect_error_status_n_message({
|
| 649 |
ERR: E_
|
|
|
|
| 1584 |
console.log("\n");
|
| 1585 |
console.log(
|
| 1586 |
`FFMPEG finished -> ${schemed_data?.current_filesize} ${tmp_download_path}`,
|
|
|
|
|
|
|
| 1587 |
"\n"
|
| 1588 |
);
|
| 1589 |
break;
|