Skip to content

Commit

Permalink
Add an ability to blur certain chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed Oct 30, 2023
1 parent de8f4ad commit 0884c33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions markut.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Chunk struct {
Name string
Loc Loc
InputPath string
Blur bool
}

func (chunk Chunk) Duration() Secs {
Expand Down Expand Up @@ -346,6 +347,13 @@ func evalMarkutFile(path string) (context EvalContext, ok bool) {
return
}
context.modified_cuts = append(context.modified_cuts, len(context.chunks) - 1)
case "blur":
if len(context.chunks) == 0 {
fmt.Printf("%s: ERROR: no chunks defined for a blur\n", token.Loc)
ok = false
return
}
context.chunks[len(context.chunks)-1].Blur = true
case "cut":
args, err, argsStack = typeCheckArgs(token.Loc, argsStack, TokenTimestamp)
if err != nil {
Expand Down Expand Up @@ -468,6 +476,9 @@ func ffmpegCutChunk(context EvalContext, chunk Chunk, y bool) error {
args = append(args, "-ab", context.AudioBitrate)
}
args = append(args, "-t", strconv.FormatFloat(chunk.Duration(), 'f', -1, 64))
if chunk.Blur {
args = append(args, "-vf", "boxblur=50:5")
}
for _, outFlag := range context.ExtraOutFlags {
args = append(args, outFlag)
}
Expand Down

0 comments on commit 0884c33

Please sign in to comment.