-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathffmpeg.go
43 lines (38 loc) · 1.15 KB
/
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
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
func JoinViews(leftFile, rightFile, name string) {
title := fmt.Sprintf("%s BOTH.mkv", name)
outfile := filepath.Join(config.DownloadLocation, title)
cmd := exec.Command("ffmpeg", "-y", "-hide_banner", "-i", leftFile, "-i", rightFile, "-map", "0", "-map", "1", "-c", "copy", outfile)
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + string(output))
}
// fmt.Println("created outfile at", outfile)
err = os.Remove(leftFile)
if err != nil {
fmt.Println("Could not remove", leftFile)
}
// fmt.Println("Removed", leftFile)
err = os.Remove(rightFile)
if err != nil {
fmt.Println("Could not remove", rightFile)
}
// fmt.Println("Removed", rightFile)
}
func JoinChunksFromM3U8(f string, title string) string {
config := GetConfig()
outfile := filepath.Join(config.DownloadLocation, title)
cmd := exec.Command("ffmpeg", "-y", "-hide_banner", "-i", f, "-c", "copy", outfile)
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(fmt.Sprint(err) + ": " + string(output))
}
// fmt.Println("created outfile at", outfile)
return outfile
}