Skip to content

Commit

Permalink
批量转换ogg
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyiming748 committed Jan 9, 2024
1 parent 6e3f3d4 commit 5fe7980
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions conf.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[main]
# mission = i&v
mission = video
# mission = OGG
# mission = video
mission = OGG
# mission = audio
# mission = image
# mission = rotate
Expand Down Expand Up @@ -32,8 +32,8 @@ txt = txt
[root]
folder = /Users/zen/git
image = /Volumes/noname
audio = /Users/zen/Downloads/Telegram Desktop
video = /mnt/f/Downloads/武林外传/50
audio = /mnt/f/music/audio
video = /mnt/f/Downloads/武林外传/60
gif = /Users/zen/Downloads/Fugtrup collection/archive/webp
txt = /Users/zen/Downloads/tele
bilibili = /mnt/d/git/processAll/merge/downloads
Expand Down
20 changes: 11 additions & 9 deletions processAudio/ogg.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package processAudio

import (
"log/slog"
"os"
"os/exec"
"processAll/GetFileInfo"
"processAll/replace"
Expand All @@ -13,15 +15,15 @@ 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, "-c:a", "libvorbis", out)
_ = util.ExecCommand(cmd)
//if err == nil {
// if err = os.RemoveAll(in.FullPath); err != nil {
// slog.Warn("删除失败", slog.String("源文件", in.FullPath), slog.Any("错误", err))
// } else {
// slog.Debug("删除成功", slog.String("源文件", in.FullPath))
// }
//}
cmd := exec.Command("ffmpeg", "-i", in.FullPath, "-ac", "1", "-c:a", "libvorbis", out)
err := util.ExecCommand(cmd)
if err == nil {
if err = os.RemoveAll(in.FullPath); err != nil {
slog.Warn("删除失败", slog.String("源文件", in.FullPath), slog.Any("错误", err))
} else {
slog.Debug("删除成功", slog.String("源文件", in.FullPath))
}
}
}

func Audios2OGG(dir, pattern string) {
Expand Down

0 comments on commit 5fe7980

Please sign in to comment.