PageSourceSearch

https://conversiontab.com/build/assets/resize-video-online-page-BHgcBdly.js

js conversiontab.com collected 2026-10-01 12:33:01 UTC 6,361 bytes, 1 lines download raw bytes

1import{f as Y}from"./ctMediaConvertDownload-n0-64pPl.js";import{w as j,c as G}from"./ctPendingDownload-Dt1VJrS4.js";import{i as J}from"./mediaInputFromFilename-AaKRjYpC.js";import{g as K}from"./ffmpegVideoCompress-C_zYTcnz.js";import{c as W,s as $}from"./fileDropzone-CA_uaFcV.js";import{c as Q,w as Z,V as ee}from"./videoToolRuntime-DN3EFO8-.js";import{s as te}from"./ctToast-CcYHdnwm.js";import{w as ie}from"./wireMediaToolPageOnce-DYtotjbx.js";import"./ctMediaProgressUi-wz6CtyvX.js";import"./ctFullscreenAd-wL9Ec5Hb.js";import"./app-Dsk0FNLH.js";import"./videoEncodeHints-B5HbAqTP.js";import"./transientNotice-Ds_di7lD.js";import"./mediaMetadataDisplay-rUX1VKD5.js";import"./ffmpegProbeDuration-CZSGPlSL.js";import"./videoToolFilePick-DVHx6tsU.js";import"./ffmpegWasmProbe-Dr2SB0y0.js";import"./videoToolFfmpegSession-vgvYnhrp.js";import"./ctMediaSourceOutputName-BkKiostT.js";const ne={sd:{w:640,h:480},hd:{w:1280,h:720},fhd:{w:1920,h:1080},fb_feed:{w:1280,h:720},ig_sq:{w:1080,h:1080},ig_portrait:{w:1080,h:1350},ig_stories:{w:1080,h:1920},yt:{w:1920,h:1080},yt_vert:{w:1080,h:1920}};function g(u){const e=document.getElementById("ctResizeVidToastBody"),s=document.getElementById("ctResizeVidToast");!e||!s||te(s,{bodyEl:e,message:u,delay:12e3})}function oe(u){if(!u||!/^\d+x\d+$/.test(u))return null;const[e,s]=u.split("x").map(y=>parseInt(y,10));return!e||!s?null:e/s}function R(u){const e=Math.floor(Number(u));if(!Number.isFinite(e)||e<16)return NaN;if(e%2===0)return e;const s=e-1;return s>=16?s:e+1}function x(u){let e=Math.round(Number(u));return Number.isFinite(e)?(e<16&&(e=16),e%2!==0&&(e+=1),e):NaN}function Re(){const u=document.getElementById("ct-resize-video-online-root");if(!ie(u,"ctResizeVidWired"))return;const e=(u.dataset.ctFormat||"mp4").toLowerCase(),s=document.getElementById("ctResizeVidFile"),y=document.getElementById("ctResizeVidDrop"),w=document.getElementById("ctResizeVidDropCaption"),r=document.getElementById("ctResizeVidPreview"),n=document.getElementById("ctResizeVidPreset"),D=document.getElementById("ctResizeVidCustomRow"),d=document.getElementById("ctResizeVidW"),c=document.getElementById("ctResizeVidH"),t=document.getElementById("ctResizeVidAspect"),T=document.getElementById("ctResizeVidAspectWrap"),E=document.getElementById("ctResizeVidName"),I=document.getElementById("ctResizeVidBtn"),B=document.getElementById("ctResizeVidDownload"),b=G();j(B,b);const V=document.getElementById("ctResizeVidClr"),O=document.getElementById("ctResizeVidWasmStatus"),k=document.getElementById("ctResizeVidMeta");if(!s||!r||!I||!V)return;const f=Q({statusEl:O,progressIds:{barId:"ctResizeVidProgBar",labelId:"ctResizeVidProgLabel",percentId:"ctResizeVidProgPct"},routeFormat:e,probeReadyLabel:"Ready to resize"}),{setProg:S}=f;let m=null,h=!1;const N=()=>{I.disabled=!f.currentFile||f.encodeInFlight},F=()=>{const i=((n==null?void 0:n.value)||"")==="custom";D&&D.classList.toggle("d-none",!i),T&&T.classList.toggle("d-none",!i),t&&(t.disabled=!i,i||(t.checked=!1)),h=!!(i&&(t!=null&&t.checked)&&m)},_=()=>{m||!(r!=null&&r.videoWidth)||!(r!=null&&r.videoHeight)||(m=r.videoWidth/r.videoHeight,F())};n==null||n.addEventListener("change",()=>{(n==null?void 0:n.value)==="custom"&&t&&(t.checked=!0),F()}),t==null||t.addEventListener("change",()=>{h=!!((n==null?void 0:n.value)==="custom"&&(t!=null&&t.checked)&&m)});const H=()=>{const o=parseInt(String((d==null?void 0:d.value)||""),10),i=parseInt(String((c==null?void 0:c.value)||""),10);return{w:o,h:i}},U=()=>{if(!h||!m||!c||!d)return;const o=parseInt(String(d.value||""),10);if(!Number.isFinite(o)||o<=0)return;const i=R(o);Number.isFinite(i)&&d.value!==String(i)&&(d.value=String(i));const v=Number.isFinite(i)?i:o;c.value=String(x(v/m))},q=()=>{if(!h||!m||!c||!d)return;const o=parseInt(String(c.value||""),10);if(!Number.isFinite(o)||o<=0)return;const i=R(o);Number.isFinite(i)&&c.value!==String(i)&&(c.value=String(i));const v=Number.isFinite(i)?i:o;d.value=String(x(v*m))};d==null||d.addEventListener("input",()=>{h=!!((n==null?void 0:n.value)==="custom"&&(t!=null&&t.checked)&&m),h&&U()}),c==null||c.addEventListener("input",()=>{h=!!((n==null?void 0:n.value)==="custom"&&(t!=null&&t.checked)&&m),h&&q()}),F();const M=()=>{m=null,d&&(d.value=""),c&&(c.value=""),F()};Z({fileEl:s,dropEl:y,dropCaptionEl:w,runtime:f,clearBtn:V,nameInput:E,preview:r,metaEl:k,onEmpty:()=>{M(),$(s,y,w),N()},onTooLarge:()=>{g("File size exceeds the 500MB limit."),W(s,{drop:y,captionEl:w})},onProbeFailed:()=>{g("Failed to read video metadata.")},onReady:({metadata:o})=>{m=oe(o.resolution),_(),F(),N()}}),r==null||r.addEventListener("loadedmetadata",()=>{_()}),V.addEventListener("click",()=>{b.clear(),b.syncDownloadButton(B),W(s,{notify:!1,drop:y,captionEl:w}),V.disabled=!0,E&&(E.value="resized_video"),M(),f.clearPickState({preview:r,metaEl:k}),$(s,y,w),N()}),I.addEventListener("click",async()=>{var A;const o=f.currentFile;if(!o)return;if(o.size>ee){g("File size exceeds the 500MB limit.");return}const i=(n==null?void 0:n.value)||"sd";let v;if(i==="custom"){const a=!!(t!=null&&t.checked),{w:l,h:z}=H();if(a){if(!Number.isFinite(l)||l<16){g("Enter a valid custom width (min 16).");return}const p=R(l);if(!Number.isFinite(p)){g("Enter a valid custom width (min 16).");return}v=`scale=${p}:-2`}else{if(!Number.isFinite(l)||!Number.isFinite(z)||l<16||z<16){g("Enter valid custom width and height (min 16).");return}const p=R(l),L=R(z);if(!Number.isFinite(p)||!Number.isFinite(L)){g("Enter valid custom width and height (min 16).");return}v=`scale=${p}:${L}`}}else{const a=ne[i];
1if(!a){g("Choose a preset size.");return}v=`scale=${a.w}:${a.h}`}const P=f.inputNameFor(o),C=f.outputName(),X=K(e,f.metadata);b.clear(),b.syncDownloadButton(B),I.disabled=!0;try{const a=await f.runEncode({inName:P,args:["-y","-loglevel","warning","-stats","-i",P,"-vf",v,...X,C],encodingLabel:"Resizing…"}),l=await a.readFile(C),z=l.buffer?l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength):l,p=new Blob([z],{type:`video/${e}`}),L=((E==null?void 0:E.value)||"resized_video").replace(/[^\w\-]+/g,"_");await Y(b,B,{blob:p,filename:`${L}.${e}`,progressUi:(A=f.setProg)==null?void 0:A.ui});try{await a.deleteFile(P),await a.deleteFile(C)}catch{}}catch(a){J(a)||g(a instanceof Error?a.message:"Resize failed."),S==null||S.ui.hardReset("Ready to resize")}finally{N()}})}export{Re as initResizeVideoOnlinePage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.