PageSourceSearch

https://osmo.inc/assets/encode.worker-FizLHFCK.js

js osmo.inc collected 2026-10-08 17:49:43 UTC 8,312 bytes, 2 lines download raw bytes

1(function(){"use strict";async function v(e){const o=new SharedArrayBuffer(8),f=new SharedArrayBuffer(8),r=new SharedArrayBuffer(1024*1024),n=new Int32Array(o),l=new Float64Array(f),c=new Uint8Array(r),t=new Worker(new URL("/assets/file-writer.worker-JsaaWpKJ.js",self.location.href),{type:"module"});let i="Could not write the chosen file. Check available disk space and try again.",a=0,s=!1;const m=new Promise((h,w)=>{t.onmessage=({data:u})=>{u.type==="ready"&&h(),u.type==="error"&&(i=u.message,w(new Error(i)))},t.onerror=u=>{i=u.message,Atomics.store(n,0,-1),Atomics.notify(n,0),w(new Error(i))}});t.postMessage({destination:e,control:o,position:f,bytes:r});try{await m}catch(h){throw t.terminate(),h}function p(h){if(Atomics.load(n,0)<0)throw new Error(i);Atomics.store(n,0,h),Atomics.notify(n,0);const w=Date.now()+12e4;for(;Atomics.load(n,0)>0;)if(Atomics.wait(n,0,h,1e3),Date.now()>w)throw new Error("Saving the file stopped responding. Please try again.");if(Atomics.load(n,0)<0)throw new Error(i)}return{handle:{write(h,w){const u=new Uint8Array(h.buffer,h.byteOffset,h.byteLength),d=w?.at??0;let g=0;for(;g<u.length;){const b=Math.min(c.length,u.length-g);c.set(u.subarray(g,g+b)),l[0]=d+g,Atomics.store(n,1,b),p(1),g+=b}return a=Math.max(a,d+g),g},read(){throw new Error("The export muxer unexpectedly requested a file read")},getSize:()=>a,truncate(){throw new Error("The export muxer unexpectedly requested truncation")},flush(){},close(){s||(p(2),s=!0,t.terminate())}},abort(){if(!s)try{p(3)}finally{s=!0,t.terminate()}}}}function M(e,o=64*1024*1024){const r=[];let n=0;const l=t=>{if(!Number.isSafeInteger(t)||t<0||t>o)throw new Error("Temporary browser storage is unavailable and this file exceeds the 64 MB memory fallback. Use a regular browser tab with available storage, save directly to a file, or export a shorter clip.")};return{handle:{write(t,{at:i}={at:0}){const a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);l(i+a.length);let s=0;for(;s<a.length;){const m=i+s,p=Math.floor(m/1048576),y=m%1048576,h=Math.min(a.length-s,1048576-y);for(;r.length<=p;)r.push(new Uint8Array(1048576));r[p].set(a.subarray(s,s+h),y),s+=h}return n=Math.max(n,i+a.length),a.length},read(t,{at:i}={at:0}){l(i);const a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),s=Math.max(0,Math.min(a.length,n-i));for(let m=0;m<s;){const p=i+m,y=Math.floor(p/1048576),h=p%1048576,w=Math.min(s-m,1048576-h);a.set(r[y].subarray(h,h+w),m),m+=w}return s},getSize(){return n},truncate(t){for(l(t);r.length<Math.ceil(t/1048576);)r.push(new Uint8Array(1048576));t<n&&t%1048576&&r[Math.floor(t/1048576)].fill(0,t%1048576),r.length=Math.ceil(t/1048576),n=t},flush(){},close(){}},memory:!0,file:{async getFile(){return new File(r.map((t,i)=>t.subarray(0,Math.min(1048576,n-i*1048576))),e)}},folder:{async removeEntry(){r.length=0,n=0}}}}let A;const k=new Set;function x(e){return A??=(async()=>{const o="/35mm/codec/",f=await(await fetch(o+"manifest.json")).json(),r=f.parts.map(()=>0),n=f.parts.length*8*1024*1024,l=()=>{const a=Math.min(1,r.reduce((s,m)=>s+m,0)/n);for(const s of k)s(a)},c=await Promise.all(f.parts.map(async(a,s)=>{const m=await fetch(o+a);if(!m.ok||!m.body)throw new Error("Could not load the local video tools. Check your connection and reload.");const p=m.body.getReader(),y=[];for(;;){const{done:u,value:d}=await p.read();if(u)break;y.push(d),r[s]+=d.length,l()}const h=new Uint8Array(r[s]);let w=0;for(const u of y)h.set(u,w),w+=u.length;return h})),t=new Uint8Array(c.reduce((a,s)=>a+s.length,0));let i=0;for(const a of c)t.set(a,i),i+=a.length;for(const a of k)a(1);return k.clear(),t})().catch(o=>{throw A=void 0,k.clear(),o})}async function E(e){const o="/35mm/codec/",f=await x(),n=(await import(new URL(o+"ffmpeg-core.js",self.location.origin).href)).default,l=await n({wasmBinary:f});return l.FS.mkdir("/input"),l}function z(e,o){try{e.FS.unmount("/input")}catch{}e.FS.mount(e.FS.filesystems.WORKERFS,{blobs:[{name:"source",data:o}]},"/input")}function F(e,o,f=!1){const r=[];e.setLogger(l=>{r.push(l.message),r.length>60&&r.shift()}),e.reset();const n=f?e.ffprobe(...o):e.exec("-nostdin","-y","-v","error",...o);if(!(f&&n===-1)&&n!==0)throw new Error(r.slice(-12).join(`
2`)||"The media decoder could not process this file.")}function _(e,o,f,r,n){e.FS.registerDevice(r,{open:l=>{l.seekable=!0},read:(l,c,t,i,a)=>f.read(c.subarray(t,t+i),{at:a}),write:(l,c,t,i,a)=>{try{let s=0;for(;s<i;){const m=f.write(c.subarray(t+s,t+i),{at:a+s});if(m<=0)throw new Error("Destination is full");s+=m}return s}catch(s){throw n?.(s),new e.FS.ErrnoError(29)}},llseek:(l,c,t)=>{const i=t===0?c:t===1?l.position+c:f.getSize()+c;if(i<0)throw new Error("Invalid file position");return i}}),e.FS.mkdev(o,438,r)}async function U(e){try{return await D(e)}catch{return M(e)}}async function D(e){const f=await(await navigator.storage.getDirectory()).getDirectoryHandle("osmo-35mm",{create:!0}),r=f;for await(const c of r.values())if(!(c.kind!=="file"||c.name===e))try{(await c.getFile()).lastModified<Date.now()-864e5&&await f.removeEntry(c.name)}catch{}const n=await f.getFileHandle(e,{create:!0}),l=await n.createSyncAccessHandle();return l.truncate(0),{folder:f,file:n,handle:l,memory:!1}}let B;self.onmessage=async({data:e})=>{const o=new Int32Array(e.control),f=new Uint8Array(e.ring);let r,n,l;try{self.postMessage({type:"encoder-status",message:"loading encoder"});const c=B??=await E();self.postMessage({type:"encoder-status",message:"opening destination"}),z(c,e.file),e.destination?n=await v(e.destination):r=await U(e.outputN
2ame),self.postMessage({type:"encoder-status",message:"destination ready"});const t=(n??r).handle;for(const u of["/output.mov","/frames"])try{c.FS.unlink(u)}catch{}_(c,"/output.mov",t,82,u=>{l=u});let i=0;c.FS.registerDevice(81,{open:u=>{u.seekable=!1},read:(u,d,g,b)=>{for(;Atomics.load(o,0)===0;){if(Atomics.load(o,2))throw new Error("Export cancelled");Atomics.wait(o,0,0,1e3)}if(Atomics.load(o,0)===2)return 0;if(Atomics.load(o,0)<0||Atomics.load(o,2))throw new Error("Export cancelled");const S=Math.min(b,Atomics.load(o,1)-i);return d.set(f.subarray(i,i+S),g),i+=S,i===Atomics.load(o,1)&&(i=0,Atomics.store(o,0,0),Atomics.notify(o,0)),S}}),c.FS.mkdev("/frames",438,81),self.postMessage({type:"encoder-ready"});const a=e.format==="prores"?["-c:v","prores_ks","-profile:v","4","-pix_fmt","yuva444p10le","-alpha_bits","16","-c:a","pcm_s24le","-f","mov"]:["-c:v","libx264","-preset","ultrafast","-crf","18","-pix_fmt","yuv420p","-c:a","aac","-b:a","256k","-f","mp4"],s=e.maxEdge>0&&Math.max(e.width,e.height)>e.maxEdge,m=(s?(e.maxEdge/Math.max(e.width,e.height))**2:1)*e.width*e.height,p=Math.round(Math.min(60,Math.max(16,m/83e5*45)));e.format!=="prores"&&a.splice(a.indexOf("-pix_fmt"),0,"-maxrate",`${p}M`,"-bufsize",`${p*2}M`);const y=s?["-vf",`scale=${Math.max(2,Math.round(e.width*e.maxEdge/Math.max(e.width,e.height)/2)*2)}:${Math.max(2,Math.round(e.height*e.maxEdge/Math.max(e.width,e.height)/2)*2)}:flags=lanczos`]:e.format!=="prores"&&(e.width%2||e.height%2)?["-vf","pad=ceil(iw/2)*2:ceil(ih/2)*2"]:[];F(c,["-f","rawvideo","-pixel_format","rgba64le","-video_size",`${e.width}x${e.height}`,"-framerate",e.rate,"-i","/frames",...e.range?["-ss",String(e.range.start),"-t",String(e.range.length)]:[],"-i","/input/source","-map","0:v:0",...(e.audioStreams??[]).flatMap(u=>["-map",`1:${u}`]),"-map_metadata","1",...y,"-sws_flags","bicubic+full_chroma_inp",...a,"-color_primaries","bt709","-color_trc","bt709","-colorspace","bt709","/output.mov"]),Atomics.store(o,0,3),Atomics.notify(o,0),t.flush(),t.close();const h=e.destination?.name??e.downloadName,w=new File([await(e.destination??r.file).getFile()],h,{type:e.format==="prores"?"video/quicktime":"video/mp4"});self.postMessage({type:"exported",file:w,name:h,saved:!!n,outputName:r&&!r.memory?e.outputName:void 0})}catch(c){Atomics.store(o,0,-1),Atomics.notify(o,0);try{n?.abort()}catch{}try{r?.handle.close()}catch{}r&&await r.folder.removeEntry(e.outputName).catch(()=>{}),self.postMessage({type:"error",message:Atomics.load(o,2)?"Export cancelled.":l instanceof Error&&l.message.includes("64 MB")?l.message:l?"Saving ran out of space or the destination became unavailable. Try saving directly to a file, clearing temporary exports, or choosing a smaller export size.":c instanceof Error?c.message:String(c)})}}})();

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.