Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: audio to video conversion fixes

Maya0353f7c5d787
diff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelte
index b3cd5e5..07f35d3 100644
--- a/src/lib/components/functional/FormatDropdown.svelte
+++ b/src/lib/components/functional/FormatDropdown.svelte
@@ -156,12 +156,23 @@
);
});
+ // TODO: better hiddenFormats logic lol
const filteredData = $derived.by(() => {
const activeCategory =
currentCategory && availableCategories.includes(currentCategory)
? currentCategory
: availableCategories[0];
+ const hiddenFormats: string[] = [];
+
+ // if audio to video, hide these video formats (because they do not want audio tracks lol)
+ const nonAudioVideoFormats = [".gif", ".webp", ".apng", ".h264"];
+ if (
+ activeCategory === "video" &&
+ categories["audio"]?.formats.includes(from ?? "")
+ )
+ hiddenFormats.push(...nonAudioVideoFormats);
+
// if no query, return formats for current category
if (!searchQuery) {
const formats = getFormats(activeCategory ?? "");
@@ -182,7 +193,7 @@
return {
categories: availableCategories,
- formats,
+ formats: formats.filter((f) => !hiddenFormats.includes(f)),
isFallback: false,
resolvedCategory: activeCategory ?? currentCategory,
};
@@ -192,7 +203,12 @@
const animatedFormats = [".webp", ".apng", ".gif"];
const matches = (f: string, cat?: string) => {
- if (!normalize(f).includes(query) || shouldExclude(f)) return false;
+ if (
+ !normalize(f).includes(query) ||
+ shouldExclude(f) ||
+ hiddenFormats.includes(f)
+ )
+ return false;
// if imageSequence and image category, only show animated formats
if (imageSequence && (cat ?? activeCategory) === "image") {
return animatedFormats.includes(f);
@@ -232,7 +248,7 @@
// show categories with matches, formats from within resolved category
return {
categories: matchingCategories,
- formats,
+ formats: formats.filter((f) => !hiddenFormats.includes(f)),
isFallback: false,
resolvedCategory,
};
diff --git a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
index 3a64ead..9bb5970 100644
--- a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
+++ b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
@@ -554,7 +554,6 @@ export class FFmpegConverter extends Converter {
audioBitrateArgs,
sampleRateArgs,
channelsArgs,
- tracksArgs,
);
} else {
this.log("Using solid color background");
@@ -565,7 +564,6 @@ export class FFmpegConverter extends Converter {
audioBitrateArgs,
sampleRateArgs,
channelsArgs,
- tracksArgs,
);
}
}
diff --git a/src/lib/converters/ffmpeg/utils/ffmpeg.ts b/src/lib/converters/ffmpeg/utils/ffmpeg.ts
index 74c7721..199e7db 100644
--- a/src/lib/converters/ffmpeg/utils/ffmpeg.ts
+++ b/src/lib/converters/ffmpeg/utils/ffmpeg.ts
@@ -56,7 +56,6 @@ export const avWithArt = (
audioBitrateArgs: string[],
sampleRateArgs: string[],
channelsArgs: string[],
- tracksArgs: string[],
): string[] => {
return [
"-loop",
@@ -65,6 +64,8 @@ export const avWithArt = (
"cover.jpg",
"-i",
"input",
+ "-map",
+ "0:v:0",
"-vf",
"scale=trunc(iw/2)*2:trunc(ih/2)*2",
"-shortest",
@@ -72,12 +73,13 @@ export const avWithArt = (
"yuv420p",
"-r",
"1",
+ "-map",
+ "1:a:0",
...codecArgs,
...metadataArgs,
...audioBitrateArgs,
...sampleRateArgs,
...channelsArgs,
- ...tracksArgs,
"output" + to,
];
};
@@ -90,7 +92,6 @@ export const avWithBg = (
audioBitrateArgs: string[],
sampleRateArgs: string[],
channelsArgs: string[],
- tracksArgs: string[],
): string[] => {
return [
"-f",
@@ -99,17 +100,20 @@ export const avWithBg = (
"color=c=black:s=512x512:rate=1",
"-i",
"input",
+ "-map",
+ "0:v:0",
"-shortest",
"-pix_fmt",
"yuv420p",
"-r",
"1",
+ "-map",
+ "1:a:0",
...codecArgs,
...metadataArgs,
...audioBitrateArgs,
...sampleRateArgs,
...channelsArgs,
- ...tracksArgs,
"output" + to,
];
};