'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



Solution 1:[1]

Sorry, it is an error of my sample code.

I created Pull Request to fix it. https://github.com/abema/go-mp4/pull/113/files

When you find any other problems about go-mp4, I would be grateful if you could create new Issue on GitHub. https://github.com/abema/go-mp4/issues

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1