1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package main
import (
"fmt"
ffmpeg "github.com/u2takey/ffmpeg-go"
)
func buildFFmpegCall(ut *Utterance) string {
return fmt.Sprintf(
`yes no | ffmpeg -i "%s" -ss %s -to %s \
-metadata text_source="%s" \
-ar 22050 "%s"`,
ut.FD.AudioPath, ut.LeftTime, ut.RightTime,
ut.FD.VttPath, ut.OutPath,
)
}
func cutoutClipAndTranscode(ut *Utterance) error {
err := ffmpeg.Input(ut.FD.AudioPath,
ffmpeg.KwArgs{
"ss": ut.LeftTime,
"to": ut.RightTime,
},
).Output(ut.OutPath, ffmpeg.KwArgs{
// "ar": "22050",
"metadata": fmt.Sprintf(`source="%s"`, ut.FD.VttPath),
}).OverWriteOutput().ErrorToStdOut().Run()
return err
}
func cutOnEqualParts(filepath, outname, segment string) error {
err := ffmpeg.Input(filepath).
Output(outname+"_%02d.opus",
ffmpeg.KwArgs{
"c": "copy",
"map": 0,
"segment_time": segment,
"f": "segment",
"reset_timestamps": 1,
}).
OverWriteOutput().ErrorToStdOut().Run()
return err
}
|