Here is my simple script, that resolves this problem for me. Thanks for hints.
"""Backs up tags from all m4a and mp3 files in a directory, recursively
and stores them as JSON file."""
from mutagen.easyid3 import EasyID3
from mutagen.easymp4 import EasyMP4
def backup_tags(directory, outfile):
"""Back up tags from all m4a & mp3 files from 'directory' into 'outfile'"""
filenames = 
for root, _, files in os.walk(directory):
filenames.extend([os.path.join(root, x) for x in files])
"""Return tags from file 'filename' as python dictionary"""
_, extension = os.path.splitext(filename)
if extension == '.mp3':
elif extension == '.m4a':
raise Exception('Not supported file type: %s' % filename)
with open(outfile, 'w') as out:
json.dump([tags_dict(x) for x in filenames], out, indent=1)
logging.info('Tags from %d file(s) saved.', len(filenames))
if __name__ == '__main__':