Parcourir la source

内嵌封面的命令调整

onecold il y a 11 mois
Parent
commit
b05ca1e7f4
1 fichiers modifiés avec 17 ajouts et 5 suppressions
  1. 17 5
      entry/src/main/ets/common/util/MusicTagUtils.ets

+ 17 - 5
entry/src/main/ets/common/util/MusicTagUtils.ets

@@ -267,15 +267,27 @@ export async function changeMusicCover(
   }
   console.log(`onecold 获取新的图片地址 tempCoverPath = [${tempCoverPath}]`);
   // 构建FFmpeg命令
+  // const commands: string[] = [
+  //   "ffmpeg",
+  //   "-i", inputPath,
+  //   "-i", tempCoverPath,
+  //   "-map", "0:0",           // 映射音频流
+  //   "-map", "1:0",           // 映射封面图片流
+  //   "-c", "copy",            // 复制音频流
+  //   "-id3v2_version", "3",   // ID3v2版本
+  //   "-y",                    // 覆盖输出文件
+  //   finalOutputPath
+  // ];
   const commands: string[] = [
     "ffmpeg",
     "-i", inputPath,
     "-i", tempCoverPath,
-    "-map", "0:0",           // 映射音频流
-    "-map", "1:0",           // 映射封面图片流
-    "-c", "copy",            // 复制音频流
-    "-id3v2_version", "3",   // ID3v2版本
-    "-y",                    // 覆盖输出文件
+    "-map", "0:0",
+    "-map", "1:0",
+    "-c", "copy",
+    "-id3v2_version", "3", // 设置ID3v2.3标签
+    "-disposition:v:0", "attached_pic",// 强制设置图片为封面
+    "-y",
     finalOutputPath
   ];