Changing video file properties with python

Viewed 1237

I wrote a program to rename movie files. However, a few movies were displaying as their old name even after changing the file name.

I found that under the properties tab there are file properties called "Title" "Tags" "Comments" etc. For most movies these are blank but for some the title is the old filename and it doesn't get changed when I change the filename.

How can I rewrite or simply clear this metadata?

1 Answers

It depends on the format of your video file. For instance, for MP4 files you can use 'mutagen' as follows:

from mutagen.mp4 import MP4

def remove_tags(file_path):
    movie_tags = MP4(file_path)
    movie_tags.clear()
    movie_tags.save()
Related