Finished the transcoding job
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/tag/woodpecker Pipeline was successful
This commit is contained in:
parent
1548701ed3
commit
02dfc7c291
2
adept.go
2
adept.go
@ -17,7 +17,7 @@ func main() {
|
|||||||
// archive file
|
// archive file
|
||||||
r.ArchiveFile(i.Name())
|
r.ArchiveFile(i.Name())
|
||||||
// transcode file
|
// transcode file
|
||||||
// TODO - t.Transcode(i.Name())
|
transcoder.Transcode(i.Name())
|
||||||
// clean up source file
|
// clean up source file
|
||||||
r.CleanupFile(i.Name())
|
r.CleanupFile(i.Name())
|
||||||
}
|
}
|
||||||
|
36
transcoder/transcoder.go
Normal file
36
transcoder/transcoder.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package transcoder
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Transcode(inFile string) {
|
||||||
|
// create ingest and archive paths
|
||||||
|
ingestPath := filepath.Join(viper.GetString("transcoder.repository"), "ingest", inFile)
|
||||||
|
outputPath := filepath.Join(viper.GetString("transcoder.repository"), "output", inFile)
|
||||||
|
|
||||||
|
log.Printf("Transcoding video file %s.", ingestPath)
|
||||||
|
|
||||||
|
cmd := exec.Command("/usr/bin/ffmpeg",
|
||||||
|
"-i", ingestPath,
|
||||||
|
"-y",
|
||||||
|
"-f", viper.GetString("transcoder.video_format"),
|
||||||
|
"-c:v", viper.GetString("transcoder.video_codec"),
|
||||||
|
"-s", viper.GetString("transcoder.video_resolution"),
|
||||||
|
"-r", viper.GetString("transcoder.video_framerate"),
|
||||||
|
"-vf", fmt.Sprintf("format=%s", viper.GetString("transcoder.video_color")),
|
||||||
|
"-profile:v", viper.GetString("transcoder.video_profile"),
|
||||||
|
"-c:a", viper.GetString("transcoder.audio_codec"),
|
||||||
|
outputPath)
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
log.Fatalf("Error while transcoding: %s.", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user