Files
adaptive-video-converter/bin/cli.js

82 lines
49 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
import{createRequire as FF}from"node:module";var tu=Object.create;var{getPrototypeOf:eu,defineProperty:gD,getOwnPropertyNames:DF}=Object;var uF=Object.prototype.hasOwnProperty;var e=(D,u,F)=>{F=D!=null?tu(eu(D)):{};let E=u||!D||!D.__esModule?gD(F,"default",{value:D,enumerable:!0}):F;for(let C of DF(D))if(!uF.call(E,C))gD(E,C,{get:()=>D[C],enumerable:!0});return E};var V=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var f=FF(import.meta.url);var Eu=V((f3,Fu)=>{class uu{constructor(D,u,F){this.etaBufferLength=D||100,this.valueBuffer=[F],this.timeBuffer=[u],this.eta="0"}update(D,u,F){this.valueBuffer.push(u),this.timeBuffer.push(D),this.calculate(F-u)}getTime(){return this.eta}calculate(D){let u=this.valueBuffer.length,F=Math.min(this.etaBufferLength,u),E=this.valueBuffer[u-1]-this.valueBuffer[u-F],C=this.timeBuffer[u-1]-this.timeBuffer[u-F],A=E/C;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let B=Math.ceil(D/A/1000);if(isNaN(B))this.eta="NULL";else if(!isFinite(B))this.eta="INF";else if(B>1e7)this.eta="INF";else if(B<0)this.eta=0;else this.eta=B}}Fu.exports=uu});var QD=V((g3,Bu)=>{var c=f("readline");class Cu{constructor(D){this.stream=D,this.linewrap=!0,this.dy=0}cursorSave(){if(!this.stream.isTTY)return;this.stream.write("\x1B7")}cursorRestore(){if(!this.stream.isTTY)return;this.stream.write("\x1B8")}cursor(D){if(!this.stream.isTTY)return;if(D)this.stream.write("\x1B[?25h");else this.stream.write("\x1B[?25l")}cursorTo(D=null,u=null){if(!this.stream.isTTY)return;c.cursorTo(this.stream,D,u)}cursorRelative(D=null,u=null){if(!this.stream.isTTY)return;this.dy=this.dy+u,c.moveCursor(this.stream,D,u)}cursorRelativeReset(){if(!this.stream.isTTY)return;c.moveCursor(this.stream,0,-this.dy),c.cursorTo(this.stream,0,null),this.dy=0}clearRight(){if(!this.stream.isTTY)return;c.clearLine(this.stream,1)}clearLine(){if(!this.stream.isTTY)return;c.clearLine(this.stream,0)}clearBottom(){if(!this.stream.isTTY)return;c.clearScreenDown(this.stream)}newline(){this.stream.write(`
`),this.dy++}write(D,u=!1){if(this.linewrap===!0&&u===!1)this.stream.write(D.substr(0,this.getWidth()));else this.stream.write(D)}lineWrapping(D){if(!this.stream.isTTY)return;if(this.linewrap=D,D)this.stream.write("\x1B[?7h");else this.stream.write("\x1B[?7l")}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}}Bu.exports=Cu});var Zu=V((m3,Au)=>{Au.exports=({onlyFirst:D=!1}={})=>{let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(u,D?void 0:"g")}});var $u=V((c3,Yu)=>{var VF=Zu();Yu.exports=(D)=>typeof D==="string"?D.replace(VF(),""):D});var Ku=V((d3,qD)=>{var Ju=(D)=>{if(Number.isNaN(D))return!1;if(D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141))return!0;return!1};qD.exports=Ju;qD.exports.default=Ju});var Gu=V((l3,Xu)=>{Xu.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Uu=V((p3,zD)=>{var NF=$u(),RF=Ku(),xF=Gu(),_u=(D)=>{if(typeof D!=="string"||D.length===0)return 0;if(D=NF(D),D.length===0)return 0;D=D.replace(xF()," ");let u=0;for(let F=0;F<D.length;F++){let E=D.codePointAt(F);if(E<=31||E>=127&&E<=159)continue;if(E>=768&&E<=879)continue;if(E>65535)F++;u+=RF(E)?2:1}return u};zD.exports=_u;zD.exports.default=_u});var LD=V((n3,Wu)=>{Wu.exports=function(u,F,E){if(F.autopadding!==!0)return u;function C(A,B){return(F.autopaddingChar+A).slice(-B)}switch(E){case"percentage":return C(u,3);default:return u}}});var VD=V((s3,ku)=>{ku.exports=function(u,F){let E=Math.round(u*F.barsize),C=F.barsize-E;return F.barCompleteString.substr(0,E)+F.barGlue+F.barIncompleteString.substr(0,C)}});var ND=V((a3,Hu)=>{Hu.exports=function(u,F,E){function C(B){if(E)return E*Math.round(B/E);else return B}function A(B){return(F.autopaddingChar+B).slice(-2)}if(u>3600)return A(Math.floor(u/3600))+"h"+A(C(u%3600/60))+"m";else if(u>60)return A(Math.floor(u/60))+"m"+A(C(u%60))+"s";else if(u>10)return A(C(u))+"s";else return A(u)+"s"}});var RD=V((r3,Qu)=>{var IF=Uu(),OF=LD(),MF=VD(),wF=ND();Qu.exports=function(u,F,E){let C=u.format,A=u.formatTime||wF,B=u.formatValue||OF,Z=u.formatBar||MF,Y=Math.floor(F.progress*100)+"",K=F.stopTime||Date.now(),G=Math.round((K-F.startTime)/1000),$=Object.assign({},E,{bar:Z(F.progress,u),percentage:B(Y,u,"percentage"),total:B(F.total,u,"total"),value:B(F.value,u,"value"),eta:B(F.eta,u,"eta"),eta_formatted:A(F.eta,u,5),duration:B(G,u,"duration"),duration_formatted:A(G,u,1)});C=C.replace(/\{(\w+)\}/g,function(X,_){if(typeof $[_]<"u")return $[_];return X});let U=Math.max(0,F.maxWidth-IF(C)-2),J=Math.floor(U/2);switch(u.align){case"right":C=U>0?" ".repeat(U)+C:C;break;case"center":C=J>0?" ".repeat(J)+C:C;break;case"left":default:break}return C}});var BD=V((i3,qu)=>{function q(D,u){if(typeof D>"u"||D===null)return u;else return D}qu.exports={parse:function(u,F){let E={},C=Object.assign({},F,u);return E.throttleTime=1000/q(C.fps,10),E.stream=q(C.stream,process.stderr),E.terminal=q(C.terminal,null),E.clearOnComplete=q(C.clearOnComplete,!1),E.stopOnComplete=q(C.stopOnComplete,!1),E.barsize=q(C.barsize,40),E.align=q(C.align,"left"),E.hideCursor=q(C.hideCursor,!1),E.linewrap=q(C.linewrap,!1),E.barGlue=q(C.barGlue,""),E.barCompleteChar=q(C.barCompleteChar,"="),E.barIncompleteChar=q(C.barIncompleteChar,"-"),E.format=q(C.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),E.formatTime=q(C.formatTime,null),E.formatValue=q(C.formatValue,null),E.formatBar=q(C.formatBar,null),E.etaBufferLength=q(C.etaBuffer,10),E.etaAsynchronousUpdate=q(C.etaAsynchronousUpdate,!1),E.progressCalculationRelative=q(C.progressCalculationRelative,!1),E.synchronousUpdate=q(C.synchronousUpdate,!0),E.noTTYOutput=q(C.noTTYOutput,!1),E.notTTYSchedule=q(C.notTTYSchedule,2000),E.emptyOnZero=q(C.emptyOnZero,!1),E.forceRedraw=q(C.forceRedraw,!1),E.autopadding=q(C.autopadding,!1),E.gracefulExit=q(C.gracefulExit,!1),E},assignDerivedOptions:function(u){return u.barCompleteString=u.barCompleteChar.repeat(u.barsize+1),u.barIncompleteString=u.barIncompleteChar.repeat(u.barsize+1),u.autopaddingChar=u.autopadding?q(u.autopaddingChar," "):"",u}}});var xD=V((o3,Lu)=>{var zu=Eu(),jF=QD(),bF=RD(),SF=BD(),TF=f("events");Lu.exports=class extends TF{constructor(u){super();this.options=SF.assignDerivedOptions(u),this.terminal=this.options.terminal?this.options.terminal:new jF(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new zu(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format==="function"?this.options.format:bF}render(u=!1){let F={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};if(this.options.etaAsynchronousUpdate)this.updateETA();let E=this.formatter(this.options,F,this.payload);if(u||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=E)this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(E),this.terminal.clearRight(),this.lastDrawnString=E,this.lastRedraw=Date.now(),this.emit("redraw-post")}start(u,F,E){this.value=F||0,this.total=typeof u<"u"&&u>=0?u:100,this.startValue=F||0,this.payload=E||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new zu(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",u,F)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(u,F={}){if(typeof u==="number")this.value=u,this.eta.update(Date.now(),u,this.total);let E=(typeof u==="object"?u:F)||{};this.emit("update",this.total,this.value);for(let C in E)this.payload[C]=E[C];if(this.value>=this.getTotal()&&this.options.stopOnComplete)this.stop()}getProgress(){let u=this.value/this.total;if(this.options.progressCalculationRelative)u=(this.value-this.startValue)/(this.total-this.startValue);if(isNaN(u))u=this.options&&this.options.emptyOnZero?0:1;return u=Math.min(Math.max(u,0),1),u}increment(u=1,F={}){if(typeof u==="object")this.update(this.value+1,u);else this.update(this.value+u,F)}getTotal(){return this.total}setTotal(u){if(typeof u<"u"&&u>=0)this.total=u}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var Nu=V((t3,Vu)=>{var yF=xD(),vF=BD();Vu.exports=class extends yF{constructor(u,F){super(vF.parse(u,F));if(this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1)this.options.synchronousUpdate=!1;this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){if(this.timer)clearTimeout(this.timer),this.timer=null;if(super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1)this.terminal.newline();this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(u,F){if(!this.timer)return;if(super.update(u,F),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now())this.render()}start(u,F,E){if(this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1)return;if(this.sigintCallback===null&&this.options.gracefulExit)this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback);if(this.terminal.cursorSave(),this.options.hideCursor===!0)this.terminal.cursor(!1);if(this.options.linewrap===!1)this.terminal.lineWrapping(!1);super.start(u,F,E),this.render()}stop(){if(!this.timer)return;if(this.sigintCallback)process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null;if(this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0)this.terminal.cursor(!0);if(this.options.linewrap===!1)this.terminal.lineWrapping(!0);if(this.terminal.cursorRestore(),this.options.clearOnComplete)this.terminal.cursorTo(0,null),this.terminal.clearLine();else this.terminal.newline()}}});var xu=V((e3,Ru)=>{var hF=QD(),PF=xD(),fF=BD(),gF=f("events");Ru.exports=class extends gF{constructor(u,F){super();this.bars=[],this.options=fF.parse(u,F),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new hF(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(u,F,E,C={}){let A=new PF(Object.assign({},this.options,{terminal:this.terminal},C));if(this.bars.push(A),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1)return A;if(this.sigintCallback===null&&this.options.gracefulExit)this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback);if(!this.isActive){if(this.options.hideCursor===!0)this.terminal.cursor(!1);if(this.options.linewrap===!1)this.terminal.lineWrapping(!1);this.timer=setTimeout(this.update.bind(this),this.schedulingRate)}return this.isActive=!0,A.start(u,F,E),this.emit("start"),A}remove(u){let F=this.bars.indexOf(u);if(F<0)return!1;return this.bars.splice(F,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0}update(){if(this.timer)clearTimeout(this.timer),this.timer=null;if(this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0){this.terminal.clearLine();while(this.loggingBuffer.length>0)this.terminal.write(this.loggingBuffer.shift(),!0)}for(let u=0;u<this.bars.length;u++){if(u>0)this.terminal.newline();this.bars[u].render()}if(this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1)this.terminal.newline(),this.terminal.newline();if(this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find((u)=>u.isActive))this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback)process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null;if(this.isActive=!1,this.options.hideCursor===!0)this.terminal.cursor(!0);if(this.options.linewrap===!1)this.terminal.lineWrapping(!0);if(this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let u=0;u<this.bars.length;u++){if(u>0)this.terminal.newline();this.bars[u].render(),this.bars[u].stop()}this.terminal.newline()}this.emit("stop")}log(u){this.loggingBuffer.push(u)}}});var Ou=V((D8,Iu)=>{Iu.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var wu=V((u8,Mu)=>{Mu.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"█",barIncompleteChar:"░"}});var bu=V((F8,ju)=>{ju.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"█",barIncompleteChar:"░"}});var Tu=V((E8,Su)=>{Su.exports={format:" {bar}■ {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"■",barIncompleteChar:" "}});var vu=V((C8,yu)=>{var mF=Ou(),cF=wu(),dF=bu(),lF=Tu();yu.exports={legacy:mF,shades_classic:cF,shades_grey:dF,rect:lF}});var fu=V((B8,Pu)=>{var hu=Nu(),pF=xu(),nF=vu(),sF=RD(),aF=LD(),rF=VD(),iF=ND();Pu.exports={Bar:hu,SingleBar:hu,MultiBar:pF,Presets:nF,Format:{Formatter:sF,BarFormat:rF,ValueFormat:aF,TimeFormat:iF}}});import{join as CD,basename as tD,extname as eD}from"node:path";import{randomUUID as zF}from"node:crypto";import{rm as Du}from"node:fs/promises";import{spawn as p}from"node:child_process";import{appendFile as EF}from"node:fs/promises";var KD=null;function XD(D){KD=D}async function v(D){if(KD)try{await EF(KD,D,"utf-8")}catch(u){}}async function n(){return new Promise((D)=>{let u=p("ffmpeg",["-version"]);u.on("error",()=>D(!1)),u.on("close",(F)=>D(F===0))})}async function s(){return new Promise((D)=>{let u=p("MP4Box",["-version"]);u.on("error",()=>D(!1)),u.on("close",(F)=>D(F===0))})}async function a(){return new Promise((D)=>{let u=p("ffmpeg",["-hide_banner","-encoders"]),F="";u.stdout.on("data",(E)=>{F+=E.toString()}),u.on("error",()=>D(!1)),u.on("close",(E)=>{if(E!==0)D(!1);else D(F.includes("h264_nvenc")||F.includes("hevc_nvenc"))})})}async function r(){return new Promise((D)=>{let u=p("ffmpeg",["-hide_banner","-encoders"]),F="";u.stdout.on("data",(E)=>{F+=E.toString()}),u.on("error",()=>D({available:!1})),u.on("close",(E)=>{if(E!==0)D({available:!1});else if(F.includes("av1_nvenc"))D({available:!0,encoder:"av1_nvenc"});else if(F.includes("av1_qsv"))D({available:!0,encoder:"av1_qsv"});else if(F.includes("av1_amf"))D({available:!0,encoder:"av1_amf"});else D({available:!1})})})}async function g(D,u,F){let C=`
=== FFmpeg Command [${new Date().toISOString()}] ===
ffmpeg ${D.join(" ")}
`;return await v(C),new Promise((A,B)=>{let Z=p("ffmpeg",D),Y="";Z.stderr.on("data",(K)=>{let G=K.toString();if(Y+=G,u&&F){let $=G.match(/time=(\d{2}):(\d{2}):(\d{2}\.\d{2})/);if($){let U=parseInt($[1]),J=parseInt($[2]),X=parseFloat($[3]),_=U*3600+J*60+X,W=Math.min(100,_/F*100);u(W)}}}),Z.on("error",(K)=>{v(`ERROR: ${K.message}
`),B(Error(`FFmpeg error: ${K.message}`))}),Z.on("close",(K)=>{if(K===0)v(`SUCCESS: Exit code ${K}
`),A();else v(`FAILED: Exit code ${K}
${Y}
`),B(Error(`FFmpeg failed with exit code ${K}
${Y}`))})})}async function GD(D){let F=`
=== MP4Box Command [${new Date().toISOString()}] ===
MP4Box ${D.join(" ")}
`;return await v(F),new Promise((E,C)=>{let A=p("MP4Box",D),B="",Z="";A.stdout.on("data",(Y)=>{B+=Y.toString()}),A.stderr.on("data",(Y)=>{Z+=Y.toString()}),A.on("error",(Y)=>{v(`ERROR: ${Y.message}
`),C(Error(`MP4Box error: ${Y.message}`))}),A.on("close",(Y)=>{if(Y===0)v(`SUCCESS: Exit code ${Y}
`),E();else{let K=Z||B;v(`FAILED: Exit code ${Y}
${K}
`),C(Error(`MP4Box failed with exit code ${Y}
${K}`))}})})}import{spawn as CF}from"node:child_process";async function i(D){return new Promise((u,F)=>{let E=CF("ffprobe",["-v","error","-show_entries","stream=width,height,duration,r_frame_rate,codec_name,codec_type,bit_rate","-show_entries","format=duration","-of","json",D]),C="";E.stdout.on("data",(A)=>{C+=A.toString()}),E.on("error",(A)=>{F(Error(`ffprobe error: ${A.message}`))}),E.on("close",(A)=>{if(A!==0){F(Error(`ffprobe failed with exit code ${A}`));return}try{let B=JSON.parse(C),Z=B.streams.find((X)=>X.codec_type==="video"),Y=B.streams.find((X)=>X.codec_type==="audio"&&X.bit_rate),K=B.format;if(!Z){F(Error("No video stream found in input file"));return}let G=30;if(Z.r_frame_rate){let[X,_]=Z.r_frame_rate.split("/").map(Number);if(X&&_&&_!==0)G=X/_}let $=parseFloat(Z.duration||K.duration||"0"),U=Y?.bit_rate?Math.round(parseInt(Y.bit_rate)/1000):void 0,J=Z.bit_rate?Math.round(parseInt(Z.bit_rate)/1000):void 0;u({width:Z.width,height:Z.height,duration:$,fps:G,codec:Z.codec_name,audioBitrate:U,videoBitrate:J})}catch(B){F(Error(`Failed to parse ffprobe output: ${B}`))}})})}function uD(D,u=256){if(!D)return`${u}k`;let F=Math.min(D,u);if(F<=64)return"64k";if(F<=96)return"96k";if(F<=128)return"128k";if(F<=192)return"192k";return"256k"}function FD(D){let u=Math.floor(D/3600),F=Math.floor(D%3600/60),E=D%60;return`${String(u).padStart(2,"0")}:${String(F).padStart(2,"0")}:${E.toFixed(3).padStart(6,"0")}`}import{mkdir as BF,access as AF,constants as ZF}from"node:fs/promises";async function m(D){try{await AF(D,ZF.F_OK)}catch{await BF(D,{recursive:!0})}}function YF(D,u){let F=D*u;if(F<=230400)return 0.08;if(F<=409920)return 0.075;if(F<=921600)return 0.07;if(F<=2073600)return 0.065;if(F<=3686400)return 0.06;return 0.055}function y(D,u,F=30,E){let C=YF(D,u),A=Math.round(D*u*F*C/1000);if(E&&A>E)A=E;return`${A}k`}var _D=[{name:"360p",width:640,height:360,videoBitrate:y(640,360,30),audioBitrate:"192k"},{name:"480p",width:854,height:480,videoBitrate:y(854,480,30),audioBitrate:"192k"},{name:"720p",width:1280,height:720,videoBitrate:y(1280,720,30),audioBitrate:"192k"},{name:"1080p",width:1920,height:1080,videoBitrate:y(1920,1080,30),audioBitrate:"256k"},{name:"1440p",width:2560,height:1440,videoBitrate:y(2560,1440,30),audioBitrate:"256k"},{name:"2160p",width:3840,height:2160,videoBitrate:y(3840,2160,30),audioBitrate:"256k"}];function UD(D,u,F=30,E){let C=[],A=_D.filter((B)=>{return B.width<=D&&B.height<=u});for(let B of A)C.push({...B,videoBitrate:y(B.width,B.height,30,E),fps:30});return C}function $F(D,u,F){return{...D,name:`${D.name}-${u}`,videoBitrate:y(D.width,D.height,u,F),fps:u}}function mD(D){let F=D.trim().match(/^(\d+)p?(?:[@-](\d+))?$/i);if(!F)return null;let E=F[1]+"p",C=F[2]?parseInt(F[2]):30;return{resolution:E,fps:C}}function cD(D,u=30,F){let E=_D.find((C)=>C.name===D);if(!E)return null;if(u===30)return{...E,videoBitrate:y(E.width,E.height,30,F),fps:30};return $F(E,u,F)}function JF(D,u,F,E){let C=mD(D);if(!C)return{error:`Invalid profile format: ${D}. Use format like: 360, 720@60, 1080-60`};let A=cD(C.resolution,C.fps);if(!A)return{error:`Unknown resolution: ${C.resolution}. Available: 360, 480, 720, 1080, 1440, 2160`};if(A.width>u||A.height>F)return{error:`Source resolution (${u}x${F}) is lower than ${D} (${A.width}x${A.height})`};let B=120,Z=C.fps,Y;if(C.fps>E)Z=Math.min(E,B),Y=`Requested ${C.fps} FPS in ${D}, but source is ${E} FPS. Using ${Z} FPS instead`;else if(C.fps>B)Z=B,Y=`Requested ${C.fps} FPS in ${D} exceeds maximum ${B} FPS. Using ${Z} FPS instead`;return Y?{warning:Y,adjustedFps:Z}:{}}function dD(D,u,F,E,C){let A=[],B=[],Z=[];for(let Y of D){let K=JF(Y,u,F,E);if(K.error){B.push(K.error);continue}if(K.warning)Z.push(K.warning);let G=mD(Y);if(!G)continue;let $=K.adjustedFps!==void 0?K.adjustedFps:G.fps,U=cD(G.resolution,$,C);if(U)A.push(U)}return{profiles:A,errors:B,warnings:Z}}import{join as h}from"node:path";import{readdir as KF,unlink as lD,rmdir as XF,writeFile as pD}from"node:fs/promises";async function nD(D,u,F="00:00:01"){let E=h(u,"poster.jpg"),C=/^\d+(\.\d+)?$/.test(F)?F:F;return await g(["-ss",C,"-i",D,"-vframes","1","-q:v","2","-y",E]),E}async function sD(D,u,F,E){let{width:C,height:A,interval:B,columns:Z}=E,Y=h(u,".thumbnails_temp");await m(Y),await pD(h(Y,".keep"),"");let K=h(Y,"thumb_%04d.jpg");await g(["-i",D,"-vf",`fps=1/${B},scale=${C}:${A}`,"-q:v","5",K]);let $=(await KF(Y)).filter((R)=>R.startsWith("thumb_")&&R.endsWith(".jpg")).sort();if($.length===0)throw Error("No thumbnails generated");let U=$.length,J=Math.ceil(U/Z),X=h(u,"thumbnails.jpg"),_=`tile=${Z}x${J}`;await g(["-i",K,"-filter_complex",_,"-q:v","5",X]);let W=h(u,"thumbnails.vtt"),k=GF(U,B,C,A,Z,"thumbnails.jpg");await pD(W,k);for(let R of $)await lD(h(Y,R));return await lD(h(Y,".keep")),await XF(Y),{spritePath:X,vttPath:W}}function GF(D,u,F,E,C,A){let B=`WEBVTT
`;for(let Z=0;Z<D;Z++){let Y=Z*u,K=(Z+1)*u,G=Math.floor(Z/C),U=Z%C*F,J=G*E;B+=`${FD(Y)} --> ${FD(K)}
`,B+=`${A}#xywh=${U},${J},${F},${E}
`}return B}import{join as _F}from"node:path";function UF(D,u,F){if(F)if(u==="h264")return 32;else return 42;else if(u==="h264"){if(D<=360)return 25;if(D<=480)return 24;if(D<=720)return 23;if(D<=1080)return 22;if(D<=1440)return 21;return 20}else{if(D<=360)return 40;if(D<=480)return 38;if(D<=720)return 35;if(D<=1080)return 32;if(D<=1440)return 30;return 28}}async function aD(D,u,F,E,C,A,B,Z,Y,K,G,$){let U=_F(u,`video_${Y}_${F.name}.mp4`),J=["-y","-i",D,"-c:v",E],X=E.includes("nvenc")||E.includes("qsv")||E.includes("amf"),_;if(X&&K?.cq!==void 0)_=K.cq;else if(!X&&K?.crf!==void 0)_=K.crf;else _=UF(F.height,Y,X);if(E==="h264_nvenc")J.push("-rc:v","vbr"),J.push("-cq",String(_)),J.push("-preset",C),J.push("-2pass","0");else if(E==="av1_nvenc")J.push("-rc:v","vbr"),J.push("-cq",String(_)),J.push("-preset",C),J.push("-2pass","0");else if(E==="av1_qsv")J.push("-preset",C),J.push("-global_quality",String(_));else if(E==="av1_amf")J.push("-quality","balanced"),J.push("-rc","cqp"),J.push("-qp_i",String(_)),J.push("-qp_p",String(_));else if(E==="libsvtav1")J.push("-crf",String(_)),J.push("-preset",C),J.push("-svtav1-params","tune=0:enable-overlays=1");else if(E==="libx264")J.push("-crf",String(_)),J.push("-preset",C);else J.push("-preset",C);let W=Y==="av1"?0.6:1,k=Math.round(parseInt(F.videoBitrate)*W*1.5);J.push("-maxrate",`${k}k`),J.push("-bufsize",`${k*2}k`);let R=F.fps||30,N=Math.round(R*B);J.push("-g",String(N),"-keyint_min",String(N),"-sc_threshold","0");let H=[`scale=${F.width}:${F.height}`];if(G){if(G.deinterlace)H.push("yadif");if(G.denoise)H.push("hqdn3d");if(G.customFilters)H.push(...G.customFilters)}J.push("-vf",H.join(","));let T=parseInt(F.audioBitrate)||256,I=uD(Z,T);if(J.push("-c:a","aac","-b:a",I),G?.audioNormalize)J.push("-af","loudnorm");return J.push("-f","mp4",U),await g(J,$,A),U}async function rD(D,u,F,E,C,A,B,Z,Y,K,G,$,U,J){let X=new Map;if(Y&&F.length>1)for(let _=0;_<F.length;_+=K){let W=F.slice(_,_+K),k=W.map((N)=>aD(D,u,N,E,C,A,B,Z,G,$,U,(H)=>{if(J)J(N.name,H)}));(await Promise.all(k)).forEach((N,H)=>{let T=W[H];X.set(T.name,N)})}else for(let _ of F){let W=await aD(D,u,_,E,C,A,B,Z,G,$,U,(k)=>{if(J)J(_.name,k)});X.set(_.name,W)}return X}import{join as x}from"node:path";import{readFile as WF,writeFile as ED,readdir as WD,rename as kD,mkdir as iD}from"node:fs/promises";async function kF(D){let{readFile:u,writeFile:F}=await import("node:fs/promises"),C=(await u(D,"utf-8")).split(`
`),A=[],B=0;while(B<C.length){let Z=C[B];if(Z.includes("<AdaptationSet")&&Z.includes("maxWidth")){let Y=B,K=[Z],G=[],$=[],U=[],J=!1;B++;while(B<C.length&&!C[B].includes("</AdaptationSet>")){let X=C[B];if(X.includes("<SegmentTemplate"))J=!0;if(J){if(G.push(X),X.includes("</SegmentTemplate>"))J=!1}else if(X.includes("<Representation")&&X.includes("-h264"))$.push(X);else if(X.includes("<Representation")&&X.includes("-av1"))U.push(X);B++}if($.length>0&&U.length>0)A.push(Z),G.forEach((X)=>A.push(X)),$.forEach((X)=>A.push(X)),A.push(" </AdaptationSet>"),A.push(Z),G.forEach((X)=>A.push(X)),U.forEach((X)=>A.push(X)),A.push(" </AdaptationSet>");else{A.push(Z);for(let X=Y+1;X<B;X++)A.push(C[X]);A.push(C[B])}B++}else A.push(Z),B++}await F(D,A.join(`
`),"utf-8")}async function oD(D,u,F,E,C,A){let B=x(u,".temp_manifest.mpd"),Z=["-dash",String(E*1000),"-frag",String(E*1000),"-rap","-segment-timeline","-segment-name","$RepresentationID$_$Number$","-out",B],Y=!0;for(let[$,U]of D.entries())for(let J of F){let X=U.get(J.name);if(!X)throw Error(`MP4 file not found for profile: ${J.name}, codec: ${$}`);let _=C==="dual"?`${J.name}-${$}`:J.name;if(Z.push(`${X}#video:id=${_}`),Y)Z.push(`${X}#audio:id=audio`),Y=!1}await GD(Z),await HF(u,F,C);let K,G;if(A==="dash"||A==="both"){if(K=x(u,"manifest.mpd"),await kD(B,K),await QF(K,F,C),C==="dual")await kF(K)}if(A==="hls"||A==="both")G=await qF(u,F,E,C);try{let{unlink:$}=await import("node:fs/promises");await $(B)}catch{}return{manifestPath:K,hlsManifestPath:G}}async function HF(D,u,F){let E=[],C=[];if(F==="h264"||F==="dual")C.push("h264");if(F==="av1"||F==="dual")C.push("av1");for(let Z of C)for(let Y of u){let K=F==="dual"?`${Y.name}-${Z}`:Y.name;E.push(K);let G=x(D,K);await iD(G,{recursive:!0})}let A=x(D,"audio");await iD(A,{recursive:!0});let B=await WD(D);for(let Z of B){if(Z.endsWith(".mpd")||Z.endsWith(".m3u8")||!Z.includes("_"))continue;if(Z.startsWith("audio_")){let Y=x(D,Z),K=x(A,Z);await kD(Y,K);continue}for(let Y of E)if(Z.startsWith(`${Y}_`)){let K=x(D,Z),G=x(D,Y,Z);await kD(K,G);break}}}async function QF(D,u,F){let E=await WF(D,"utf-8");E=E.replace(/media="\$RepresentationID\$_\$Number\$\.m4s"/g,'media="$RepresentationID$/$RepresentationID$_$Number$.m4s"'),E=E.replace(/initialization="\$RepresentationID\$_\.mp4"/g,'initialization="$RepresentationID$/$RepresentationID$_.mp4"'),await ED(D,E,"utf-8")}async function qF(D,u,F,E){let C=x(D,"master.m3u8"),A=[];for(let $ of u){let U=E==="dual"?`${$.name}-h264`:$.name,J=x(D,U),X=await WD(J),_=X.filter((H)=>H.endsWith(".m4s")).sort((H,T)=>{let I=parseInt(H.match(/_(\d+)\.m4s$/)?.[1]||"0"),O=parseInt(T.match(/_(\d+)\.m4s$/)?.[1]||"0");return I-O}),W=X.find((H)=>H.endsWith("_.mp4"));if(!W||_.length===0)continue;let k=`#EXTM3U
`;k+=`#EXT-X-VERSION:6
`,k+=`#EXT-X-TARGETDURATION:${Math.ceil(F)}
`,k+=`#EXT-X-MEDIA-SEQUENCE:1
`,k+=`#EXT-X-INDEPENDENT-SEGMENTS
`,k+=`#EXT-X-MAP:URI="${W}"
`;for(let H of _)k+=`#EXTINF:${F},
`,k+=`${H}
`;k+=`#EXT-X-ENDLIST
`;let R=x(J,"playlist.m3u8");await ED(R,k,"utf-8");let N=parseInt($.videoBitrate)*1000;A.push({path:`${U}/playlist.m3u8`,bandwidth:N,resolution:`${$.width}x${$.height}`,fps:$.fps||30})}let B=x(D,"audio"),Z=await WD(B),Y=Z.filter(($)=>$.endsWith(".m4s")).sort(($,U)=>{let J=parseInt($.match(/_(\d+)\.m4s$/)?.[1]||"0"),X=parseInt(U.match(/_(\d+)\.m4s$/)?.[1]||"0");return J-X}),K=Z.find(($)=>$.endsWith("_.mp4"));if(K&&Y.length>0){let $=`#EXTM3U
`;$+=`#EXT-X-VERSION:6
`,$+=`#EXT-X-TARGETDURATION:${Math.ceil(F)}
`,$+=`#EXT-X-MEDIA-SEQUENCE:1
`,$+=`#EXT-X-INDEPENDENT-SEGMENTS
`,$+=`#EXT-X-MAP:URI="${K}"
`;for(let U of Y)$+=`#EXTINF:${F},
`,$+=`${U}
`;$+=`#EXT-X-ENDLIST
`,await ED(x(B,"playlist.m3u8"),$,"utf-8")}let G=`#EXTM3U
`;G+=`#EXT-X-VERSION:6
`,G+=`#EXT-X-INDEPENDENT-SEGMENTS
`,G+=`#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="audio",AUTOSELECT=YES,URI="audio/playlist.m3u8",CHANNELS="2"
`;for(let $ of A)G+=`#EXT-X-STREAM-INF:BANDWIDTH=${$.bandwidth},CODECS="avc1.4D4020,mp4a.40.2",RESOLUTION=${$.resolution},FRAME-RATE=${$.fps},AUDIO="audio"
`,G+=`${$.path}
`;return await ED(C,G,"utf-8"),C}async function HD(D){let{input:u,outputDir:F,segmentDuration:E=2,profiles:C,customProfiles:A,codec:B="dual",format:Z="both",useNvenc:Y,quality:K,generateThumbnails:G=!0,thumbnailConfig:$={},generatePoster:U=!0,posterTimecode:J="00:00:01",parallel:X=!0,onProgress:_}=D,W=CD("/tmp",`dash-converter-${zF()}`);await m(W);let k=tD(u,eD(u)),R=CD(F,k);await m(R);let N=CD(R,"conversion.log");XD(N);let{writeFile:H}=await import("node:fs/promises"),T=`===========================================
DASH Conversion Log
Started: ${new Date().toISOString()}
Input: ${u}
Output: ${R}
Codec: ${B}
Format: ${Z}
===========================================
`;await H(N,T,"utf-8");try{return await LF(u,F,W,E,C,A,B,Z,Y,K,G,$,U,J,X,_)}finally{let{appendFile:I}=await import("node:fs/promises");try{await I(N,`
Completed: ${new Date().toISOString()}
`,"utf-8")}catch(O){}try{await Du(W,{recursive:!0,force:!0})}catch(O){console.warn(`Warning: Failed to cleanup temp directory: ${W}`)}}}async function LF(D,u,F,E,C,A,B,Z,Y,K,G,$,U,J,X,_){if(!await n())throw Error("FFmpeg is not installed or not in PATH");if(!await s())throw Error("MP4Box is not installed or not in PATH. Install gpac package.");let W=(z,L,o,JD)=>{if(_)_({stage:z,percent:L,message:o,currentProfile:JD})};W("analyzing",0,"Analyzing input video...");let k=await i(D),R=Y!==!1?await a():!1,N=Y===!0?!0:Y===!1?!1:R;if(Y===!0&&!R)throw Error("NVENC requested but not available. Check NVIDIA drivers and GPU support.");let H;if(A&&A.length>0){let z=dD(A,k.width,k.height,k.fps,k.videoBitrate);if(z.errors.length>0){console.warn(`
❌ Profile errors:`);for(let L of z.errors)console.warn(` - ${L}`);console.warn("")}if(z.warnings.length>0){console.warn(`
⚠️ Profile warnings:`);for(let L of z.warnings)console.warn(` - ${L}`);console.warn("")}if(H=z.profiles,H.length===0)throw Error("No valid profiles found in custom list. Check errors above.")}else if(C)H=C;else H=UD(k.width,k.height,k.fps,k.videoBitrate);if(H.length===0)throw Error("No suitable profiles found for input video resolution");let T=tD(D,eD(D)),I=CD(u,T);try{await Du(I,{recursive:!0,force:!0})}catch(z){}await m(I);let O=[];if(B==="h264"||B==="dual"){let z=N?"h264_nvenc":"libx264",L=N?"p4":"medium";O.push({type:"h264",codec:z,preset:L})}if(B==="av1"||B==="dual"){let z=await r(),L=z.available?z.encoder:"libsvtav1",o=z.available?L==="av1_nvenc"?"p4":"medium":"8";O.push({type:"av1",codec:L,preset:o})}let lu=O.map((z)=>z.type.toUpperCase()).join(" + ");W("analyzing",20,`Using ${lu} encoding (${N?"GPU":"CPU"})`,void 0);let pu=N?3:2,$D=new Map;for(let z=0;z<O.length;z++){let{type:L,codec:o,preset:JD}=O[z],vD=z/O.length,au=1/O.length;W("encoding",25+vD*40,`Stage 1: Encoding ${L.toUpperCase()} (${H.length} profiles)...`);let ru=L==="h264"?K?.h264:K?.av1,iu=await rD(D,F,H,o,JD,k.duration,E,k.audioBitrate,X,pu,L,ru,void 0,(t,hD)=>{let D3=H.findIndex((ou)=>ou.name===t),PD=25+vD*40,fD=hD/100*(40*au/H.length);if(W("encoding",PD+fD,`Encoding ${L.toUpperCase()} ${t}...`,`${L}-${t}`),_)_({stage:"encoding",percent:PD+fD,currentProfile:`${L}-${t}`,profilePercent:hD,message:`Encoding ${L.toUpperCase()} ${t}...`})});$D.set(L,iu)}W("encoding",65,"Stage 1 complete: All codecs and profiles encoded"),W("encoding",70,"Stage 2: Creating segments and manifests...");let{manifestPath:nu,hlsManifestPath:su}=await oD($D,I,H,E,B,Z),bD=[];for(let z of $D.values())bD.push(...Array.from(z.values()));W("encoding",80,"Stage 2 complete: All formats packaged");let SD,TD;if(G){W("thumbnails",80,"Generating thumbnail sprites...");let z={width:$.width||160,height:$.height||90,interval:$.interval||1,columns:$.columns||10},L=await sD(D,I,k.duration,z);SD=L.spritePath,TD=L.vttPath,W("thumbnails",90,"Thumbnails generated")}let yD;if(U)W("thumbnails",92,"Generating poster image..."),yD=await nD(D,I,J),W("thumbnails",95,"Poster generated");return W("manifest",95,"Finalizing..."),W("complete",100,"Conversion complete!"),{manifestPath:nu,hlsManifestPath:su,videoPaths:bD,thumbnailSpritePath:SD,thumbnailVttPath:TD,posterPath:yD,duration:k.duration,profiles:H,usedNvenc:N,codecType:B,format:Z}}var MD=e(fu(),1);import{statSync as oF}from"node:fs";var Q=process.argv.slice(2),ZD,YD,l="dual",d="both",jD=[],M,w,j,b;for(let D=0;D<Q.length;D++)if(Q[D]==="-r"||Q[D]==="--resolutions"){let u=[];for(let E=D+1;E<Q.length;E++){if(Q[E].startsWith("-"))break;u.push(Q[E]),D=E}ZD=u.join(",").split(/[,\s]+/).map((E)=>E.trim()).filter((E)=>E.length>0)}else if(Q[D]==="-p"||Q[D]==="--poster")YD=Q[D+1],D++;else if(Q[D]==="-c"||Q[D]==="--codec"){let u=Q[D+1];if(u==="av1"||u==="h264"||u==="dual")l=u;else console.error(`❌ Invalid codec: ${u}. Valid options: av1, h264, dual`),process.exit(1);D++}else if(Q[D]==="-f"||Q[D]==="--format"){let u=Q[D+1];if(u==="dash"||u==="hls"||u==="both")d=u;else console.error(`❌ Invalid format: ${u}. Valid options: dash, hls, both`),process.exit(1);D++}else if(Q[D]==="--h264-cq"){if(M=parseInt(Q[D+1]),isNaN(M)||M<0||M>51)console.error(`❌ Invalid H.264 CQ value: ${Q[D+1]}. Must be 0-51`),process.exit(1);D++}else if(Q[D]==="--h264-crf"){if(w=parseInt(Q[D+1]),isNaN(w)||w<0||w>51)console.error(`❌ Invalid H.264 CRF value: ${Q[D+1]}. Must be 0-51`),process.exit(1);D++}else if(Q[D]==="--av1-cq"){if(j=parseInt(Q[D+1]),isNaN(j)||j<0||j>51)console.error(`❌ Invalid AV1 CQ value: ${Q[D+1]}. Must be 0-51`),process.exit(1);D++}else if(Q[D]==="--av1-crf"){if(b=parseInt(Q[D+1]),isNaN(b)||b<0||b>63)console.error(`❌ Invalid AV1 CRF value: ${Q[D+1]}. Must be 0-63`),process.exit(1);D++}else if(!Q[D].startsWith("-"))jD.push(Q[D]);var DD=jD[0],gu=jD[1]||".";if(!DD)console.error("❌ Usage: dvc-cli <input-video> [output-dir] [options]"),console.error(`
Options:`),console.error(" -r, --resolutions Video resolutions (e.g., 360,480,720 or 720@60,1080@60)"),console.error(" -c, --codec Video codec: av1, h264, or dual (default: dual)"),console.error(" -f, --format Streaming format: dash, hls, or both (default: both)"),console.error(" -p, --poster Poster timecode (e.g., 00:00:05 or 10)"),console.error(`
Quality Options (override defaults):`),console.error(" --h264-cq <value> H.264 GPU CQ value (0-51, lower = better, default: auto)"),console.error(" --h264-crf <value> H.264 CPU CRF value (0-51, lower = better, default: auto)"),console.error(" --av1-cq <value> AV1 GPU CQ value (0-51, lower = better, default: auto)"),console.error(" --av1-crf <value> AV1 CPU CRF value (0-63, lower = better, default: auto)"),console.error(`
Examples:`),console.error(" dvc-cli video.mp4"),console.error(" dvc-cli video.mp4 ./output"),console.error(" dvc-cli video.mp4 -r 360,480,720"),console.error(" dvc-cli video.mp4 -c av1 --av1-cq 40"),console.error(" dvc-cli video.mp4 -c dual --h264-cq 30 --av1-cq 39"),console.error(" dvc-cli video.mp4 -f hls"),console.error(" dvc-cli video.mp4 -c dual -f both"),console.error(" dvc-cli video.mp4 -r 720@60,1080@60,2160@60 -c av1 -f dash"),console.error(" dvc-cli video.mp4 -p 00:00:05"),console.error(" dvc-cli video.mp4 ./output -r 720,1080 -c dual -f both -p 10 --h264-cq 28 --av1-cq 37"),process.exit(1);console.log(`\uD83D\uDD0D Checking system...
`);var mu=await n(),cu=await a(),wD=await r(),du=await s();console.log(`FFmpeg: ${mu?"✅":"❌"}`);console.log(`NVENC (H.264): ${cu?"✅ (GPU acceleration)":"⚠️ (CPU only)"}`);if(wD.available)console.log(`AV1 Encoder: ✅ ${wD.encoder} (GPU acceleration)`);else console.log("AV1 Encoder: ⚠️ (not available, will use CPU fallback)");console.log(`MP4Box: ${du?"✅":"❌"}
`);if(!mu)console.error("❌ FFmpeg not found. Please install FFmpeg first."),process.exit(1);if(!du)console.error("❌ MP4Box not found. Please install: sudo pacman -S gpac"),process.exit(1);if((l==="av1"||l==="dual")&&!wD.available)console.error("⚠️ Warning: AV1 encoding requested but no hardware AV1 encoder found."),console.error(" CPU-based AV1 encoding (libsvtav1) will be VERY slow."),console.error(` Consider using --codec h264 for faster encoding.
`);if((d==="hls"||d==="both")&&l==="av1")console.error("❌ Error: HLS format requires H.264 codec for Safari/iOS compatibility."),console.error(` Please use --codec h264 or --codec dual with --format hls
`),process.exit(1);console.log(`\uD83D\uDCCA Analyzing video...
`);var S=await i(DD),tF=oF(DD),eF=(tF.size/1048576).toFixed(2);console.log("\uD83D\uDCF9 Video Information:");console.log(` File: ${DD}`);console.log(` Size: ${eF} MB`);console.log(` Resolution: ${S.width}x${S.height}`);console.log(` FPS: ${S.fps.toFixed(2)}`);console.log(` Duration: ${Math.floor(S.duration/60)}m ${Math.floor(S.duration%60)}s`);console.log(` Codec: ${S.codec}`);if(S.videoBitrate)console.log(` Video Bitrate: ${(S.videoBitrate/1000).toFixed(2)} Mbps`);if(S.audioBitrate)console.log(` Audio Bitrate: ${S.audioBitrate} kbps`);console.log(`
\uD83D\uDCC1 Output: ${gu}`);console.log(`\uD83C\uDFAC Codec: ${l}${l==="dual"?" (AV1 + H.264 for maximum compatibility)":""}`);console.log(`\uD83D\uDCFA Format: ${d}${d==="both"?" (DASH + HLS for maximum compatibility)":d==="hls"?" (H.264 only for Safari/iOS)":""}`);if(ZD)console.log(`\uD83C\uDFAF Custom profiles: ${ZD.join(", ")}`);if(YD)console.log(`\uD83D\uDDBC Poster timecode: ${YD}`);var P;if(M!==void 0||w!==void 0||j!==void 0||b!==void 0){if(P={},M!==void 0||w!==void 0){if(P.h264={},M!==void 0)P.h264.cq=M;if(w!==void 0)P.h264.crf=w;console.log(`\uD83C\uDF9A H.264 Quality: ${M!==void 0?`CQ ${M}`:""}${w!==void 0?` CRF ${w}`:""}`)}if(j!==void 0||b!==void 0){if(P.av1={},j!==void 0)P.av1.cq=j;if(b!==void 0)P.av1.crf=b;console.log(`\uD83C\uDF9A AV1 Quality: ${j!==void 0?`CQ ${j}`:""}${b!==void 0?` CRF ${b}`:""}`)}}console.log(`
\uD83D\uDE80 Starting conversion...
`);var AD=new MD.default.MultiBar({format:"{stage} | {bar} | {percentage}% | {name}",barCompleteChar:"█",barIncompleteChar:"░",hideCursor:!0,clearOnComplete:!1,stopOnComplete:!0},MD.default.Presets.shades_classic),ID={},OD=null;try{let D=await HD({input:DD,outputDir:gu,customProfiles:ZD,posterTimecode:YD,codec:l,format:d,segmentDuration:2,useNvenc:cu,quality:P,generateThumbnails:!0,generatePoster:!0,parallel:!0,onProgress:(u)=>{let F=u.stage==="encoding"?"Encoding":u.stage==="thumbnails"?"Thumbnails":u.stage==="manifest"?"Manifest":u.stage==="analyzing"?"Analyzing":"Complete";if(u.stage==="encoding"&&u.currentProfile){if(!ID[u.currentProfile])ID[u.currentProfile]=AD.create(100,0,{stage:"Encode",name:u.currentProfile});let E=u.profilePercent??u.percent;ID[u.currentProfile].update(E,{stage:"Encode",name:u.currentProfile})}if(!OD)OD=AD.create(100,0,{stage:F,name:"Overall"});OD.update(u.percent,{stage:F,name:u.message||"Overall"})}});if(AD.stop(),console.log(`
✅ Conversion completed successfully!
`),console.log("\uD83D\uDCCA Results:"),D.manifestPath)console.log(` DASH Manifest: ${D.manifestPath}`);if(D.hlsManifestPath)console.log(` HLS Manifest: ${D.hlsManifestPath}`);if(console.log(` Duration: ${D.duration.toFixed(2)}s`),console.log(` Profiles: ${D.profiles.map((u)=>u.name).join(", ")}`),console.log(` Format: ${D.format}`),console.log(` Codec: ${D.codecType}${D.codecType==="dual"?" (AV1 + H.264)":""}`),console.log(` Encoder: ${D.usedNvenc?"⚡ GPU accelerated":"\uD83D\uDD27 CPU"}`),D.posterPath)console.log(` Poster: ${D.posterPath}`);if(D.thumbnailSpritePath)console.log(` Thumbnails: ${D.thumbnailSpritePath}`),console.log(` VTT file: ${D.thumbnailVttPath}`);console.log(`
\uD83C\uDF89 Done! You can now use the manifest file(s) in your video player.`)}catch(D){AD.stop(),console.error(`
❌ Error during conversion:`),console.error(D),process.exit(1)}