The next-generation file converter. Open source, fully local* and free forever.
feat: new audio, video, and documents formats
JovannMCcd39d0a6e4c8
diff --git a/src/lib/components/functional/popups/SettingsModal.svelte b/src/lib/components/functional/popups/SettingsModal.svelteindex 2dd1b35..c7ee17c 100644--- a/src/lib/components/functional/popups/SettingsModal.svelte+++ b/src/lib/components/functional/popups/SettingsModal.svelte@@ -367,9 +367,7 @@: ""}</button>{#if isSelected && variantOptions}- <div- class="ml-3 flex flex-wrap gap-2"- >+ <div class="ml-3 flex flex-wrap gap-2">{#each variantOptions as option (option.value)}<buttonclass={clsx(@@ -377,7 +375,8 @@converter.getVariantValue() ===option.value &&"bg-accent-purple text-black",- $effects && "transition",+ $effects &&+ "transition",)}onclick={() =>converter.setVariant(diff --git a/src/lib/converters/ffmpeg/ffmpeg.codecs.ts b/src/lib/converters/ffmpeg/ffmpeg.codecs.tsindex 4bf0562..90f5855 100644--- a/src/lib/converters/ffmpeg/ffmpeg.codecs.ts+++ b/src/lib/converters/ffmpeg/ffmpeg.codecs.ts@@ -82,6 +82,13 @@ export const getCodecs = (return { video: "libx264", audio: "aac" };case ".voc":return { video: "libx264", audio: "pcm_u8" };+ case ".tta":+ return { video: "libx264", audio: "tta" };++ case ".ivf":+ return { video: "libvpx", audio: "none" };+ case ".y4m":+ return { video: "libx264", audio: "none" };// animated imagescase ".gif":@@ -131,6 +138,7 @@ export const toArgs = (ext: string, isAlac: boolean = false): string[] => {if (codecs.audio === "aac") args.push("-strict", "experimental");if (ext === ".divx") args.unshift("-f", "avi");+ if (ext === ".y4m") args.unshift("-f", "yuv4mpegpipe"); // y4m is a pseudo-muxer, needs an explicit -fif (ext === ".mxf") args.push("-strict", "unofficial");return args;diff --git a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg/ffmpeg.svelte.tsindex c251c1c..8034fd8 100644--- a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts+++ b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts@@ -9,18 +9,15 @@ import type {} from "#lib/types/conversion-settings";import { ToastManager } from "#lib/util/toast.svelte";import { browser } from "$app/env";-import ffmpegWasmURL from "@ffmpeg/core/wasm?url";-import ffmpegCoreURL from "@ffmpeg/core?url";import ffmpegMtWasmURL from "@ffmpeg/core-mt/wasm?url";import ffmpegMtWorkerRaw from "@ffmpeg/core-mt/worker?raw";import ffmpegMtCoreURL from "@ffmpeg/core-mt?url";+import ffmpegWasmURL from "@ffmpeg/core/wasm?url";+import ffmpegCoreURL from "@ffmpeg/core?url";import { FFmpeg } from "@ffmpeg/ffmpeg";import { SvelteMap } from "svelte/reactivity";import { Converter, FormatInfo, formatDuration } from "../converter.svelte";-import {- EngineVariants,- type FFmpegVariant,-} from "../engine-variants.svelte";+import { EngineVariants, type FFmpegVariant } from "../engine-variants.svelte";import { applyPriorities } from "../priority";import { videoFormats } from "../vertd/vertd.svelte";import { buildImageSequenceCommand } from "./ffmpeg.animated";@@ -53,7 +50,7 @@ export class FFmpegConverter extends Converter {private activeConversions = new SvelteMap<string, FFmpeg>();// non supported audio to video formats- private cantConvert: string[] = ["ogx"];+ private cantConvert: string[] = ["ogx", "y4m", "ivf"]; // y4m/ivf are uncompressed/raw video containers without audiopublic supportedFormats = applyPriorities("ffmpeg", [new FormatInfo("mp3", true, true),@@ -84,6 +81,9 @@ export class FFmpegConverter extends Converter {new FormatInfo("au", true, true),new FormatInfo("m4b", true, true),new FormatInfo("voc", true, true),+ new FormatInfo("tta", true, true),+ new FormatInfo("amr", true, false), // only decode in ffmpeg-wasm+ new FormatInfo("ape", true, false),...videoFormats.map(// exclude cantConvert from audio to video(f: string) => {@@ -154,7 +154,9 @@ export class FFmpegConverter extends Converter {this.status = "ready";return Promise.resolve();} catch (fallbackErr) {- this.error(`single-threaded ffmpeg core failed too: ${fallbackErr}`);+ this.error(+ `single-threaded ffmpeg core failed too: ${fallbackErr}`,+ );}}diff --git a/src/lib/converters/magick/magick.svelte.ts b/src/lib/converters/magick/magick.svelte.tsindex 1827a51..81402c1 100644--- a/src/lib/converters/magick/magick.svelte.ts+++ b/src/lib/converters/magick/magick.svelte.ts@@ -145,7 +145,10 @@ export class MagickConverter extends Converter {await variants.resolve();// forced 64-bit on a browser without memory64 -> fall back to 32-bit- if (variants.magick === "x64" && variants.magickX64Supported === false) {+ if (+ variants.magick === "x64" &&+ variants.magickX64Supported === false+ ) {this.log("64-bit magick-wasm requested but memory64 is unsupported, using 32-bit",);diff --git a/src/lib/converters/pandoc/pandoc.svelte.ts b/src/lib/converters/pandoc/pandoc.svelte.tsindex 4b674b7..33fa5a0 100644--- a/src/lib/converters/pandoc/pandoc.svelte.ts+++ b/src/lib/converters/pandoc/pandoc.svelte.ts@@ -148,6 +148,15 @@ export class PandocConverter extends Converter {new FormatInfo("epub", true, true),new FormatInfo("odt", true, true),new FormatInfo("docbook", true, true),+ new FormatInfo("ipynb", true, true),+ new FormatInfo("typ", true, true),+ new FormatInfo("opml", true, true),+ new FormatInfo("org", true, true),+ new FormatInfo("fb2", true, true),+ new FormatInfo("tex", true, true),+ new FormatInfo("man", true, true),+ new FormatInfo("jats", true, true),+ new FormatInfo("adoc", false, true),];}diff --git a/src/lib/converters/vertd/vertd.svelte.ts b/src/lib/converters/vertd/vertd.svelte.tsindex 7f83e1e..6ac30b7 100644--- a/src/lib/converters/vertd/vertd.svelte.ts+++ b/src/lib/converters/vertd/vertd.svelte.ts@@ -347,7 +347,7 @@ const downloadTask = (url: string, file: VertFile): DownloadTask => {};// prettier-ignore-export const videoFormats: string[] = ["mp4", "mkv", "webm", "avi", "wmv", "mov", "gif", "apng", "webp", "mts", "ts", "m2ts", "mpg", "mpeg", "flv", "f4v", "vob", "m4v", "3gp", "3g2", "mxf", "ogx", "ogv", "gxf", "rm", "rmvb", "h264", "divx", "swf", "amv", "asf", "nut"];+export const videoFormats: string[] = ["mp4", "mkv", "webm", "avi", "wmv", "mov", "gif", "apng", "webp", "mts", "ts", "m2ts", "mpg", "mpeg", "flv", "f4v", "vob", "m4v", "3gp", "3g2", "mxf", "ogx", "ogv", "gxf", "rm", "rmvb", "h264", "divx", "swf", "amv", "asf", "nut", "ivf", "y4m"];const cantEncode: string[] = ["rm", "rmvb"];const cantDecode: string[] = [];diff --git a/src/lib/types/file.svelte.ts b/src/lib/types/file.svelte.tsindex 18e51d3..8e74587 100644--- a/src/lib/types/file.svelte.ts+++ b/src/lib/types/file.svelte.ts@@ -323,7 +323,7 @@ export class VertFile {if (!this.fileType) return;- const forceKeep = ["mpo"];+ const forceKeep = ["mpo", "fb2"];const aliases: Record<string, string> = {// original: aliasjpg: "jpeg",diff --git a/src/lib/workers/pandoc.ts b/src/lib/workers/pandoc.tsindex 0d9f69a..8662024 100644--- a/src/lib/workers/pandoc.ts+++ b/src/lib/workers/pandoc.ts@@ -35,7 +35,16 @@ type Format =| ".odt"| ".docbook"| ".html"- | ".markdown";+ | ".markdown"+ | ".ipynb"+ | ".typ"+ | ".opml"+ | ".org"+ | ".fb2"+ | ".tex"+ | ".man"+ | ".jats"+ | ".adoc";// eslint-disable-next-line @typescript-eslint/no-explicit-anyconst handleMessage = async (message: WorkerMessage): Promise<any> => {@@ -89,7 +98,6 @@ const formatToReader = (format: Format): string => {case ".md":case ".markdown":return "markdown";- case ".doc":case ".docx":return "docx";case ".csv":@@ -110,6 +118,24 @@ const formatToReader = (format: Format): string => {return "rtf";case ".rst":return "rst";+ case ".ipynb":+ return "ipynb";+ case ".typ":+ return "typst";+ case ".opml":+ return "opml";+ case ".org":+ return "org";+ case ".fb2":+ return "fb2";+ case ".tex":+ return "latex";+ case ".man":+ return "man";+ case ".jats":+ return "jats";+ case ".adoc":+ return "asciidoc";}throw new Error(`Unsupported format: ${format}`);