forked from pnicto/impartus-video-downloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffmpeg.go
35 lines (27 loc) · 980 Bytes
/
ffmpeg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"os/exec"
"path/filepath"
)
func JoinChunks(path, title string) string {
config := GetConfig()
outfile := filepath.Join(config.DownloadLocation, title)
outfile = fmt.Sprintf("%s.mkv", outfile)
cmd := exec.Command("ffmpeg", "-y", "-hide_banner", "-allowed_extensions", "ts,m3u8", "-threads", fmt.Sprint(config.Threads), "-i", path, "-c", "copy", outfile)
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + string(output))
}
return outfile
}
func JoinViews(leftFile, rightFile, title string) {
config := GetConfig()
outfile := fmt.Sprintf("%s BOTH.mkv", leftFile[:len(leftFile)-9])
cmd := exec.Command("ffmpeg", "-y", "-threads", fmt.Sprint(config.Threads), "-hide_banner", "-i", rightFile, "-i", leftFile, "-map", "0", "-map", "1", "-c", "copy", outfile)
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + string(output))
}
fmt.Println(outfile)
}