summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2023-02-26 14:52:30 +0600
committerGrail Finder <wohilas@gmail.com>2023-02-26 14:52:30 +0600
commit0c86183009d912213114d29e6f2ff9e04f0b90ff (patch)
tree180038543f4d8982804bec1bab7027d79103b8dc
parent3f99abb502d373cb4b520b212afd4be9ed4da07f (diff)
Fix: make sure outdir existsmain
-rw-r--r--ffmpeg.go2
-rw-r--r--main.go11
2 files changed, 6 insertions, 7 deletions
diff --git a/ffmpeg.go b/ffmpeg.go
index 4dead58..0e45f86 100644
--- a/ffmpeg.go
+++ b/ffmpeg.go
@@ -31,7 +31,7 @@ func cutoutClipAndTranscode(ut *Utterance) error {
func cutOnEqualParts(filepath, outname, segment string) error {
err := ffmpeg.Input(filepath).
- Output(outname+"%02d.opus",
+ Output(outname+"_%02d.opus",
ffmpeg.KwArgs{
"c": "copy",
"map": 0,
diff --git a/main.go b/main.go
index 4cfa197..dab55dd 100644
--- a/main.go
+++ b/main.go
@@ -70,7 +70,7 @@ func hashStr(req string) string {
func fpathToOutname(req string) string {
basename := filepath.Base(req)
h := hashStr(basename)
- return path.Join(outdir, h+".opus")
+ return path.Join(outdir, h)
}
func linesToUtterances(lines []string, fd *FileData) []*Utterance {
@@ -203,6 +203,10 @@ func main() {
outdir = *outDirArg
}
+ if err := os.MkdirAll(outdir, 0755); err != nil {
+ panic(err)
+ }
+
utterances := []*Utterance{}
if vttDir != nil && *vttDir != "" {
utterances = dirRun(*vttDir)
@@ -217,11 +221,6 @@ func main() {
}
fmt.Println("sum of utterances:", len(utterances))
-
- if err := os.MkdirAll(outdir, 0755); err != nil {
- panic(err)
- }
-
filteredUtterances := []*Utterance{}
// === concurrent ===