diff --git a/conv/Resize.go b/conv/Resize.go index 8245515..1d0566c 100644 --- a/conv/Resize.go +++ b/conv/Resize.go @@ -36,18 +36,18 @@ func Resize(in mediainfo.BasicInfo, p string) { dst = strings.Join([]string{dst, "resize"}, string(os.PathSeparator)) //二级目录 fname := replace.ForFileName(in.PurgeName) //仅文件名 fname = strings.Join([]string{fname, "mp4"}, ".") - os.Mkdir(dst, 0777) + _ = os.Mkdir(dst, 0777) log.Printf("输出文件夹:%v\n", dst) out := strings.Join([]string{dst, fname}, string(os.PathSeparator)) log.Printf("源文件:%v\t目标文件:%v\n", in.FullPath, out) var cmd *exec.Cmd switch p { case "1920x1080": - cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=-1:1080", "-c:v", "libvpx-vp9", "-crf", "31", "-c:a", "libvorbis", "-ac", "1", out) + cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=-1:1080", "-c:v", "libx265", "-c:a", "libopus", "-ac", "1", out) case "1080x1920": - cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=-1:1920", "-c:v", "libvpx-vp9", "-crf", "31", "-c:a", "libvorbis", "-ac", "1", out) + cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=-1:1920", "-c:v", "libx265", "-c:a", "libopus", "-ac", "1", out) case "1920x1920": - cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=1920:1920", "-c:v", "libvpx-vp9", "-crf", "31", "-c:a", "libvorbis", "-ac", "1", out) + cmd = exec.Command("ffmpeg", "-i", in.FullPath, "-strict", "-2", "-vf", "scale=1920:1920", "-c:v", "libx265", "-c:a", "libopus", "-ac", "1", out) default: log.Fatalf("不正常的视频源:%v\n", in.FullPath) } diff --git a/conv/Rotate.go b/conv/Rotate.go index 7e24ee8..7837c6e 100644 --- a/conv/Rotate.go +++ b/conv/Rotate.go @@ -20,7 +20,7 @@ func RotateVideo(in mediainfo.BasicInfo, direction string) { in.InsertVideoInfo() log.Printf("插入细节信息后:%v\n", in) dst := strings.Join([]string{in.PurgePath, "rotate"}, string(os.PathSeparator)) - os.Mkdir(dst, os.ModePerm) + _ = os.Mkdir(dst, os.ModePerm) FrameCount := "" for _, v := range in.VInfo.Media.Track { if v.Type == "Video" { @@ -58,7 +58,7 @@ func RotateVideo(in mediainfo.BasicInfo, direction string) { log.Printf("没有查询到crf,使用默认crf:%v\n", crf) } log.Printf("获取到的crf=%v\n", crf) - cmd = exec.Command("ffmpeg", "-y", "-i", in.FullPath, "-vf", transport, "-c:v", "libx265", "-crf", crf, "-c:a", "libvorbis", "-ac", "1", "-map_chapters", "-1", out) + cmd = exec.Command("ffmpeg", "-y", "-i", in.FullPath, "-vf", transport, "-c:v", "libx265", "-c:a", "libopus", "-ac", "1", "-map_chapters", "-1", out) err := util.ExecCommand(cmd, FrameCount) if err != nil { os.Exit(-1)