duan32342
2018-10-05 11:58 阅读 92
已采纳

在golang中获取/设置mp3文件的封面

I have an mp3 file and, when I load it in a media player, the media player displays the cover of the album. I presume the cover is in the file's metadata, so I'm wondering if there's a way to get to that cover in golang.

How do I set cover for mp3 file?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    duangu9666 duangu9666 2018-10-05 12:30

    The name of this property is ID3.

    You can use Library dhowden/tag to do this.

    m, err := tag.ReadFrom(f)
    if err != nil {
        log.Fatal(err)
    }
    log.Print(m.Format()) // The detected format.
    log.Print(m.Title())  // The title of the track (see Metadata interface for more details).
    

    type of m.Picture() is Picture...

    enjoy it!

    another lib : - https://github.com/mikkyang/id3-go

    点赞 评论 复制链接分享

相关推荐