pythonmetadatamutagen

mp4 metadata not found but exists


I want to change the creation date of mp4 files (wrongly configured in recorder) but mutagen seems to not find the proper metadata:

import mutagen
from mutagen.mp4 import MP4

path = 'borrar.mp4'

file = MP4(path)

for tag in file:
    print(tag, ': ', file[tag])

Prints nothing in console. If I use mutagen to add a title metadata then the same code as before shows correctly the title but it keeps on failing to find the creation date.

The file has indeed a creation date metadata as shown in image: Creation date metadata

Any idea whats is going on? Thanks in advance.


Solution

  • It looks like your file is a video file, but mutagen is for audio files (and their metadata). The mp4-type is the Apple audio mp4 type. Refer to the docs here.