PageSourceSearch

https://conversiontab.com/build/assets/video-audio-converter-page-DIoFGjbR.js

js conversiontab.com collected 2026-10-01 12:31:23 UTC 8,481 bytes, 1 lines download raw bytes

1import{f as Y}from"./ctMediaConvertDownload-n0-64pPl.js";import{w as se,c as ce}from"./ctPendingDownload-Dt1VJrS4.js";import{b as de,d as le,i as j,s as ue,j as me,e as q,k as fe,g as pe,m as be,n as we,f as ge}from"./mediaInputFromFilename-AaKRjYpC.js";import{c as ve,e as G}from"./ctMediaProgressUi-wz6CtyvX.js";import{i as M,A as z,t as ye}from"./audioToMidi-C3-GsDqS.js";import{f as he}from"./ffmpegWasmProbe-Dr2SB0y0.js";import{p as ke}from"./videoToolFilePick-DVHx6tsU.js";import{w as Ie}from"./wireMediaToolPageOnce-DYtotjbx.js";import{w as Ee,s as Fe,c as J}from"./fileDropzone-CA_uaFcV.js";import{s as K,r as Ae}from"./mediaMetadataDisplay-rUX1VKD5.js";import{d as Q}from"./ffmpegProbeDuration-CZSGPlSL.js";import{w as De}from"./ctMediaSourceOutputName-BkKiostT.js";import{s as xe}from"./app-Dsk0FNLH.js";import"./ctFullscreenAd-wL9Ec5Hb.js";import"./transientNotice-Ds_di7lD.js";function Ce(n,s){if(!(s==null?void 0:s.audioCodec))throw new Error("No audio track available in the selected video.");const e=["-vn","-map","0:a:0"];let a=[],t="",i=n.toLowerCase();switch(n.toLowerCase()){case"mp3":a=[...e,"-c:a","libmp3lame"],t="audio/mpeg";break;case"aac":a=[...e,"-c:a","aac"],t="audio/aac";break;case"wav":a=[...e,"-c:a","pcm_s16le"],t="audio/wav";break;case"flac":a=[...e,"-c:a","flac"],t="audio/flac";break;case"ogg":a=[...e,"-c:a","libvorbis"],t="audio/ogg";break;case"wma":a=[...e,"-c:a","wmav2"],t="audio/x-ms-wma";break;case"m4a":a=[...e,"-c:a","aac"],t="audio/x-m4a";break;case"alac":a=[...e,"-c:a","alac"],t="audio/mp4",i="m4a";break;case"aiff":a=[...e,"-c:a","pcm_s16be"],t="audio/x-aiff";break;case"pcm":a=[...e,"-c:a","pcm_s16le"],t="audio/wav",i="wav";break;case"opus":a=[...e,"-c:a","flac"],t="audio/flac",i="flac";break;case"amr":a=[...e,"-c:a","pcm_s16le","-ar","8000","-ac","1"],t="audio/wav",i="wav";break;case"aif":a=[...e,"-c:a","pcm_s16be"],t="audio/aiff",i="aiff";break;case"au":a=[...e,"-c:a","pcm_s16be"],t="audio/basic";break;case"ac3":a=[...e,"-c:a","ac3"],t="audio/ac3";break;case"dts":a=[...e,"-c:a","dca","-strict","-2"],t="audio/vnd.dts";break;case"mka":a=[...e,"-c:a","flac"],t="audio/x-matroska",i="mka";break;case"m4b":a=[...e,"-c:a","aac"],t="audio/x-m4b",i="m4b";break;case"m4p":a=[...e,"-c:a","aac"],t="audio/mp4",i="m4a";break;case"ra":a=[...e,"-acodec","aac","-b:a","128k","-ar","44100"],t="audio/mp4",i="m4a";break;case"tta":a=[...e,"-c:a","tta"],t="audio/x-tta";break;case"wv":a=[...e,"-c:a","wavpack"],t="audio/x-wavpack";break;case"mid":case"midi":throw new Error("MIDI output is handled by the page layer.");case"mpc":a=[...e,"-c:a","aac","-b:a","192k"],t="audio/aac",i="aac";break;case"gsm":a=[...e,"-c:a","pcm_s16le","-ar","8000","-ac","1"],t="audio/wav",i="wav";break;case"spx":case"ape":a=[...e,"-c:a","flac"],t="audio/flac",i="flac";break;case"voc":a=[...e,"-c:a","pcm_s16le"],t="audio/x-voc";break;case"caf":a=[...e,"-c:a","pcm_s16le"],t="audio/x-caf";break;case"snd":a=[...e,"-c:a","pcm_s16be"],t="audio/basic",i="au";break;default:throw new Error(`Unsupported output format: ${n}`)}return{command:a,mimeType:t,extension:i}}const Z=500*1024*1024;function Pe(n){var s;return!!((s=n==null?void 0:n.audioCodec)!=null&&s.trim())}function w(n){const s=document.getElementById("ctVidAudToastBody"),d=document.getElementById("ctVidAudToast");if(!s||!d||typeof bootstrap>"u"){window.alert(n);return}s.textContent=n,bootstrap.Toast.getOrCreateInstance(d).show()}function Xe(){const n=document.getElementById("ct-video-audio-converter-root");if(!Ie(n,"ctVidAudWired"))return;const s=(n.dataset.ctVideoFormat||"mp4").toLowerCase(),d=(n.dataset.ctAudioFormat||"mp3").toLowerCase(),e=document.getElementById("ctVidAudFile"),a=document.getElementById("ctVidAudDrop"),t=document.getElementById("ctVidAudDropCaption"),i=document.getElementById("ctVidAudPreview"),k=document.getElementById("ctVidAudClr"),I=document.getElementById("ctVidAudBtn"),T=document.getElementById("ctVidAudDownload"),g=ce();se(T,g);const E=document.getElementById("ctVidAudName"),R=document.getElementById("ctVidAudWasmStatus"),O=document.getElementById("ctVidAudMeta"),c=ve({barId:"ctVidAudProgBar",labelId:"ctVidAudProgLabel",percentId:"ctVidAudProgPct"});if(!e||!I||!k)return;e.setAttribute("accept",de()),a&&Ee({input:e,drop:a,dragContainer:a.closest(".card-body"),captionEl:t});let u=null,F=null,m={},f=null,_=s,S=()=>{},v=!1,A=0,$=!1,D=!1,U=!1,x=!1;const H=De({nameInput:E,defaultName:"converted_audio",suffix:"_converted",getSourceFileName:()=>{var o,r;return(f==null?void 0:f.name)||((r=(o=e.files)==null?void 0:o[0])==null?void 0:r.name)||null}}),L=()=>{J(e,{notify:!1,drop:a,captionEl:t})},ee=()=>{setTimeout(()=>{fe()},0)},V=()=>{I.disabled=!v||!f||!x||D};async function ae(){return u&&!u.loaded&&(u=null,F=null,v=!1),u?(v=!0,u):(F||(v=!1,ue(R),V(),F=me({onProgress:o=>pe(R,o)}).then(o=>(u=o,o.on("log",({message:r})=>S(r)),v=!0,q(R,be),V(),o)).catch(o=>{throw F=null,u=null,v=!1,q(R,we),V(),o})),F)}const te=()=>
1{i&&(i.pause(),i.removeAttribute("src"),i.classList.add("d-none"))},N=()=>{if(!U){U=!0;try{A+=1;const o=$||D;D&&(D=!1),o&&(u=null,F=null,v=!1,ee()),g.clear(),g.syncDownloadButton(T),f=null,_=s,m={},x=!1,S=()=>{},te(),K(O,null),c.ui.hardReset("Ready"),E&&(E.value="converted_audio"),H.onFileCleared(),I.disabled=!0}finally{U=!1}}};k.addEventListener("click",o=>{o.preventDefault(),N(),L(),k.disabled=!0}),e.addEventListener("change",async()=>{var y;const o=(y=e.files)==null?void 0:y[0];if(!o){if(!f){Fe(e,a,t);return}N(),L(),k.disabled=!0;return}if(o.size>Z){w("File size exceeds 500MB limit."),J(e,{drop:a,captionEl:t}),k.disabled=!0;return}const r=++A;$=!0,f=o,k.disabled=!1,_=le(o.name,s),m={},K(O,null),c.ui.hardReset("Reading metadata…"),I.disabled=!0,xe(i,o);try{if(r!==A)return;const h=await ke({ensureFfmpeg:ae},o,s,null,i);if(r!==A)return;m=h.metadata,_=h.inName.replace(/^input\./,"")||_,x=Pe(m),Ae(O,m,o,i);const C=Q(m.duration);if(x&&M(d)&&C>z){w(`This file is about ${Math.ceil(C)}s long. MIDI transcription supports up to ${z} seconds in the browser.`),N(),L();return}x?c.ui.hardReset(M(d)?"Ready to transcribe to MIDI":"Ready to extract audio"):(c.ui.hardReset("No audio track in this file"),w("This video has no audio track. Choose a file with sound to extract MP3 or other audio.")),H.onFileReady(),V()}catch(h){if(r!==A)return;j(h)||(w("Failed to process the video file. Please ensure it is valid."),N(),L())}finally{r===A&&($=!1)}}),I.addEventListener("click",async()=>{if(!f||!u)return;if(!x){w("This video has no audio track to extract.");return}
1if(f.size>Z){w("File size exceeds 500MB limit.");return}const o=u,r=`input.${_}`,y=Q(m.duration),h=((E==null?void 0:E.value)||"converted_audio").replace(/\.[^/.]+$/,"");g.clear(),g.syncDownloadButton(T),c.beginEncoding(M(d)?"Preparing for MIDI transcription…":"Extracting…"),D=!0,I.disabled=!0,S=()=>{};try{await he();try{await o.readFile(r)}catch{await o.writeFile(r,await ge(f))}if(M(d)){const l="midi_prep.wav";await G(o,["-y","-loglevel","warning","-stats","-i",r,"-vn","-map","0:a:0","-ac","1","-ar","22050","-f","wav",l],{phaseLo:0,phaseHi:30,durationSec:y>0?y:null,frameRate:m.frameRate??null,labelForPercent:B=>B>0?`Preparing audio… ${B}%`:"Preparing audio…",onProgress:(B,W)=>c(B,W)});const b=await o.readFile(l),ne=b.buffer?b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength):b,X=await ye(new Blob([ne],{type:"audio/wav"}),{extension:d,maxDurationSec:z,onProgress:(B,W)=>c(B,W)});await Y(g,T,{blob:X.blob,filename:`${h}.${X.extension}`,progressUi:c.ui}),c.ui.setDone("Done — click Download");try{await o.deleteFile(r),await o.deleteFile(l)}catch{}return}let p;try{p=Ce(d,m)}catch(l){w(l instanceof Error?l.message:"Unsupported output or missing audio.");return}const C=`output.${p.extension}`,oe=["-y","-loglevel","warning","-stats","-i",r,...p.command,C];await G(o,oe,{phaseLo:0,phaseHi:100,durationSec:y>0?y:null,frameRate:m.frameRate??null,labelForPercent:l=>l>0?`Extracting… ${l}%`:"Extracting…",onProgress:(l,b)=>c(l,b)});const P=await o.readFile(C),ie=P.buffer?P.buffer.slice(P.byteOffset,P.byteOffset+P.byteLength):P,re=new Blob([ie],{type:p.mimeType});await Y(g,T,{blob:re,filename:`${h}.${p.extension}`,progressUi:c.ui}),c.ui.setDone("Done — click Download");try{await o.deleteFile(r),await o.deleteFile(C)}catch{}}catch(p){j(p)||(w(p instanceof Error?p.message:"Conversion failed."),c.ui.hardReset(M(d)?"Ready to transcribe to MIDI":"Ready to extract audio"))}finally{D=!1,S=()=>{},V()}})}export{Xe as initVideoAudioConverterPage};

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.