mirror of
https://github.com/EvolutionAPI/evolution-audio-converter.git
synced 2025-07-13 15:14:50 -06:00
feat: improve audio conversion with enhanced ffmpeg parameters
- Updated Dockerfile to use Go 1.22 - Refined audio conversion parameters for mp3 and mp4 formats - Added specific sample rate, channels, and bitrate settings - Used libmp3lame codec for mp3 conversion - Improved mp4 audio extraction configuration
This commit is contained in:
parent
5f3a073d76
commit
3feb0c7e1b
@ -1,5 +1,5 @@
|
||||
# Usar uma imagem base do Go
|
||||
FROM golang:1.21-alpine
|
||||
FROM golang:1.22-alpine
|
||||
|
||||
# Instalar ffmpeg
|
||||
RUN apk update && apk add --no-cache ffmpeg
|
||||
|
10
main.go
10
main.go
@ -161,9 +161,15 @@ func convertAudio(inputData []byte, format string) ([]byte, int, error) {
|
||||
var cmd *exec.Cmd
|
||||
switch format {
|
||||
case "mp3":
|
||||
cmd = exec.Command("ffmpeg", "-i", "pipe:0", "-f", "mp3", "pipe:1")
|
||||
cmd = exec.Command("ffmpeg", "-i", "pipe:0",
|
||||
"-ar", "44100", // sample rate
|
||||
"-ac", "2", // canais (stereo)
|
||||
"-b:a", "128k", // bitrate
|
||||
"-c:a", "libmp3lame", // codec específico
|
||||
"-f", "mp3", // formato
|
||||
"pipe:1")
|
||||
case "mp4":
|
||||
cmd = exec.Command("ffmpeg", "-i", "pipe:0", "-c:a", "aac", "-f", "mp4", "pipe:1")
|
||||
cmd = exec.Command("ffmpeg", "-i", "pipe:0", "-vn", "-c:a", "aac", "-b:a", "128k", "-f", "adts", "pipe:1")
|
||||
default:
|
||||
cmd = exec.Command("ffmpeg", "-i", "pipe:0", "-ac", "1", "-ar", "16000", "-c:a", "libopus", "-f", "ogg", "pipe:1")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user