dhowden / tag

ID3, MP4 and OGG/FLAC metadata parsing in Go
BSD 2-Clause "Simplified" License
558 stars 72 forks source link

Cannot extract metadata from OGG file #67

Closed deluan closed 4 years ago

deluan commented 4 years ago

(Sorry for bombarding you with issues, but this is the best pure Go tag library out there and this is my way of contributing to make it even better! Thanks for your awesome job!)

I think the way that the picture is embedded in this file is breaking the library. This is what I get:

$ tag Indila.ogg
error reading file: unexpected EOF

Indila.ogg.zip

I think it may be caused by the way the picture is embedded. Normally ffmpeg reports the embedded art as a separated stream like this:

    Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 700x700 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      comment         : Cover (front)

But in the attached file, it appears as a tag of the audio stream:

    Stream #0:0(fra): Audio: vorbis, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      metadata_block_picture: AAAAAwAAAAppbWFnZS9qcGVnAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5FA/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4
wader commented 4 years ago

Seems to work with #65

Interesting, seem to work with ffmpeg 4.1.3 but not ffmpeg 4.2.1. Maybe some regression, ill see if i can find something.

wader commented 4 years ago

I think this https://github.com/FFmpeg/FFmpeg/commit/8d3630c5402fdda2889fe4f74f7dcdd50ebca654 broke it in ffmpeg. The strcmp(tt, "METADATA_BLOCK_PICTURE") was not updated properly to av_strncasecmp(tt, "METADATA_BLOCK_PICTURE"). I try make a patch for ffmpeg also.

wader commented 4 years ago

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200411094625.7677-1-mattias.wadman@gmail.com/

wader commented 4 years ago

Merged in to ffmpeg master now, that was fast. Seems like there was more ppl noticing this https://trac.ffmpeg.org/ticket/8608 good find

dhowden commented 4 years ago

Thanks @wader :-).

@deluan No worries. I built this library to support my own music player/streaming (https://github.com/tchaik/tchaik) so I know where you're coming from :-)