Add options to set merge output format and sorting format
yt-dlp uses mp4 format by default to merge sources with separate video and audio streams. mp4 format does not handle VP9 codec, so adding the ability to set the merge output format, we can set it to use for ex. mkv, which handles VP9 well. With the possibility of setting the sorting format we can tell yt-dlp which criteria to consider as the best format.
This commit is contained in:
14
goutubedl.go
14
goutubedl.go
@ -211,6 +211,8 @@ type Options struct {
|
||||
DebugLog Printer
|
||||
StderrFn func(cmd *exec.Cmd) io.Writer // if not nil, function to get Writer for stderr
|
||||
HTTPClient *http.Client // Client for download thumbnail and subtitles (nil use http.DefaultClient)
|
||||
MergeOutputFormat string // --merge-output-format
|
||||
SortingFormat string // --format-sort
|
||||
}
|
||||
|
||||
// Version of youtube-dl.
|
||||
@ -474,6 +476,18 @@ func (result Result) Download(ctx context.Context, filter string) (*DownloadResu
|
||||
cmd.Args = append(cmd.Args, "--downloader", result.Options.Downloader)
|
||||
}
|
||||
|
||||
if result.Options.MergeOutputFormat != "" {
|
||||
cmd.Args = append(cmd.Args,
|
||||
"--merge-output-format", result.Options.MergeOutputFormat,
|
||||
)
|
||||
}
|
||||
|
||||
if result.Options.SortingFormat != "" {
|
||||
cmd.Args = append(cmd.Args,
|
||||
"--format-sort", result.Options.SortingFormat,
|
||||
)
|
||||
}
|
||||
|
||||
cmd.Dir = tempPath
|
||||
var w io.WriteCloser
|
||||
dr.reader, w = io.Pipe()
|
||||
|
Reference in New Issue
Block a user