PageSourceSearch

https://conversiontab.com/build/assets/video-splitter-page-BSo4z-sL.js

js conversiontab.com collected 2026-09-24 10:07:11 UTC 6,894 bytes, 1 lines download raw bytes

1import{w as lt,c as ut}from"./ctPendingDownload-B21SXRKd.js";import{i as mt}from"./mediaInputFromFilename-AaKRjYpC.js";import{c as Y}from"./fileDropzone-CA_uaFcV.js";import{r as pt}from"./mediaMetadataDisplay-rUX1VKD5.js";import{s as tt}from"./ctToast-C2BAo121.js";import{d as ft}from"./ffmpegProbeDuration-CZSGPlSL.js";import{w as gt}from"./wireMediaToolPageOnce-DYtotjbx.js";import{c as yt,e as St,a as Et,C as Ft}from"./ctMediaProgressUi-wz6CtyvX.js";import{c as ht,w as It}from"./videoToolRuntime-BhBVPdre.js";import"./ctFullscreenAd-CL-AA_Ul.js";import"./app-gOHIPY12.js";import"./transientNotice-Ds_di7lD.js";import"./videoToolFilePick-DrReu7dZ.js";import"./ffmpegWasmProbe-Dr2SB0y0.js";import"./videoToolFfmpegSession-vgvYnhrp.js";import"./ctMediaSourceOutputName-BkKiostT.js";function Z(c){if(!Number.isFinite(c)||c<=0)return"0";const n=(Math.round(c*1e3)/1e3).toFixed(3).replace(/\.?0+$/,"");return n===""?"0":n}function z(c,e,n,b,B){return["-y","-ss",Z(n),"-i",c,"-t",Z(b),"-force_key_frames",`expr:gte(t,n_forced*${e})`,"-c","copy",B]}function D(c){const e=document.getElementById("ctVidSplToastBody"),n=document.getElementById("ctVidSplToast");!e||!n||tt(n,{bodyEl:e,message:c,delay:9e3})}function bt(c){const e=document.getElementById("ctVidSplToastOkBody"),n=document.getElementById("ctVidSplToastOk");!e||!n||tt(n,{bodyEl:e,message:c,delay:5e3})}const j=document.getElementById("ctVidSplReadyLabel"),w=yt({barId:"ctVidSplProgBar",labelId:"ctVidSplProgLabel",percentId:"ctVidSplProgPct"});function p(c,e=""){const n=Math.min(100,Math.max(0,c));if(j){const b=n<=0&&!e,B=typeof e=="string"&&e.toLowerCase().includes("done");b||n>=100||B?j.textContent="Ready to split":j.textContent=`Working… ${Math.round(n)}%`}if(n>=100){w(100,e);return}if(n<=0&&!e){w.ui.hardReset("Ready");return}if(n<=0){w.ui.beginEncoding(e);return}w(n,e)}function At(){const c=document.getElementById("ct-video-splitter-root");if(!gt(c,"ctVidSplWired"))return;const e=(c.dataset.ctFormat||"mp4").toLowerCase(),n=document.getElementById("ctVidSplFile"),b=document.getElementById("ctVidSplDrop"),B=document.getElementById("ctVidSplDropCaption"),r=document.getElementById("ctVidSplPreview"),g=document.getElementById("ctVidSplPreviewPh"),N=document.getElementById("ctVidSplClr"),y=document.getElementById("ctVidSplBtn"),k=document.getElementById("ctVidSplDownload"),S=ut();lt(k,S);const E=document.getElementById("ctVidSplName"),l=document.getElementById("ctVidSplMode"),F=document.getElementById("ctVidSplDurRow"),h=document.getElementById("ctVidSplPartsRow"),V=document.getElementById("ctVidSplSpH"),P=document.getElementById("ctVidSplSpM"),L=document.getElementById("ctVidSplSpS"),O=document.getElementById("ctVidSplParts"),_=document.getElementById("ctVidSplMeta"),et=document.getElementById("ctVidSplWasmStatus");if(!n||!y||!N)return;const d=ht({statusEl:et,progressIds:{barId:"ctVidSplProgBar",labelId:"ctVidSplProgLabel",percentId:"ctVidSplProgPct"},routeFormat:e,probeReadyLabel:"Ready to split"});let R=()=>{},u=0;const x=()=>{y.disabled=!d.currentFile||u<=0||d.encodeInFlight},nt=()=>{const t=Math.max(0,parseInt((V==null?void 0:V.value)||"0",10)||0),o=Math.max(0,parseInt((P==null?void 0:P.value)||"0",10)||0),s=Math.max(0,parseInt((L==null?void 0:L.value)||"0",10)||0);return t*3600+o*60+s},q=()=>{if(u<=0)return;const t=Math.floor(u/2)+u%2;V&&(V.value=String(Math.floor(t/3600))),P&&(P.value=String(Math.floor(t%3600/60))),L&&(L.value=String(Math.floor(t%60)))};function J(){const t=l==null?void 0:l.value;t==="parts"?(F==null||F.classList.add("d-none"),h==null||h.classList.remove("d-none")):(F==null||F.classList.remove("d-none"),h==null||h.classList.add("d-none"),t==="duration"&&q())}const A=(t,o)=>{!Number.isFinite(t)||t<=0||(u=Math.max(u,t),(l==null?void 0:l.value)==="duration"&&q(),x(),W(o))},W=t=>{!_||!t||pt(_,d.metadata,t,r,{durationFallbackSec:u>0?u:void 0})};l==null||l.addEventListener("change",()=>J()),J();const K=()=>{S.clear(),S.syncDownloadButton(k),u=0,g==null||g.classList.remove("d-none"),E&&(E.value="split_video"),d.clearPickState({preview:r,metaEl:_}),x()};It({fileEl:n,dropEl:b,dropCaptionEl:B,runtime:d,clearBtn:N,nameInput:E,preview:r,metaEl:_,onEmpty:()=>{d.currentFile&&K()},onTooLarge:()=>{D("File size exceeds 500MB limit."),Y(n)},onProbeFailed:()=>D("Failed to read video metadata."),onReady:({metadata:t,file:o})=>{g==null||g.classList.add("d-none"),u=0;const s=ft(t.duration);s>0?A(s,o):(W(o),x())}}),N.addEventListener("click",()=>{K(),Y(n),N.disabled=!0}),r==null||r.addEventListener("loadedmetadata",()=>{const t=d.currentFile;if(!t)return;const o=r==null?void 0:r.duration;Number.isFinite(o)&&!Number.isNaN(o)&&o>0?A(o,t):W(t)}),r==null||r.addEventListener("durationchange",()=>{const t=d.currentFile;if(!t)return;const o=r==null?void 0:r.duration;Number.isFinite(o)&&!Number.isNaN(o)&&o>0&&A(o,t)}),y.addEventListener("click",async()=>{const t=d.currentFile;if(!t)return;y.disabled=!0,p(0,"Splitting…");const o=d.inputNameFor(t);try{const s=await d.writeInputFile(t,o);s.on("log",({message:i})=>R(i));let M=30;R=i=>{const a=i.match(/(\d+(?:\.\d+)?)\s+fps/);a&&(M=parseFloat(a[1]))};try{await s.exec(["-i",o])}catch{}R=()=>{};const G=1/(M>0?M:30),f=u;let v=[];
1if((l==null?void 0:l.value)==="duration"){let i=nt(),a=i;if(i<1&&(a=Math.floor(f/2)+f%2),a<1||a>=f){D("First segment must be at least 1 second and shorter than the full video."),y.disabled=!!d.currentFile,p(0,"");return}const m=f-a;v.push({command:z(o,G,0,a,`output_1.${e}`),outputFileName:`output_1.${e}`,durationSec:a}),v.push({command:z(o,G,a,m,`output_2.${e}`),outputFileName:`output_2.${e}`,durationSec:m})}else{const i=Math.max(2,parseInt((O==null?void 0:O.value)||"2",10)||2);if(i>f){D("The number of parts is too high, each part must be at least 1 second long."),y.disabled=!!d.currentFile,p(0,"");return}for(let a=0;a<i;a++){const m=a*f/i,T=(a+1)*f/i-m,$=`output_${a+1}.${e}`;v.push({command:z(o,G,m,T,$),outputFileName:$,durationSec:T})}}const ot=((E==null?void 0:E.value)||"split_video").replace(/\.[^/.]+$/,""),C=v.length,Q=[],it=M>0?M:30;for(let i=0;i<C;i++){const{command:a,outputFileName:m,durationSec:H}=v[i],T=i/C*100,$=(i+1)/C*100,at=i+1;await St(s,a,{phaseLo:T,phaseHi:$,durationSec:H>0?H:null,frameRate:it,labelForPercent:U=>`Part ${at} of ${C}… ${U}%`,onProgress:(U,dt)=>p(U,dt)});const I=await s.readFile(m),rt=I.buffer?I.buffer.slice(I.byteOffset,I.byteOffset+I.byteLength):I,st=new Blob([rt],{type:`video/${e}`}),X=m.match(/\d+/),ct=X?X[0]:"1";Q.push({blob:st,filename:`${ot}_${ct}.${e}`});try{await s.deleteFile(m)}catch{}}try{await s.deleteFile(o)}catch{}S.setMultiple(Q),await S.afterConversionSuccess({onPreparing:()=>p(99,Et)}),S.syncDownloadButton(k),bt("Video split successfully — click Download."),p(100,Ft),setTimeout(()=>p(0,""),600)}catch(s){mt(s)||D(s instanceof Error?s.message:"Split failed."),p(0,"")}finally{x()}})}export{At as initVideoSplitterPage};

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.