Skip to content

Commit

Permalink
ogg 不指定编码
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyiming748 committed Feb 1, 2024
1 parent f9ddfa8 commit f0b0081
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion processAudio/aac.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Audio2AAC(in GetFileInfo.BasicInfo) {
// 执行转换
fname := replace.ForFileName(in.PurgeName)
out := strings.Join([]string{in.PurgePath, fname, ".ogg"}, "")
cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-c:a", "libvorbis", "-ac", "1", out)
cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-ac", "1", out)
err := util.ExecCommand(cmd)

if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion processAudio/louder.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func LouderAudio(in GetFileInfo.BasicInfo) {
仅使用输入输出和增大电平
*/
func Louder(in, out string) {
cmd := exec.Command("ffmpeg", "-i", in, "-filter:a", "volume=3.0", "-c:a", "libvorbis", "-map_metadata", "-1", out)
cmd := exec.Command("ffmpeg", "-i", in, "-filter:a", "volume=3.0", "-map_metadata", "-1", out)
util.ExecCommand(cmd)
if err := os.RemoveAll(in); err != nil {
slog.Warn("删除失败", slog.String("源文件", in), slog.Any("错误内容", err))
Expand Down
2 changes: 1 addition & 1 deletion processAudio/ogg.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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, "-ac", "1", "-c:a", "libvorbis", "-map_metadata", "-1", out)
cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-ac", "1", "-map_metadata", "-1", out)
err := util.ExecCommand(cmd)
if err == nil {
if err = os.RemoveAll(in.FullPath); err != nil {
Expand Down
12 changes: 6 additions & 6 deletions processAudio/speedUp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ 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", "-c:a", "libvorbis", "-ac", "1", "-map_metadata", "-1", out)
cmd := exec.Command("ffmpeg", "-i", in, "-filter:a", atempo, "-vn", "-ac", "1", "-map_metadata", "-1", out)
util.ExecCommand(cmd)
if err := os.RemoveAll(in); err != nil {
slog.Warn("删除失败", slog.String("源文件", in), slog.Any("错误内容", err))
} else {
slog.Debug("删除成功", slog.String("源文件", in))
}
//if err := os.RemoveAll(in); err != nil {
// slog.Warn("删除失败", slog.String("源文件", in), slog.Any("错误内容", err))
//} else {
// slog.Debug("删除成功", slog.String("源文件", in))
//}
}

/*
Expand Down
8 changes: 8 additions & 0 deletions processAudio/unit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package processAudio

import "testing"

func TestLouderAudios(t *testing.T) {
//LouderAllAudios("/Users/zen/container/useWget", "mp3")
SpeedUpAllAudios("/Users/zen/container/useWget", "ogg", "65")
}

0 comments on commit f0b0081

Please sign in to comment.