fix(ffmpeg): preserve cover art when converting to m4b (#679)

This commit is contained in:
monsterlag
2026-10-21 17:32:03 -04:00
committed by GitHub
parent 600abbf268
commit 550f83855b
2 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -721,7 +721,7 @@ export async function convert(
let extraArgs: string[] = [];
let message = "Done";
const audioFormatsWithCover = ["m4a", "mp3", "flac", "ogg"];
const audioFormatsWithCover = ["m4a", "m4b", "mp3", "flac", "ogg"];
const audioFormatsNoCover = ["wav", "aac"];
if (audioFormatsWithCover.includes(convertTo)) {
+19 -16
View File
@@ -89,23 +89,26 @@ test.each([
expect(calls[0]).toEqual(["-i", "in.mkv", "-c:v", codec, "out.video"]);
});
test.each(["m4a", "mp3", "flac", "ogg"])("keeps embedded cover art for %s output", async (ext) => {
await convert("in.wav", "wav", ext, `out.${ext}`, undefined, mockExecFile);
test.each(["m4a", "m4b", "mp3", "flac", "ogg"])(
"keeps embedded cover art for %s output",
async (ext) => {
await convert("in.mp3", "mp3", ext, `out.${ext}`, undefined, mockExecFile);
expect(calls[0]).toEqual([
"-i",
"in.wav",
"-map",
"0:a",
"-map",
"0:v:disp:attached_pic?",
"-c:v",
"copy",
"-disposition:v",
"attached_pic",
`out.${ext}`,
]);
});
expect(calls[0]).toEqual([
"-i",
"in.mp3",
"-map",
"0:a",
"-map",
"0:v:disp:attached_pic?",
"-c:v",
"copy",
"-disposition:v",
"attached_pic",
`out.${ext}`,
]);
},
);
test.each(["wav", "aac"])("drops video streams for %s output", async (ext) => {
await convert("in.mp3", "mp3", ext, `out.${ext}`, undefined, mockExecFile);