Skip to content

Commit 7947f7e

Browse files
committed
- [+] add -tkb TranspBy wireframe
1 parent 0b29c9d commit 7947f7e

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

config.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type Options struct {
3939
Karaoke bool // Add a karaoke audio track to .mp4 MTV
4040
TranspFrom string // Transpose song's key from (e.g. C/C#/Db/D etc)
4141
TranspTo string // Transpose song's key to (e.g. -tkf C -tkt Db)
42+
TranspBy int // Transpose song by (e.g. +2, -3, etc) chromatic scale
4243
Lang string // language selection for audio stream extraction
4344
SEL mFlags // subtitle encoding language (language picked for reencoded video)
4445
OptExtra string // more options that will pass to ffmpeg program
@@ -136,6 +137,8 @@ func initVars() {
136137
"Transpose song's key from (e.g. C/C#/Db/D etc)")
137138
flag.StringVar(&Opts.TranspTo, "tkt", "",
138139
"Transpose song's key to (e.g. -tkf C -tkt Db)")
140+
flag.IntVar(&Opts.TranspBy, "tkb", 0,
141+
"Transpose song by (e.g. +2, -3, etc) chromatic scale")
139142
flag.StringVar(&Opts.Lang, "lang", "eng",
140143
"language selection for audio stream extraction")
141144
flag.Var(&Opts.SEL, "sel",
@@ -288,6 +291,12 @@ func initVals() {
288291
len(os.Getenv("FFCVT_TKT")) != 0 {
289292
Opts.TranspTo = os.Getenv("FFCVT_TKT")
290293
}
294+
if Opts.TranspBy == 0 &&
295+
len(os.Getenv("FFCVT_TKB")) != 0 {
296+
if i, err := strconv.Atoi(os.Getenv("FFCVT_TKB")); err == nil {
297+
Opts.TranspBy = i
298+
}
299+
}
291300
if len(Opts.Lang) == 0 &&
292301
len(os.Getenv("FFCVT_LANG")) != 0 {
293302
Opts.Lang = os.Getenv("FFCVT_LANG")
@@ -342,7 +351,7 @@ func initVals() {
342351

343352
}
344353

345-
const usageSummary = " -cfg\tcfg file to define your own targets: webm/wx/youtube etc (FFCVT_CFG)\n -t\ttarget type: webm/x265-opus/x264-mp3/wx/youtube/copy, or empty (FFCVT_T)\n -ves\tvideo encoding method set (FFCVT_VES)\n -aes\taudio encoding method set (FFCVT_AES)\n -ses\tsubtitle encoding method set (FFCVT_SES)\n -vep\tvideo encoding method prepend (FFCVT_VEP)\n -aep\taudio encoding method prepend (FFCVT_AEP)\n -sep\tsubtitle encoding method prepend (FFCVT_SEP)\n -vea\tvideo encoding method append (FFCVT_VEA)\n -aea\taudio encoding method append (FFCVT_AEA)\n -abr\taudio bitrate (64k for opus, 256k for mp3) (FFCVT_ABR)\n -crf\tthe CRF value: 0-51. Higher CRF gives lower quality\n\t (28 for x265, ~ 23 for x264) (FFCVT_CRF)\n\n -d\tdirectory that hold input files (FFCVT_D)\n -f\tinput file name (either -d or -f must be specified) (FFCVT_F)\n -sym\tsymlinks will be processed as well (FFCVT_SYM)\n -exts\textension list for all the files to be queued (FFCVT_EXTS)\n -suf\tsuffix to the output file names (FFCVT_SUF)\n -ext\textension for the output file (FFCVT_EXT)\n -w\twork directory that hold output files (FFCVT_W)\n\n -ac\tcopy audio codec (FFCVT_AC)\n -vc\tcopy video codec (FFCVT_VC)\n -an\tno audio, output video only (FFCVT_AN)\n -vn\tno video, output audio only (FFCVT_VN)\n -vss\tvideo: same size (FFCVT_VSS)\n -C,Cut\tCut segment(s) out to keep. Specify in the form of start-[end],\n\tstrictly in the format of hh:mm:ss, and may repeat (FFCVT_C,CUT)\n -S,Seg\tSplit video into multiple segments (strictly in format: hh:mm:ss) (FFCVT_S,SEG)\n -Speed\tSpeed up/down video playback speed (e.g. 1.28) (FFCVT_SPEED)\n -K,karaoke\tAdd a karaoke audio track to .mp4 MTV (FFCVT_K,KARAOKE)\n -tkf\tTranspose song's key from (e.g. C/C#/Db/D etc) (FFCVT_TKF)\n -tkt\tTranspose song's key to (e.g. -tkf C -tkt Db) (FFCVT_TKT)\n -lang\tlanguage selection for audio stream extraction (FFCVT_LANG)\n -sel\tsubtitle encoding language (language picked for reencoded video) (FFCVT_SEL)\n -o\tmore options that will pass to ffmpeg program (FFCVT_O)\n -ato-opus\taudio encode to opus, using -abr (FFCVT_ATO_OPUS)\n -vto-x265\tvideo video encode to x265, using -crf (FFCVT_VTO_X265)\n\n -p\tpar2create, create par2 files (in work directory) (FFCVT_P)\n -nc\tno clobber, do not queue those already been converted (FFCVT_NC)\n -bt\tbreath time, interval between conversion to take a breath (FFCVT_BT)\n -maxc\tmax conversion done each run (default no limit) (FFCVT_MAXC)\n -n\tno exec, dry run (FFCVT_N)\n\n -force\toverwrite any existing none-empty file (FFCVT_FORCE)\n -debug\tdebugging level (FFCVT_DEBUG)\n -ffmpeg\tffmpeg program executable name (FFCVT_FFMPEG)\n -ffprobe\tffprobe program execution (FFCVT_FFPROBE)\n -version\tprint version then exit (FFCVT_VERSION)\n\nDetails:\n\n"
354+
const usageSummary = " -cfg\tcfg file to define your own targets: webm/wx/youtube etc (FFCVT_CFG)\n -t\ttarget type: webm/x265-opus/x264-mp3/wx/youtube/copy, or empty (FFCVT_T)\n -ves\tvideo encoding method set (FFCVT_VES)\n -aes\taudio encoding method set (FFCVT_AES)\n -ses\tsubtitle encoding method set (FFCVT_SES)\n -vep\tvideo encoding method prepend (FFCVT_VEP)\n -aep\taudio encoding method prepend (FFCVT_AEP)\n -sep\tsubtitle encoding method prepend (FFCVT_SEP)\n -vea\tvideo encoding method append (FFCVT_VEA)\n -aea\taudio encoding method append (FFCVT_AEA)\n -abr\taudio bitrate (64k for opus, 256k for mp3) (FFCVT_ABR)\n -crf\tthe CRF value: 0-51. Higher CRF gives lower quality\n\t (28 for x265, ~ 23 for x264) (FFCVT_CRF)\n\n -d\tdirectory that hold input files (FFCVT_D)\n -f\tinput file name (either -d or -f must be specified) (FFCVT_F)\n -sym\tsymlinks will be processed as well (FFCVT_SYM)\n -exts\textension list for all the files to be queued (FFCVT_EXTS)\n -suf\tsuffix to the output file names (FFCVT_SUF)\n -ext\textension for the output file (FFCVT_EXT)\n -w\twork directory that hold output files (FFCVT_W)\n\n -ac\tcopy audio codec (FFCVT_AC)\n -vc\tcopy video codec (FFCVT_VC)\n -an\tno audio, output video only (FFCVT_AN)\n -vn\tno video, output audio only (FFCVT_VN)\n -vss\tvideo: same size (FFCVT_VSS)\n -C,Cut\tCut segment(s) out to keep. Specify in the form of start-[end],\n\tstrictly in the format of hh:mm:ss, and may repeat (FFCVT_C,CUT)\n -S,Seg\tSplit video into multiple segments (strictly in format: hh:mm:ss) (FFCVT_S,SEG)\n -Speed\tSpeed up/down video playback speed (e.g. 1.28) (FFCVT_SPEED)\n -K,karaoke\tAdd a karaoke audio track to .mp4 MTV (FFCVT_K,KARAOKE)\n -tkf\tTranspose song's key from (e.g. C/C#/Db/D etc) (FFCVT_TKF)\n -tkt\tTranspose song's key to (e.g. -tkf C -tkt Db) (FFCVT_TKT)\n -tkb\tTranspose song by (e.g. +2, -3, etc) chromatic scale (FFCVT_TKB)\n -lang\tlanguage selection for audio stream extraction (FFCVT_LANG)\n -sel\tsubtitle encoding language (language picked for reencoded video) (FFCVT_SEL)\n -o\tmore options that will pass to ffmpeg program (FFCVT_O)\n -ato-opus\taudio encode to opus, using -abr (FFCVT_ATO_OPUS)\n -vto-x265\tvideo video encode to x265, using -crf (FFCVT_VTO_X265)\n\n -p\tpar2create, create par2 files (in work directory) (FFCVT_P)\n -nc\tno clobber, do not queue those already been converted (FFCVT_NC)\n -bt\tbreath time, interval between conversion to take a breath (FFCVT_BT)\n -maxc\tmax conversion done each run (default no limit) (FFCVT_MAXC)\n -n\tno exec, dry run (FFCVT_N)\n\n -force\toverwrite any existing none-empty file (FFCVT_FORCE)\n -debug\tdebugging level (FFCVT_DEBUG)\n -ffmpeg\tffmpeg program executable name (FFCVT_FFMPEG)\n -ffprobe\tffprobe program execution (FFCVT_FFPROBE)\n -version\tprint version then exit (FFCVT_VERSION)\n\nDetails:\n\n"
346355

347356
// Usage function shows help on commandline usage
348357
func Usage() {
@@ -352,6 +361,8 @@ func Usage() {
352361
fmt.Fprintf(os.Stderr, usageSummary)
353362
flag.PrintDefaults()
354363
fmt.Fprintf(os.Stderr,
355-
"\nTo reduce output, use `-debug 0`, e.g., `ffcvt -force -debug 0 -f testf.mp4 ...`\n")
364+
`
365+
To reduce output, use '-debug 0', e.g., 'ffcvt -force -debug 0 -f testf.mp4 ...'
366+
`)
356367
os.Exit(0)
357368
}

ffcvt_cli.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ Options:
222222
Value: '""'
223223
Usage: "Transpose song's key to (e.g. -tkf C -tkt Db)"
224224

225+
- Name: TranspBy
226+
Type: int
227+
Flag: tkb
228+
Value: 0
229+
Usage: "Transpose song by (e.g. +2, -3, etc) chromatic scale"
230+
225231
- Name: Lang
226232
Type: string
227233
Flag: lang
@@ -322,5 +328,6 @@ UsageSummary: "TRUE"
322328

323329
UsageLead: "\\nUsage:\\n %s [flags] \\n\\nFlags:\\n\\n"
324330

325-
UsageEnd: "\\nTo reduce output, use `-debug 0`, e.g., `ffcvt -force -debug 0 -f testf.mp4 ...`\\n"
331+
UsageEnd: |
326332
333+
To reduce output, use '-debug 0', e.g., 'ffcvt -force -debug 0 -f testf.mp4 ...'

0 commit comments

Comments
 (0)