mediavideo.go 817 B
Newer Older
package mediamdl

// data := `ffmpeg  -i ` + inputPath + ` -strict -2 -s 720x480 -vf scale=1280:0 -c:v libx264 -preset veryslow -crf 24 -y ` + outputfilePath

// CompressVideo - CompressVideo
func compressVideo(inputPath, outputfilePath string) error {
	commandargs := []string{`-i`, inputPath, `-strict`, `-2`, `-vf`, `scale=iw:-1`, `-c:v`, `libx264`, `-preset`, `veryslow`, `-crf`, `24`, `-y`, outputfilePath}
	return executeargs("ffmpeg", commandargs)
}

// ResizeVideo - ResizeVideo
func resizeVideo(inputPath, targetwidth, targetheight, outputfilePath string) error {
	commandargs := []string{`-i`, inputPath, `-strict`, `-2`, `-s`, targetwidth + `x` + targetheight, `-vf`, `scale=iw:-1`, `-c:v`, `libx264`, `-preset`, `veryslow`, `-crf`, `24`, `-y`, outputfilePath}
	return executeargs("ffmpeg", commandargs)
}