2022-04-26

Unable to get mp4 tkhd info using go-mp4

Using package github.com/abema/go-mp4 when i try to run the example in the docs i get following error:

invalid operation: box (variable of type *mp4.BoxInfo) is not an interface 

Here is the example that i am trying:

// extract specific boxes
boxes, err := mp4.ExtractBox(file, nil, mp4.BoxPath{mp4.BoxTypeMoov(), mp4.BoxTypeTrak(), mp4.BoxTypeTkhd()})
if err != nil {
   :
}
for _, box := range boxes {
  tkhd := box.(*mp4.Tkhd)
  fmt.Println("track ID:", tkhd.TrackID)
}

https://pkg.go.dev/github.com/abema/go-mp4#section-readme



1 comment: