tidying up a *lot*; add QoL options
This commit is contained in:
parent
84de96df31
commit
2954689784
6 changed files with 261 additions and 154 deletions
|
|
@ -20,7 +20,7 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func ConcatVideo(video *youtube.Video, vodFiles []string) error {
|
||||
func ConcatVideo(video *youtube.Video, vodFiles []string, verbose bool) error {
|
||||
fileListPath := path.Join(
|
||||
path.Dir(video.Filename),
|
||||
"files.txt",
|
||||
|
|
@ -45,18 +45,20 @@ func ConcatVideo(video *youtube.Video, vodFiles []string) error {
|
|||
err := os.WriteFile(
|
||||
fileListPath,
|
||||
[]byte(fileListString),
|
||||
0o644,
|
||||
0644,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write file list: %v", err)
|
||||
}
|
||||
|
||||
err = ffmpeg.Input(fileListPath, ffmpeg.KwArgs{
|
||||
stream := ffmpeg.Input(fileListPath, ffmpeg.KwArgs{
|
||||
"f": "concat",
|
||||
"safe": "0",
|
||||
}).Output(video.Filename, ffmpeg.KwArgs{
|
||||
"c": "copy",
|
||||
}).OverWriteOutput().ErrorToStdOut().Run()
|
||||
}).OverWriteOutput()
|
||||
if verbose { stream = stream.ErrorToStdOut() }
|
||||
err = stream.Run()
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("ffmpeg error: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue