在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?
我有一个mp3文件,当我将其加载到媒体播放器中时,媒体播放器会显示该文件的封面 专辑。 我认为封面在文件的元数据中,所以我想知道是否有办法在golang中获得该封面。 p>
如何设置mp3文件的封面? p > div>
答
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