mirror of
https://github.com/C4illin/ConvertX.git
synced 2026-10-28 07:44:21 +01:00
resturcture ffmpeg properties
This commit is contained in:
+803
-685
File diff suppressed because it is too large
Load Diff
+15
-15
@@ -315,7 +315,13 @@ for (const converterName in properties) {
|
||||
for (const ext of fromList) {
|
||||
if (!possibleTargets[ext]) possibleTargets[ext] = {};
|
||||
|
||||
possibleTargets[ext][converterName] = [...toList];
|
||||
if (!possibleTargets[ext][converterName]) {
|
||||
possibleTargets[ext][converterName] = [...toList];
|
||||
} else {
|
||||
possibleTargets[ext][converterName] = [
|
||||
...new Set([...possibleTargets[ext][converterName], ...toList]),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,16 +355,13 @@ for (const converterName in properties) {
|
||||
|
||||
if (!converterProperties) continue;
|
||||
|
||||
const targets = new Set<string>();
|
||||
for (const key in converterProperties.to) {
|
||||
if (allTargets[converterName]) {
|
||||
allTargets[converterName] = [
|
||||
...allTargets[converterName],
|
||||
...(converterProperties.to[key] || []),
|
||||
];
|
||||
} else {
|
||||
allTargets[converterName] = [...(converterProperties.to[key] || [])];
|
||||
for (const ext of converterProperties.to[key] || []) {
|
||||
targets.add(ext);
|
||||
}
|
||||
}
|
||||
allTargets[converterName] = Array.from(targets);
|
||||
}
|
||||
|
||||
export const getAllTargets = () => {
|
||||
@@ -371,16 +374,13 @@ for (const converterName in properties) {
|
||||
|
||||
if (!converterProperties) continue;
|
||||
|
||||
const inputs = new Set<string>();
|
||||
for (const key in converterProperties.from) {
|
||||
if (allInputs[converterName]) {
|
||||
allInputs[converterName] = [
|
||||
...allInputs[converterName],
|
||||
...(converterProperties.from[key] || []),
|
||||
];
|
||||
} else {
|
||||
allInputs[converterName] = converterProperties.from[key] || [];
|
||||
for (const ext of converterProperties.from[key] || []) {
|
||||
inputs.add(ext);
|
||||
}
|
||||
}
|
||||
allInputs[converterName] = Array.from(inputs);
|
||||
}
|
||||
|
||||
export const getAllInputs = (converter: string) => {
|
||||
|
||||
@@ -117,6 +117,21 @@ test.each(["wav", "aac"])("drops video streams for %s output", async (ext) => {
|
||||
expect(calls[0]).toEqual(["-i", "in.mp3", "-vn", `out.${ext}`]);
|
||||
});
|
||||
|
||||
test.each(["png", "jpg", "jpeg", "webp"])(
|
||||
"drops audio streams when extracting cover art from audio to %s",
|
||||
async (ext) => {
|
||||
await convert("in.mp3", "mp3", ext, `out.${ext}`, undefined, mockExecFile);
|
||||
|
||||
expect(calls[0]).toEqual(["-i", "in.mp3", "-an", `out.${ext}`]);
|
||||
},
|
||||
);
|
||||
|
||||
test.each(["png", "jpg", "jpeg", "webp"])("drops audio streams when extracting cover art from audio to %s", async (ext) => {
|
||||
await convert("in.mp3", "mp3", ext, `out.${ext}`, undefined, mockExecFile);
|
||||
|
||||
expect(calls[0]).toEqual(["-i", "in.mp3", "-an", `out.${ext}`]);
|
||||
});
|
||||
|
||||
test("places the cover art args after FFMPEG_OUTPUT_ARGS", async () => {
|
||||
process.env.FFMPEG_OUTPUT_ARGS = "-b:a 192k";
|
||||
|
||||
|
||||
@@ -155,6 +155,33 @@ describe("converter registry", () => {
|
||||
expect(getPossibleTargets("jxl").libjxl).not.toContain("jxl");
|
||||
expect(libreofficeProperties.from.text).not.toContain("xlsx");
|
||||
expect(libreofficeProperties.to.text).not.toContain("xlsm");
|
||||
|
||||
// ffmpeg categories
|
||||
const pngTargets = getPossibleTargets("png").ffmpeg ?? [];
|
||||
expect(pngTargets).toContain("jpg");
|
||||
expect(pngTargets).toContain("webp");
|
||||
expect(pngTargets).toContain("gif");
|
||||
expect(pngTargets).not.toContain("mp3");
|
||||
expect(pngTargets).not.toContain("wav");
|
||||
expect(pngTargets).not.toContain("srt");
|
||||
expect(pngTargets).not.toContain("vtt");
|
||||
|
||||
const mp3Targets = getPossibleTargets("mp3").ffmpeg ?? [];
|
||||
expect(mp3Targets).toContain("flac");
|
||||
expect(mp3Targets).toContain("wav");
|
||||
expect(mp3Targets).toContain("png");
|
||||
expect(mp3Targets).toContain("jpg");
|
||||
expect(mp3Targets).toContain("mp4");
|
||||
expect(mp3Targets).toContain("mkv");
|
||||
expect(mp3Targets).not.toContain("srt");
|
||||
expect(mp3Targets).not.toContain("vtt");
|
||||
|
||||
const srtTargets = getPossibleTargets("srt").ffmpeg ?? [];
|
||||
expect(srtTargets).toContain("vtt");
|
||||
expect(srtTargets).toContain("ass");
|
||||
expect(srtTargets).not.toContain("png");
|
||||
expect(srtTargets).not.toContain("mp3");
|
||||
expect(srtTargets).not.toContain("mp4");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ test("converts every saved PNG target for each converter", async () => {
|
||||
console.error = originalConsoleError;
|
||||
}
|
||||
|
||||
expect(testedTargets).toBe(558);
|
||||
expect(successfulTargets).toBe(415);
|
||||
expect(testedTargets).toBe(405);
|
||||
expect(successfulTargets).toBe(370);
|
||||
expect(observedFailures.sort()).toEqual(expectedFailures);
|
||||
expect(failures).toEqual([]);
|
||||
}, 120000);
|
||||
|
||||
@@ -1,116 +1,6 @@
|
||||
{
|
||||
"sample.png": [
|
||||
"ffmpeg:265",
|
||||
"ffmpeg:266",
|
||||
"ffmpeg:302",
|
||||
"ffmpeg:3g2",
|
||||
"ffmpeg:3gp",
|
||||
"ffmpeg:aac",
|
||||
"ffmpeg:ac3",
|
||||
"ffmpeg:ac4",
|
||||
"ffmpeg:adts",
|
||||
"ffmpeg:adx",
|
||||
"ffmpeg:afc",
|
||||
"ffmpeg:aif",
|
||||
"ffmpeg:aifc",
|
||||
"ffmpeg:aiff",
|
||||
"ffmpeg:al",
|
||||
"ffmpeg:amr",
|
||||
"ffmpeg:amv",
|
||||
"ffmpeg:apm",
|
||||
"ffmpeg:aptx",
|
||||
"ffmpeg:aptxhd",
|
||||
"ffmpeg:ass",
|
||||
"ffmpeg:ast",
|
||||
"ffmpeg:au",
|
||||
"ffmpeg:aud",
|
||||
"ffmpeg:avs",
|
||||
"ffmpeg:avs2",
|
||||
"ffmpeg:avs3",
|
||||
"ffmpeg:bit",
|
||||
"ffmpeg:c2",
|
||||
"ffmpeg:caf",
|
||||
"ffmpeg:cavs",
|
||||
"ffmpeg:chk",
|
||||
"ffmpeg:cvg",
|
||||
"ffmpeg:dfpwm",
|
||||
"ffmpeg:dnxhd",
|
||||
"ffmpeg:dnxhr",
|
||||
"ffmpeg:drc",
|
||||
"ffmpeg:dts",
|
||||
"ffmpeg:dv",
|
||||
"ffmpeg:eac3",
|
||||
"ffmpeg:ec3",
|
||||
"ffmpeg:evc",
|
||||
"ffmpeg:flac",
|
||||
"ffmpeg:g722",
|
||||
"ffmpeg:gsm",
|
||||
"ffmpeg:gxf",
|
||||
"ffmpeg:h261",
|
||||
"ffmpeg:h263",
|
||||
"ffmpeg:h265.mkv",
|
||||
"ffmpeg:h265.mp4",
|
||||
"ffmpeg:h266.mkv",
|
||||
"ffmpeg:hevc",
|
||||
"ffmpeg:ircam",
|
||||
"ffmpeg:ivf",
|
||||
"ffmpeg:js",
|
||||
"ffmpeg:jss",
|
||||
"ffmpeg:latm",
|
||||
"ffmpeg:lbc",
|
||||
"ffmpeg:loas",
|
||||
"ffmpeg:lrc",
|
||||
"ffmpeg:m2a",
|
||||
"ffmpeg:m4a",
|
||||
"ffmpeg:mka",
|
||||
"ffmpeg:mlp",
|
||||
"ffmpeg:mmf",
|
||||
"ffmpeg:mp2",
|
||||
"ffmpeg:mp3",
|
||||
"ffmpeg:mpa",
|
||||
"ffmpeg:msbc",
|
||||
"ffmpeg:oga",
|
||||
"ffmpeg:ogg",
|
||||
"ffmpeg:oma",
|
||||
"ffmpeg:opus",
|
||||
"ffmpeg:pcm",
|
||||
"ffmpeg:psp",
|
||||
"ffmpeg:rco",
|
||||
"ffmpeg:rcv",
|
||||
"ffmpeg:rso",
|
||||
"ffmpeg:sb",
|
||||
"ffmpeg:sbc",
|
||||
"ffmpeg:scc",
|
||||
"ffmpeg:sf",
|
||||
"ffmpeg:sox",
|
||||
"ffmpeg:spdif",
|
||||
"ffmpeg:spx",
|
||||
"ffmpeg:srt",
|
||||
"ffmpeg:ssa",
|
||||
"ffmpeg:sub",
|
||||
"ffmpeg:sup",
|
||||
"ffmpeg:sw",
|
||||
"ffmpeg:tco",
|
||||
"ffmpeg:thd",
|
||||
"ffmpeg:tta",
|
||||
"ffmpeg:ttml",
|
||||
"ffmpeg:tun",
|
||||
"ffmpeg:ub",
|
||||
"ffmpeg:ul",
|
||||
"ffmpeg:uw",
|
||||
"ffmpeg:vag",
|
||||
"ffmpeg:vc1",
|
||||
"ffmpeg:vc2",
|
||||
"ffmpeg:voc",
|
||||
"ffmpeg:vtt",
|
||||
"ffmpeg:vvc",
|
||||
"ffmpeg:w64",
|
||||
"ffmpeg:wav",
|
||||
"ffmpeg:webm",
|
||||
"ffmpeg:wv",
|
||||
"ffmpeg:xface",
|
||||
"ffmpeg:xml",
|
||||
"ffmpeg:y4m",
|
||||
"graphicsmagick:8bim",
|
||||
"graphicsmagick:8bimtext",
|
||||
"graphicsmagick:8bimwtext",
|
||||
|
||||
Reference in New Issue
Block a user