Skip to content

Commit defc5df

Browse files
committed
- [+] implement option -sel, fixed #12
1 parent f1bfc68 commit defc5df

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

ffcvt.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,16 @@ func transcodeFile(inputName string) {
278278
return
279279
}
280280
debug(fsinfo, 4)
281-
// if there are more than one audio or subtitle stream
281+
/*
282+
283+
Cases when `-map`s are necessary
284+
285+
- more than one audio stream, and we pick eng stream only
286+
- more than one subtitle stream, and
287+
* output all subtitle streams (default, no -sel), or
288+
* pick specific subtitle stream(s) via -sel
289+
290+
*/
282291
allAudioStreams := regexp.MustCompile(`Stream #0:.+: Audio: (.+)`).
283292
FindAllStringSubmatch(fsinfo, -1)
284293
if len(allAudioStreams) > 1 ||
@@ -290,7 +299,14 @@ func transcodeFile(inputName string) {
290299
oldEPUsed = true
291300
Opts.VEP += " -map 0:v"
292301
Opts.AEP += " -map 0:a:m:language:" + Opts.Lang
293-
Opts.SEP += " -map 0:s"
302+
//log.Printf("%s: Opts.SEL - %#v", progname, Opts.SEL)
303+
if len(Opts.SEL) == 0 {
304+
Opts.SEP += " -map 0:s"
305+
} else {
306+
for _, val := range Opts.SEL {
307+
Opts.SEP += " -map 0:s:m:language:" + val
308+
}
309+
}
294310
} else {
295311
debug(inputName+" has single audio stream", 2)
296312
dealSurroundSound(allAudioStreams[0][1])

0 commit comments

Comments
 (0)