audio.go 294 B

12345678910111213
  1. package services
  2. import "os/exec"
  3. // 转换音频文件格式
  4. func ConvertAudioFormat(inputFilePath, outputFilePath string) (err error) {
  5. cmd := exec.Command("ffmpeg", "-i", inputFilePath, "-codec:a", "libmp3lame", outputFilePath)
  6. err = cmd.Run()
  7. if err != nil {
  8. return
  9. }
  10. return nil
  11. }