xvai-loi 0.1.112 → 0.1.113

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.
Files changed (3) hide show
  1. package/co.txt +1 -1
  2. package/package.json +1 -1
  3. package/xvai-loi.js +11 -2
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi130025
1
+ xvaiLoi130036
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.112",
3
+ "version": "0.1.113",
4
4
  "description": "Loi dung video (Edit Video Tu Dong) nap vao tool Google Flow qua o cam engine/oCam.ts",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/xvai-loi.js CHANGED
@@ -19973,8 +19973,17 @@ async function tangTocVideo(blob, k, bao) {
19973
19973
  ff.on("progress", ({ time }) => {
19974
19974
  if (dai2 > 0) bao?.("B\u01B0\u1EDBc 1 \xB7 t\u1ED1c \u0111\u1ED9 l\u1EDDi \xD7" + k.toFixed(2) + ": " + Math.min(99, Math.round(100 * (time / 1e6) * k / dai2)) + "%");
19975
19975
  });
19976
+ let tin = 0, tra = 0;
19977
+ const gio = (x) => +x[1] * 3600 + +x[2] * 60 + +x[3];
19978
+ ff.on("log", ({ message: m }) => {
19979
+ let x = /Duration: (\d+):(\d+):([\d.]+)/.exec(m);
19980
+ if (x && !tin) tin = gio(x);
19981
+ x = /time=(\d+):(\d+):([\d.]+)/.exec(m);
19982
+ if (x) tra = gio(x);
19983
+ });
19976
19984
  await ff.writeFile("vao.mp4", new Uint8Array(await blob.arrayBuffer()));
19977
19985
  let st = await ff.exec(["-itsscale", String(1 / k), "-i", "vao.mp4", "-i", "vao.mp4", "-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy", "-af", "atempo=" + k, "-c:a", "aac", "-b:a", "160k", "-movflags", "+faststart", "ra.mp4"]);
19986
+ if (st === 0 && tin > 0 && tra > 0 && Math.abs(tra - tin / k) > 0.3 + 0.01 * tin) st = 1;
19978
19987
  if (st !== 0) {
19979
19988
  bao?.("B\u01B0\u1EDBc 1 \xB7 ch\xE9p th\u1EB3ng kh\xF4ng \u0111\u01B0\u1EE3c \u2192 m\xE3 ho\xE1 l\u1EA1i h\xECnh (ch\u1EADm h\u01A1n)...");
19980
19989
  st = await ff.exec(["-i", "vao.mp4", "-filter_complex", "[0:v]setpts=PTS/" + k + "[v];[0:a]atempo=" + k + "[a]", "-map", "[v]", "-map", "[a]", "-c:v", "libx264", "-preset", "veryfast", "-crf", "20", "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "160k", "-movflags", "+faststart", "ra.mp4"]);
@@ -20667,7 +20676,7 @@ var StudioEdit = ({ project, setProject, exporting, blob, onExport, onDownload,
20667
20676
  try {
20668
20677
  t0.current = Date.now();
20669
20678
  setDoc("B\u01B0\u1EDBc 1 \xB7 t\u1ED1c \u0111\u1ED9 l\u1EDDi \xD7" + kC.toFixed(2) + "...");
20670
- const kT = "toc:" + String(sc.videoBase64).length + ":" + bamDem(String(sc.videoBase64).slice(0, 3e5)) + ":" + kC.toFixed(2);
20679
+ const kT = "toc2:" + String(sc.videoBase64).length + ":" + bamDem(String(sc.videoBase64).slice(0, 3e5)) + ":" + kC.toFixed(2);
20671
20680
  let b1 = null;
20672
20681
  try {
20673
20682
  const dT = await docDem(kT);
@@ -20998,7 +21007,7 @@ function datCauLenh(a) {
20998
21007
  on2 = true;
20999
21008
  window.addEventListener("message", async (ev) => {
21000
21009
  const d = ev.data;
21001
- if (!d || d.xvaiLoi130025 !== true) return;
21010
+ if (!d || d.xvaiLoi130036 !== true) return;
21002
21011
  const o = String(ev.origin || "");
21003
21012
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
21004
21013
  const tra = (kq) => {