summaryrefslogtreecommitdiff
path: root/mkvtool
diff options
context:
space:
mode:
authorb5f0d6c3 <[email protected]>2022-05-06 10:46:55 +0800
committerb5f0d6c3 <[email protected]>2022-05-06 10:46:55 +0800
commit79f40d4f7bedf2554d072f6ded4eb73373dd7319 (patch)
treebef73cc28e3800ec02d3764302eddbc601ff8d8c /mkvtool
parent8c382de8c87260d68b9c10e2bf687cbd53e3beb8 (diff)
update
Diffstat (limited to 'mkvtool')
-rw-r--r--mkvtool/main.go15
-rw-r--r--mkvtool/utils.go28
2 files changed, 9 insertions, 34 deletions
diff --git a/mkvtool/main.go b/mkvtool/main.go
index 5ce6de8..2e2501a 100644
--- a/mkvtool/main.go
+++ b/mkvtool/main.go
@@ -17,7 +17,7 @@ import (
)
const appName = "MKV Tool"
-const appVer = "v3.8.4"
+const appVer = "v3.8.5"
const tTitle = appName + " " + appVer
var appFN = fmt.Sprintf("%s %s %s/%s", appName, appVer, runtime.GOOS, runtime.GOARCH)
@@ -64,7 +64,9 @@ func main() {
mks := false
ck := false
cks := false
- t := false
+ b := false
+ t := ""
+ e := ""
sl, st := "", ""
af, ao := "", ""
flog := ""
@@ -103,6 +105,9 @@ func main() {
flag.StringVar(&flog, "log", "", "Log file path.")
flag.StringVar(&pf, "pf", "23.976", "PGS frame rate:23.976, 24, 25, 30, 29.97, 50, 59.94, 60 or custom fps like 15/1. (ass2pgs only)")
flag.StringVar(&pr, "pr", "1920*1080", "PGS resolution:720p, 1080p, 2k, or with custom resolution like 720*480. (ass2pgs only)")
+ flag.StringVar(&t, "t", "", `Create test video source path(enter "-" for blank video).`)
+ flag.BoolVar(&b, "b", false, `Create test video with burn subtitle.`)
+ flag.StringVar(&e, "e", "libx264", `Create test video use encoder.`)
flag.BoolVar(&v, "v", false, "Show app info.")
flag.Parse()
@@ -190,16 +195,14 @@ func main() {
if len(*asses) > 0 {
if !processer.ASSFontSubset(*asses, af, ao, !ans, nil) {
ec++
- } else if t {
+ } else if t != "" {
d, _, _, _ := splitPath((*asses)[0])
if ao == "" {
ao = path.Join(d, "subsetted")
}
_asses, _ := findPath(ao, `\.ass$`)
if len(_asses) > 0 {
- p := fmt.Sprintf("test-%s.a", randomStr(8))
- p = path.Join(d, p)
- processer.CreateTestVideo(_asses, ao, "nvenc_h264", p, nil)
+ processer.CreateTestVideo(_asses, t, ao, e, b, nil)
}
}
return
diff --git a/mkvtool/utils.go b/mkvtool/utils.go
index 95bdbfb..e60afe8 100644
--- a/mkvtool/utils.go
+++ b/mkvtool/utils.go
@@ -2,12 +2,10 @@ package main
import (
"errors"
- "math/rand"
"os"
"path/filepath"
"regexp"
"strings"
- "time"
)
func queryPath(path string, cb func(string) bool) error {
@@ -50,29 +48,3 @@ func splitPath(p string) (dir, name, ext, namewithoutext string) {
}
return
}
-
-var r = rand.New(rand.NewSource(time.Now().UnixNano()))
-
-func randomN(n int) int {
- return r.Intn(n)
-}
-
-func randomNumber(min, max int) int {
- sub := max - min + 1
- if sub <= 1 {
- return min
- }
- return min + randomN(sub)
-}
-
-func randomStr(l int) string {
- str := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- bytes := []byte(str)
- var result []byte
- lstr := len(str) - 1
- for i := 0; i < l; i++ {
- n := randomNumber(0, lstr)
- result = append(result, bytes[n])
- }
- return string(result)
-}