Add ffmpeg tts source

This commit is contained in:
Alex X
2024-05-22 13:00:39 +03:00
parent af05083a1f
commit 53242ea02f
2 changed files with 19 additions and 0 deletions
+2
View File
@@ -195,6 +195,8 @@ func parseArgs(s string) *ffmpeg.Args {
args.Input = device.GetInput(s[i+1:])
case "virtual":
args.Input = virtual.GetInput(s[i+1:])
case "tts":
args.Input = virtual.GetInputTTS(s[i+1:])
}
} else {
args.Input = inputTemplate("file", s, query)
+17
View File
@@ -60,3 +60,20 @@ func GetInput(src string) string {
return input
}
func GetInputTTS(src string) string {
query, err := url.ParseQuery(src)
if err != nil {
return ""
}
input := `-re -f lavfi -i "flite=text='` + query.Get("text") + `'`
// ffmpeg -f lavfi -i flite=list_voices=1
// awb, kal, kal16, rms, slt
if voice := query.Get("voice"); voice != "" {
input += ":voice" + voice
}
return input + `"`
}