diff --git a/conf.ini b/conf.ini index a2075a9..0ce6939 100644 --- a/conf.ini +++ b/conf.ini @@ -6,9 +6,9 @@ # mission = image # mission = rotate # mission = resize -mission = avmerger +# mission = avmerger # mission = extractAAC -# mission = speedUpAudio +mission = speedUpAudio # mission = speedUpVideo # mission = gif # mission = encoder @@ -32,7 +32,7 @@ txt = txt [root] folder = /Users/zen/git image = /Volumes/noname -audio = /mnt/e/audio +audio = /Users/zen/Downloads/Telegram Desktop video = /mnt/f/large/artistress/littleSubGirl gif = /Users/zen/Downloads/Fugtrup collection/archive/webp txt = /Users/zen/Downloads/tele diff --git a/main.go b/main.go index 2518b08..6f7265a 100644 --- a/main.go +++ b/main.go @@ -181,7 +181,7 @@ func main() { slog.Debug("开始提取哔哩哔哩音频进程", slog.String("根目录", root)) merge.ExtractAAC(root) case "speedUpAudio": - root = util.GetVal("root", "speedUp") + root = util.GetVal("root", "audio") pattern = util.GetVal("pattern", "audio") pattern = strings.Join([]string{pattern, strings.ToUpper(pattern)}, ";") speed := util.GetVal("speed", "audition") diff --git a/processAudio/aac.go b/processAudio/aac.go index f1b8ec6..27bc41b 100644 --- a/processAudio/aac.go +++ b/processAudio/aac.go @@ -13,8 +13,8 @@ import ( func Audio2AAC(in GetFileInfo.BasicInfo) { // 执行转换 fname := replace.ForFileName(in.PurgeName) - out := strings.Join([]string{in.PurgePath, fname, ".aac"}, "") - cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-ac", "1", out) + out := strings.Join([]string{in.PurgePath, fname, ".ogg"}, "") + cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-c:a", "libvorbis", "-ac", "1", out) err := util.ExecCommand(cmd) if err == nil { diff --git a/processAudio/ogg.go b/processAudio/ogg.go index 4e691a6..563af93 100644 --- a/processAudio/ogg.go +++ b/processAudio/ogg.go @@ -13,7 +13,7 @@ func Audio2OGG(in GetFileInfo.BasicInfo) { fname := replace.ForFileName(in.PurgeName) //fname=r out := strings.Join([]string{in.PurgePath, fname, ".ogg"}, "") - cmd := exec.Command("ffmpeg", "-i", in.FullPath, out) + cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-c:a", "libvorbis", out) _ = util.ExecCommand(cmd) //if err == nil { // if err = os.RemoveAll(in.FullPath); err != nil { diff --git a/processAudio/speedUp.go b/processAudio/speedUp.go index ded50a9..f386f35 100644 --- a/processAudio/speedUp.go +++ b/processAudio/speedUp.go @@ -45,7 +45,7 @@ func SpeedupAudio(in GetFileInfo.BasicInfo, speed string) { dst := strings.Join([]string{in.PurgePath, "speed"}, "") //目标文件目录 os.Mkdir(dst, 0777) fname := replace.ForFileName(in.PurgeName) - fname = strings.Join([]string{fname, "aac"}, ".") + fname = strings.Join([]string{fname, "ogg"}, ".") slog.Debug("补全后的 fname", slog.String("fname", fname)) out := strings.Join([]string{dst, fname}, string(os.PathSeparator)) slog.Debug("io", slog.String("输入文件", in.FullPath), slog.String("输出文件", out)) @@ -62,7 +62,7 @@ func SpeedupAudio(in GetFileInfo.BasicInfo, speed string) { func speedUp(in, out string, speed string) { ff := audition2ffmpeg(speed) atempo := strings.Join([]string{"atempo", ff}, "=") - cmd := exec.Command("ffmpeg", "-i", in, "-filter:a", atempo, "-vn", "-ac", "1", out) + cmd := exec.Command("ffmpeg", "-i", in, "-filter:a", atempo, "-vn", "-c:a", "libvorbis", "-ac", "1", out) util.ExecCommand(cmd) if err := os.RemoveAll(in); err != nil { slog.Warn("删除失败", slog.String("源文件", in), slog.Any("错误内容", err)) diff --git a/processVideo/h265.go b/processVideo/h265.go index 269971e..aa42995 100644 --- a/processVideo/h265.go +++ b/processVideo/h265.go @@ -69,7 +69,7 @@ func ProcessVideo2H265(in GetFileInfo.BasicInfo, threads string) { slog.Debug("", slog.String("out", out), slog.String("extName", in.PurgeExt)) mp4 := strings.Replace(out, in.PurgeExt, "mp4", -1) slog.Debug("调试", slog.String("输入文件", in.FullPath), slog.String("输出文件", mp4)) - cmd := exec.Command("ffmpeg", "-threads", threads, "-i", in.FullPath, "-c:v", "libx265", "-c:a", "aac", "-ac", "1", "-tag:v", "hvc1", "-map_chapters", "-1", "-threads", threads, mp4) + cmd := exec.Command("ffmpeg", "-threads", threads, "-i", in.FullPath, "-c:v", "libx265", "-c:a", "libvorbis", "-ac", "1", "-tag:v", "hvc1", "-map_chapters", "-1", "-threads", threads, mp4) bitRate, _ := GetFileInfo.GetBitRate(in.FullPath) slog.Debug("bitrate in h265", slog.String("bitrate", bitRate)) b := strings.Join([]string{bitRate, "k"}, "")