tidying up a *lot*; add QoL options

This commit is contained in:
ari melody 2026-01-28 12:50:11 +00:00
parent 84de96df31
commit 2954689784
Signed by: ari
GPG key ID: CF99829C92678188
6 changed files with 261 additions and 154 deletions

View file

@ -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)