desbma / r128gain

Fast audio loudness scanner & tagger (ReplayGain v2 / R128)
GNU Lesser General Public License v2.1
172 stars 9 forks source link

Getting error: HeaderNotFoundError, can't sync to MPEG frame #5

Closed onny closed 5 years ago

onny commented 5 years ago

Hey thanks for the program, I'm getting following error while trying to resume tagging on my library:

r128gain -s -r music
[...]
Traceback (most recent call last):
  File "/usr/bin/r128gain", line 11, in <module>
   load_entry_point('r128gain==0.8.0', 'console_scripts', 'r128gain')()                                                                                                                                   
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 617, in cl_main                                                                                                                       
    report=logging.getLogger().isEnabledFor(logging.INFO) or args.dry_run)                                                                                                                                 
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 458, in process_recursive                                                                                                             
    executor=executor)                                                                                                                                                                                     
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 187, in scan                                                                                                                          
    if skip_tagged and has_loudness_tag(audio_filepath)[0]:                                                                                                                                                
  File "/usr/lib/python3.7/site-packages/r128gain/__init__.py", line 337, in has_loudness_tag                                                                                                              
    mf = mutagen.File(filepath)                                                                                                                                                                            
  File "/usr/lib/python3.7/site-packages/mutagen/_util.py", line 148, in wrapper_func                                                                                                                      
    return func(h, *args, **kwargs)                                                                                                                                                                        
  File "/usr/lib/python3.7/site-packages/mutagen/_file.py", line 298, in File                                                                                                                              
    return Kind(fileobj, filename=filething.filename)                                                                                                                                                      
  File "/usr/lib/python3.7/site-packages/mutagen/_file.py", line 49, in __init__                                                                                                                           
    self.load(*args, **kwargs)                                                                                                                                                                             
  File "/usr/lib/python3.7/site-packages/mutagen/_util.py", line 140, in wrapper                                                                                                                           
    return func(self, h, *args, **kwargs)                                                                                                                                                                  
  File "/usr/lib/python3.7/site-packages/mutagen/id3/_file.py", line 423, in load                                                                                                                          
    self.info = self._Info(fileobj, offset)                                                                                                                                                                
  File "/usr/lib/python3.7/site-packages/mutagen/_util.py", line 169, in wrapper                                                                                                                           
    return func(*args, **kwargs)                                                                                                                                                                           
  File "/usr/lib/python3.7/site-packages/mutagen/mp3/__init__.py", line 403, in __init__                                                                                                                   
    raise HeaderNotFoundError("can't sync to MPEG frame")                                                                                                                                                  
mutagen.mp3.HeaderNotFoundError: can't sync to MPEG frame

Best regards, Jonas

desbma commented 5 years ago

Hi,

Can you post an MP3 file that is generating this error, so I can look at it ?

onny commented 5 years ago

@desbma here is the file https://nextcloud.project-insanity.org/s/T7QkNHQfSXTtaGX looks like its just a corrupt file. so maybe it is possible to catch the exception and continue the tagging process?

desbma commented 5 years ago

so maybe it is possible to catch the exception and continue the tagging process?

Yes, that is the idea. I just wanted the file to add a test for that case. It should be fixed now, thanks for the report and file.