From 3f99abb502d373cb4b520b212afd4be9ed4da07f Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 26 Feb 2023 14:48:15 +0600 Subject: Feat: use md5 hash to save on space with shorter names --- ffmpeg.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ffmpeg.go') diff --git a/ffmpeg.go b/ffmpeg.go index 7c5b6fd..4dead58 100644 --- a/ffmpeg.go +++ b/ffmpeg.go @@ -6,6 +6,16 @@ import ( 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{ @@ -19,9 +29,9 @@ func cutoutClipAndTranscode(ut *Utterance) error { return err } -func cutOnEqualParts(filepath, segment string) error { +func cutOnEqualParts(filepath, outname, segment string) error { err := ffmpeg.Input(filepath). - Output(filepath+"%03d.opus", + Output(outname+"%02d.opus", ffmpeg.KwArgs{ "c": "copy", "map": 0, -- cgit v1.2.3