diff --git a/scanner/metadata/ffmpeg.go b/scanner/metadata/ffmpeg.go index d2d6e801..810e7aeb 100644 --- a/scanner/metadata/ffmpeg.go +++ b/scanner/metadata/ffmpeg.go @@ -67,10 +67,10 @@ var ( durationRx = regexp.MustCompile(`^\s\sDuration: ([\d.:]+).*bitrate: (\d+)`) // Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s - bitRateRx = regexp.MustCompile(`^\s{4}Stream #\d+:\d+: (Audio):.*, (\d+) kb/s`) + bitRateRx = regexp.MustCompile(`^\s{2,4}Stream #0:0: (Audio):.*, (\d+) kb/s`) // Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn, 90k tbc` - coverRx = regexp.MustCompile(`^\s{4}Stream #\d+:\d+: (Video):.*`) + coverRx = regexp.MustCompile(`^\s{2,4}Stream #0:1: (Video):.*`) ) func (e *ffmpegExtractor) parseOutput(output string) map[string]string { diff --git a/scanner/metadata/ffmpeg_test.go b/scanner/metadata/ffmpeg_test.go index 7c170d1b..0d6f0ff4 100644 --- a/scanner/metadata/ffmpeg_test.go +++ b/scanner/metadata/ffmpeg_test.go @@ -92,6 +92,21 @@ Input #0, mp3, from '/Users/deluan/Music/iTunes/iTunes Media/Music/Compilations/ Expect(md.HasPicture()).To(BeTrue()) }) + It("detects embedded cover art in ffmpeg 4.4 output", func() { + const output = ` + +Input #0, flac, from '/run/media/naomi/Archivio/Musica/Katy Perry/Chained to the Rhythm/01 Katy Perry featuring Skip Marley - Chained to the Rhythm.flac': + Metadata: + ARTIST : Katy Perry featuring Skip Marley + Duration: 00:03:57.91, start: 0.000000, bitrate: 983 kb/s + Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 + Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 599x518, 90k tbr, 90k tbn, 90k tbc (attached pic) + Metadata: + comment : Cover (front)` + md, _ := e.extractMetadata("tests/fixtures/test.mp3", output) + Expect(md.HasPicture()).To(BeTrue()) + }) + It("detects embedded cover art in ogg containers", func() { const output = ` Input #0, ogg, from '/Users/deluan/Music/iTunes/iTunes Media/Music/_Testes/Jamaican In New York/01-02 Jamaican In New York (Album Version).opus':