nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
532 stars 58 forks source link

eyed3.core:WARNING: FrameHeader: Illegal Frame ID: b'TP1\x00' #533

Open jwakely opened 3 years ago

jwakely commented 3 years ago

I have some MP3 files (copyrighted, so I can't provide them) for which eyeD3 doesn't print any info. Other utilities (e.g. kid3 and ffprobe and KDE's Dolphin file browser) are able to show the metadata. If I use -l verbose then I see an error about an illegal frame ID:

Our Love$ eyeD3 -l verbose 01\ Can\'t\ Do\ Without\ You.mp3 
eyed3.core:WARNING: FrameHeader: Illegal Frame ID: b'TP1\x00'
...Z 128GB/Car Music/Caribou/Our Love/01 Can't Do Without You.mp3  [ 12.13 MB ]
--------------------------------------------------------------------------------
Time: 03:56     MPEG1, Layer III        [ 320 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------------------------------------------------
ID3 v2.3:
title: 
artist: 
album: 
track: 
--------------------------------------------------------------------------------

The version is 0.9.6 as packaged for Fedora Linux 33:

$ eyeD3 --about
0.9.6 True Blue

eyeD3 0.9.6 ? Copyright 2002-2020 Travis Shirk
This program comes with ABSOLUTELY NO WARRANTY! See LICENSE for details.
Run with --help/-h for usage information or read the docs at

If I edit the tags with kid3 and save the file, then eyeD3 no longer shows the error, and can read the tags without problems:

Our Love$ eyeD3 -l verbose   /tmp/01\ Can\'t\ Do\ Without\ You.mp3 
/tmp/01 Can't Do Without You.mp3                                   [ 12.13 MB ]
--------------------------------------------------------------------------------
Time: 03:56     MPEG1, Layer III        [ 320 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------------------------------------------------
ID3 v2.3:
title: Can't Do Without You
artist: Caribou
album: Our Love
album artist: Caribou
recording date: 2014
track: 1/10             genre: Electronic (id 52)
disc: 1/1
OTHER Image: [Size: 3261919 bytes] [Type: image/png]
Description: 

--------------------------------------------------------------------------------

(kid3 shows that this file actually has several duplicate tags, for Album, Artist etc but that doesn't seem to bother eyeD3, only the illegal frame ID seems to cause problems).

With -l debug on the original file it shows:

Our Love$ eyeD3 -l debug   /tmp/01\ Can\'t\ Do\ Without\ You.mp3        
eyed3:DEBUG: command line args: Namespace(about_eyed3=False, log_level=[['debug']], debug_profile=False, debug_pdb=False, recursive=False, excludes=None, fs_encoding='utf-8', paths=["/tmp/01 Can't Do Without You.mp3"], list_plugins=False, plugin=<classic.ClassicPlugin object at 0x7f584a3e77c0>, config=None, backup=False, quiet=False, no_color=False, no_config=False, artist=None, album=None, album_artist=None, title=None, track=None, track_total=None, track_offset=None, composer=None, orig_artist=None, disc_num=None, disc_total=None, genre=None, non_std_genres=False, release_year=None, simple_comment=None, artist_city=None, artist_state=None, artist_country=None, rename_pattern=None, tag_version=(3, None, None), convert_version=None, release_date=None, orig_release_date=None, recording_date=None, encoding_date=None, tagging_date=None, publisher=None, play_count=None, bpm=None, unique_file_ids=[], comments=[], remove_comment=[], remove_all_comments=False, lyrics=[], remove_lyrics=[], remove_all_lyrics=False, text_frames=[], user_text_frames=[], url_frames=[], user_url_frames=[], images=[], remove_image=[], remove_all_images=False, write_images_dir=None, objects=[], remove_object=[], write_objects_dir=None, remove_all_objects=False, popularities=[], remove_popularity=[], remove_v1=False, remove_v2=False, remove_all=False, remove_fids=[], max_padding=True, text_encoding=None, force_update=False, verbose=False, preserve_file_time=False)
eyed3:DEBUG: plugin is: <classic.ClassicPlugin object at 0x7f584a3e77c0>
eyed3.core:DEBUG: Loading file: /tmp/01 Can't Do Without You.mp3
eyed3.core:DEBUG: File mime-type: audio/mpeg
eyed3.id3.headers:DEBUG: Located ID3 v2 tag
eyed3.id3.headers:DEBUG: TagHeader [major]: 2 
eyed3.id3.headers:DEBUG: TagHeader [minor]: 3 
eyed3.id3.headers:DEBUG: TagHeader [rev]: 0 
eyed3.id3.headers:DEBUG: TagHeader [flags]: unsync(0) extended(0) experimental(0) footer(0)
eyed3.id3.headers:DEBUG: TagHeader [size string]: 0x01475d61
eyed3.id3.headers:DEBUG: TagHeader [size]: 3272417 (0x31eee1)
eyed3.id3.frames:DEBUG: size_left: 3272417
eyed3.id3.frames:DEBUG: +++++++++++++++++++++++++++++++++++++++++++++++++
eyed3.id3.frames:DEBUG: FrameSet: Reading Frame #1
eyed3.id3.headers:DEBUG: FrameHeader [start byte]: 10 (0xA)
eyed3.core:WARNING: FrameHeader: Illegal Frame ID: b'TP1\x00'
eyed3.id3.frames:DEBUG: No frame found, implied padding of 3272417 bytes
eyed3.id3.tag:DEBUG: Tag contains 3272417 bytes of padding.
eyed3.mp3:DEBUG: mp3 header search starting @ 31eeeb
eyed3.mp3.headers:DEBUG: MPEG audio version: 1.0
eyed3.mp3.headers:DEBUG: MPEG audio layer: III
eyed3.mp3.headers:DEBUG: MPEG sampling frequency: 44100
eyed3.mp3.headers:DEBUG: MPEG bit rate: 320
eyed3.mp3.headers:DEBUG: MPEG channel mode: Joint stereo
eyed3.mp3.headers:DEBUG: MPEG channel mode extension: 2
eyed3.mp3.headers:DEBUG: MPEG CRC error protection: False
eyed3.mp3.headers:DEBUG: MPEG original: 1
eyed3.mp3.headers:DEBUG: MPEG copyright: 0
eyed3.mp3.headers:DEBUG: MPEG private bit: 0
eyed3.mp3.headers:DEBUG: MPEG padding: 0
eyed3.mp3.headers:DEBUG: MPEG emphasis: None
eyed3.mp3.headers:DEBUG: MPEG frame length: 1044
eyed3.mp3:DEBUG: mp3 header fffbe064 found at position: 0x31eeeb
eyed3.mp3.headers:DEBUG: b'Info' header detected @ 24
eyed3.mp3.headers:DEBUG: b'Info' header flags: 0xf
eyed3.mp3.headers:DEBUG: b'Info' numFrames: 9037
eyed3.mp3.headers:DEBUG: b'Info' numBytes: 9443786
eyed3.mp3.headers:DEBUG: b'Info' TOC (100 bytes): PRESENT
eyed3.mp3.headers:DEBUG: Lame info tag found at position 156
eyed3.mp3.headers:DEBUG: Lame tag CRC OK
eyed3.mp3.headers:DEBUG: Lame Encoder Version: LAME3.99r
eyed3.mp3.headers:DEBUG: Lame info tag version: 0
eyed3.mp3.headers:DEBUG: Lame VBR method: Constant Bitrate
eyed3.mp3.headers:DEBUG: Lame Lowpass filter value: 20500 Hz
eyed3.mp3.headers:DEBUG: Lame Encoding flags: --nspsytune --nssafejoint
eyed3.mp3.headers:DEBUG: Lame ATH type: 4
eyed3.mp3.headers:DEBUG: Lame Bitrate (Constant): 255
eyed3.mp3.headers:DEBUG: Lame Encoder delay: 576 samples
eyed3.mp3.headers:DEBUG: Lame Encoder padding: 684 samples
eyed3.mp3.headers:DEBUG: Lame Source Sample Frequency: 44.1 kHz
eyed3.mp3.headers:DEBUG: Lame Unwise settings used: False
eyed3.mp3.headers:DEBUG: Lame Stereo mode: Joint
eyed3.mp3.headers:DEBUG: Lame Noise Shaping: 1
eyed3.mp3.headers:DEBUG: Lame MP3 Gain: 0 (+0.0 dB)
eyed3.mp3.headers:DEBUG: Lame Bitrate (Constant): 320
eyed3.mp3.headers:DEBUG: Lame Surround Info: None
eyed3.mp3.headers:DEBUG: Lame Preset: CBR 320
eyed3.mp3.headers:DEBUG: Lame Music Length: 9443786 bytes
eyed3.mp3.headers:DEBUG: Lame Music CRC: FA79
eyed3.mp3.headers:DEBUG: Lame Info Tag CRC: EFA5
/tmp/01 Can't Do Without You.mp3                                   [ 12.13 MB ]
--------------------------------------------------------------------------------
Time: 03:56     MPEG1, Layer III        [ 320 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------------------------------------------------
ID3 v2.3:
title: 
artist: 
album: 
track: 
--------------------------------------------------------------------------------

A hex dump shows that the file contains both v2.2 tags like TP1, TP2, TRK, and v2.3 tags like TPE1, TPE2 and TRCK:

00000000: 4944 3303 0000 0147 5d61 5450 3100 0000  ID3....G]aTP1...
00000010: 0008 0000 0043 6172 6962 6f75 5450 3200  .....CaribouTP2.
00000020: 0000 0008 0000 0043 6172 6962 6f75 5441  .......CaribouTA
00000030: 4c00 0000 0009 0000 004f 7572 204c 6f76  L........Our Lov
00000040: 6554 5041 0000 0000 0400 0000 312f 3154  eTPA........1/1T
00000050: 5945 0000 0000 0500 0000 3230 3134 5452  YE........2014TR
00000060: 4b00 0000 0005 0000 0031 2f31 3054 4954  K........1/10TIT
00000070: 3200 0000 1500 0000 4361 6e27 7420 446f  2.......Can't Do
00000080: 2057 6974 686f 7574 2059 6f75 5450 4531   Without YouTPE1
00000090: 0000 0009 0000 0043 6172 6962 6f75 0054  .......Caribou.T
000000a0: 5045 3200 0000 0900 0000 4361 7269 626f  PE2.......Caribo
000000b0: 7500 5441 4c42 0000 000a 0000 004f 7572  u.TALB.......Our
000000c0: 204c 6f76 6500 5450 4f53 0000 0005 0000   Love.TPOS......
000000d0: 0031 2f31 0054 5945 5200 0000 0600 0000  .1/1.TYER.......
000000e0: 3230 3134 0054 5243 4b00 0000 0600 0000  2014.TRCK.......
000000f0: 312f 3130 0041 5049 4300 31c5 ec00 0000  1/10.APIC.1.....

Could eyeD3 be made more robust, so it doesn't fail to read anything from badly-tagged files like this?

timjackson commented 2 years ago

I also have a similar MP3 with a similar issue, but in this case it bails on "Frame ID: b'TT2\x00'" (eyeD3 0.9.6 on Fedora 34). The MP3 looks like it may originate from iTunes. All of the following can successfully read the tags in the file on Fedora 34: mid3v2 1.3 w/ Mutagen 1.45.1, id3info 3.8.3, ffprobe 4.4.1, Totem 3.38. Easytag 2.4.3, however, also fails to read it.

Extract from "eyeD3 -l debug":

eyed3.core:DEBUG: File mime-type: audio/mpeg eyed3.id3.headers:DEBUG: Located ID3 v2 tag eyed3.id3.headers:DEBUG: TagHeader [major]: 2 eyed3.id3.headers:DEBUG: TagHeader [minor]: 3 eyed3.id3.headers:DEBUG: TagHeader [rev]: 0 eyed3.id3.headers:DEBUG: TagHeader [flags]: unsync(0) extended(0) experimental(0) footer(0) eyed3.id3.headers:DEBUG: TagHeader [size string]: 0x00090303 eyed3.id3.headers:DEBUG: TagHeader [size]: 147843 (0x24183) eyed3.id3.frames:DEBUG: size_left: 147843 eyed3.id3.frames:DEBUG: +++++++++++++++++++++++++++++++++++++++++++++++++ eyed3.id3.frames:DEBUG: FrameSet: Reading Frame #1 eyed3.id3.headers:DEBUG: FrameHeader [start byte]: 10 (0xA) eyed3.core:WARNING: FrameHeader: Illegal Frame ID: b'TT2\x00' eyed3.id3.frames:DEBUG: No frame found, implied padding of 147843 bytes eyed3.id3.tag:DEBUG: Tag contains 147843 bytes of padding.