{#if value && value.length > 0}
{ value = ""; if (!consoleView) return; const transaction = consoleView.state.update({ changes: [{ from: 0, to: consoleView.state.doc.length }], }); consoleView.dispatch(transaction); }} aria-label="Clear Search Button" >
{/if} {#if $loading && !$initializing}
{ get(abortCtlr)?.abort?.(); if (!ffmpeg) return; // if () // ffmpeg?.terminate?.(); ffmpeg?.exit?.('break'); // ffmpegLoaded (async () => { loading.set(true); initializing.set(true); // await ffmpeg?.load?.({ // coreURL: FFmpegCoreUrl, // wasmURL: FFmpegCoreWASMUrl, // workerURL: FFmpegCoreWorkerUrl, // }); loading.set(false); initializing.set(false); })(); }} >
{:else}
{/if}
{#if openInputEl?.files && openInputEl?.files?.length > 0}
{:else}
{/if}
{#if value && value.length > 0 && tryURL(value)}
{/if}
Examples
{#each samplesArr as sample, i}
{ if (!editorView) return; const doc = editorView.state.doc; // (Assume view is an EditorView instance holding the document "123".) const transaction = editorView.state.update({ changes: { from: 0, to: doc.length, insert: JSON.stringify(sample[1], null, 2), }, }); console.log(transaction.state.doc.toString()); // "0123" // At this point the view still shows the old state. editorView.dispatch(transaction); // And now it shows the new state. // onSearch(); const newURL = new URL(globalThis.location.href); newURL.searchParams.set("config", JSON.stringify(ffmpegOpts)); globalThis.history.replaceState(null, "", newURL); }} > {sample[0]}
{/each}
Advanced
FFmpeg Config
Logs
Results
{ let link = document.createElement("a"); get(results).forEach(({ url }, i) => { if (url) { link.href = url; link.target = "_blank"; link.download = value; link.click(); } }); // @ts-ignore link = null; }} > Download All
{ get(results).forEach(({ url }, i) => { if (url) URL.revokeObjectURL(url); }); results.set([]); }} > Clear All
{#if typeof $error == "string"}
{$error}
{:else if $loading || $initializing || $results.length <= 0}
{$loading || $initializing ? "Loading..." + (!$initializing ? Math.round($progress * 100) + "%" : "") : "Empty..."}
{/if}
{#each $results as { url, type }, i (url)} {#if url && type && url.length > 0}
{#if type == "video" || type == "audio"}
{:else}
{/if}
Download
{ if (url) URL.revokeObjectURL(url); const tempResults = Array.from(get(results)); tempResults.splice(i, 1); results.set(tempResults); }} > Delete
{/if} {/each}
Convert videos and images into gifs, vice-versa, etc...
I created this as a side-quest to
Try using
FFmpeg WASM
(FFmpeg's WASM package feels older than I am, probs due Emscripten 🤷♂️)
Plus, it seemed pretty neat to be able convert a gif to mp4 and vice-versa without needing to open it to a server.
Thanks
@fbritoferreira
for creating
fbritoferreira/m3u8-parser
it really is a beautiful library.
The playground uses
@ffmpeg.wasm/main
.
FFmpeg
and the corresponding
media format libraries
are licenced under
GPL
.