GUI-STUDIO commited on
Commit ·
e32339f
1
Parent(s): 138cb9b
changes
Browse files- src/lib/ffmpeg.ts +11 -6
- src/sub-router/showtime.ts +16 -1
src/lib/ffmpeg.ts
CHANGED
|
@@ -1013,7 +1013,7 @@ async function F_build_ffmpeg_command_v3(arg0: {
|
|
| 1013 |
} = arg0;
|
| 1014 |
|
| 1015 |
let { playback_headers } = arg0;
|
| 1016 |
-
|
| 1017 |
// -------------------------------
|
| 1018 |
// Logging options
|
| 1019 |
// -------------------------------
|
|
@@ -1032,7 +1032,7 @@ async function F_build_ffmpeg_command_v3(arg0: {
|
|
| 1032 |
if (is_net_src) {
|
| 1033 |
command.push("-reconnect", "1");
|
| 1034 |
command.push("-reconnect_streamed", "1");
|
| 1035 |
-
command.push("-reconnect_delay_max", "
|
| 1036 |
|
| 1037 |
command.push("-rw_timeout", timeoutVal, "-timeout", timeoutVal);
|
| 1038 |
|
|
@@ -1107,7 +1107,7 @@ async function F_build_ffmpeg_command_v3(arg0: {
|
|
| 1107 |
command.push("-fflags", "+discardcorrupt+genpts+nobuffer");
|
| 1108 |
command.push("-err_detect", "ignore_err");
|
| 1109 |
|
| 1110 |
-
if(playback_type === 'hls') {
|
| 1111 |
command.push("-http_persistent", "1");
|
| 1112 |
}
|
| 1113 |
|
|
@@ -1341,7 +1341,7 @@ async function F_build_ffmpeg_command_v3(arg0: {
|
|
| 1341 |
/* ENCODING & TUNING */
|
| 1342 |
command.push("-tune", "zerolatency");
|
| 1343 |
command.push("-crf", "23");
|
| 1344 |
-
command.push("-preset", use_ultrafast ? "ultrafast" : "
|
| 1345 |
command.push("-pix_fmt", "yuv420p");
|
| 1346 |
command.push("-max_interleave_delta", "0");
|
| 1347 |
|
|
@@ -1458,6 +1458,7 @@ function F_stderr_data_read(arg0: { output: string }) {
|
|
| 1458 |
}
|
| 1459 |
|
| 1460 |
function F_format_duration(seconds?: number): string {
|
|
|
|
| 1461 |
if (typeof seconds !== "number") {
|
| 1462 |
return "";
|
| 1463 |
}
|
|
@@ -1468,13 +1469,17 @@ function F_format_duration(seconds?: number): string {
|
|
| 1468 |
const mins = Math.floor((seconds % 3600) / 60);
|
| 1469 |
const secs = Math.floor(seconds % 60);
|
| 1470 |
|
|
|
|
|
|
|
| 1471 |
if (hrs > 0) {
|
| 1472 |
-
|
| 1473 |
.toString()
|
| 1474 |
.padStart(2, "0")}`;
|
| 1475 |
} else {
|
| 1476 |
-
|
| 1477 |
}
|
|
|
|
|
|
|
| 1478 |
}
|
| 1479 |
|
| 1480 |
function F_format_size(bytes?: number) {
|
|
|
|
| 1013 |
} = arg0;
|
| 1014 |
|
| 1015 |
let { playback_headers } = arg0;
|
| 1016 |
+
|
| 1017 |
// -------------------------------
|
| 1018 |
// Logging options
|
| 1019 |
// -------------------------------
|
|
|
|
| 1032 |
if (is_net_src) {
|
| 1033 |
command.push("-reconnect", "1");
|
| 1034 |
command.push("-reconnect_streamed", "1");
|
| 1035 |
+
command.push("-reconnect_delay_max", "30");
|
| 1036 |
|
| 1037 |
command.push("-rw_timeout", timeoutVal, "-timeout", timeoutVal);
|
| 1038 |
|
|
|
|
| 1107 |
command.push("-fflags", "+discardcorrupt+genpts+nobuffer");
|
| 1108 |
command.push("-err_detect", "ignore_err");
|
| 1109 |
|
| 1110 |
+
if(playback_type === 'hls' || (typeof probe_data.format_name === 'string' && probe_data.format_name.includes("hls"))) {
|
| 1111 |
command.push("-http_persistent", "1");
|
| 1112 |
}
|
| 1113 |
|
|
|
|
| 1341 |
/* ENCODING & TUNING */
|
| 1342 |
command.push("-tune", "zerolatency");
|
| 1343 |
command.push("-crf", "23");
|
| 1344 |
+
command.push("-preset", use_ultrafast ? "ultrafast" : "ultrafast"); // ultrafast veryfast faster medium
|
| 1345 |
command.push("-pix_fmt", "yuv420p");
|
| 1346 |
command.push("-max_interleave_delta", "0");
|
| 1347 |
|
|
|
|
| 1458 |
}
|
| 1459 |
|
| 1460 |
function F_format_duration(seconds?: number): string {
|
| 1461 |
+
|
| 1462 |
if (typeof seconds !== "number") {
|
| 1463 |
return "";
|
| 1464 |
}
|
|
|
|
| 1469 |
const mins = Math.floor((seconds % 3600) / 60);
|
| 1470 |
const secs = Math.floor(seconds % 60);
|
| 1471 |
|
| 1472 |
+
let data = '';
|
| 1473 |
+
|
| 1474 |
if (hrs > 0) {
|
| 1475 |
+
data = `${hrs}:${mins.toString().padStart(2, "0")}:${secs
|
| 1476 |
.toString()
|
| 1477 |
.padStart(2, "0")}`;
|
| 1478 |
} else {
|
| 1479 |
+
data = `${mins}:${secs.toString().padStart(2, "0")}`;
|
| 1480 |
}
|
| 1481 |
+
|
| 1482 |
+
return data;
|
| 1483 |
}
|
| 1484 |
|
| 1485 |
function F_format_size(bytes?: number) {
|
src/sub-router/showtime.ts
CHANGED
|
@@ -480,7 +480,7 @@ async function F_handle_process(arg0: {
|
|
| 480 |
if (!log) continue;
|
| 481 |
|
| 482 |
// console.log(log, "\n");
|
| 483 |
-
|
| 484 |
if (log.toLowerCase().includes("error") || log.startsWith("[error]")) {
|
| 485 |
console.error("[ffmpeg log ERROR]", log, "\n");
|
| 486 |
logged_proc_errors.push(log);
|
|
@@ -525,6 +525,21 @@ async function F_handle_process(arg0: {
|
|
| 525 |
}
|
| 526 |
|
| 527 |
if (progress_update && Object.keys(progress_update).length > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 528 |
if (APP_ENV === "dev") {
|
| 529 |
console.log("[ffmpeg PROGRESS]:", { progress_update }, "\n");
|
| 530 |
}
|
|
|
|
| 480 |
if (!log) continue;
|
| 481 |
|
| 482 |
// console.log(log, "\n");
|
| 483 |
+
|
| 484 |
if (log.toLowerCase().includes("error") || log.startsWith("[error]")) {
|
| 485 |
console.error("[ffmpeg log ERROR]", log, "\n");
|
| 486 |
logged_proc_errors.push(log);
|
|
|
|
| 525 |
}
|
| 526 |
|
| 527 |
if (progress_update && Object.keys(progress_update).length > 0) {
|
| 528 |
+
(() => {
|
| 529 |
+
if(progress_update.video_duration && !progress_update.f_video_duration) {
|
| 530 |
+
let _: any = progress_update.video_duration;
|
| 531 |
+
if(typeof progress_update.video_duration !== 'string' && typeof progress_update.video_duration !== 'number') {
|
| 532 |
+
return
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
if(typeof progress_update.video_duration === 'string') {
|
| 536 |
+
_ = parseFloat(progress_update.video_duration)
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
progress_update.f_video_duration = NS_ffmpeg.F_format_duration(_);
|
| 540 |
+
}
|
| 541 |
+
})()
|
| 542 |
+
|
| 543 |
if (APP_ENV === "dev") {
|
| 544 |
console.log("[ffmpeg PROGRESS]:", { progress_update }, "\n");
|
| 545 |
}
|