Add video codec profiles (#5154)

This commit is contained in:
NodudeWasTaken
2024-08-27 10:03:48 +02:00
committed by GitHub
parent 3089e1ad69
commit ce47efc415
5 changed files with 80 additions and 49 deletions

View File

@@ -24,13 +24,13 @@ func (o *ScreenshotOptions) setDefaults() {
}
type ScreenshotOutputType struct {
codec ffmpeg.VideoCodec
codec *ffmpeg.VideoCodec
format ffmpeg.Format
}
func (t ScreenshotOutputType) Args() []string {
var ret []string
if t.codec != "" {
if t.codec != nil {
ret = append(ret, t.codec.Args()...)
}
if t.format != "" {
@@ -45,7 +45,7 @@ var (
format: "image2",
}
ScreenshotOutputTypeBMP = ScreenshotOutputType{
codec: ffmpeg.VideoCodecBMP,
codec: &ffmpeg.VideoCodecBMP,
format: "rawvideo",
}
)

View File

@@ -11,7 +11,7 @@ type SpliceOptions struct {
OutputPath string
Format ffmpeg.Format
VideoCodec ffmpeg.VideoCodec
VideoCodec *ffmpeg.VideoCodec
VideoArgs ffmpeg.Args
AudioCodec ffmpeg.AudioCodec
@@ -45,11 +45,11 @@ func Splice(concatFile string, options SpliceOptions) ffmpeg.Args {
args = args.Overwrite()
// if video codec is not provided, then use copy
if options.VideoCodec == "" {
options.VideoCodec = ffmpeg.VideoCodecCopy
if options.VideoCodec == nil {
options.VideoCodec = &ffmpeg.VideoCodecCopy
}
args = args.VideoCodec(options.VideoCodec)
args = args.VideoCodec(*options.VideoCodec)
args = args.AppendArgs(options.VideoArgs)
// if audio codec is not provided, then use copy