feat: seek() filter and ffmpeg.SeekPosition, ffmpeg.SeekDuration

* feat: seek() filter and ffmpeg.SeekPosition, ffmpeg.SeekDuration
This commit is contained in:
Adrian Shum 2022-10-23 14:47:09 +08:00 committed by GitHub
parent 7350619928
commit 38b1b200ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 60 additions and 20 deletions

View file

@ -136,6 +136,16 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp
}
}
}
case "seek":
if ts, e := time.ParseDuration(filter.Args); e == nil {
if err = av.SeekDuration(ts); err != nil {
return
}
} else if f, e := strconv.ParseFloat(filter.Args, 64); e == nil {
if err = av.SeekPosition(f); err != nil {
return
}
}
case "max_frames":
n, _ := strconv.Atoi(filter.Args)
if err = av.ProcessFrames(n); err != nil {