fix: audio to video conversion fixes

all but 4 formats (amv, mpg, mpeg, vob) convert successfully from quick tests rn. took way too long to test and fix these.

also remove video formats that do not like audio tracks from being shown for audio -> video conversions
This commit is contained in:
Maya 2026-06-04 14:58:49 +03:00
parent 125854414c
commit 0353f7c5d7
No known key found for this signature in database
3 changed files with 27 additions and 9 deletions

View File

@ -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,
};

View File

@ -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,
);
}
}

View File

@ -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,
];
};