Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing video file properties with python

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?

like image 351
Sam Avatar asked Nov 05 '25 02:11

Sam


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()
like image 194
Iman Avatar answered Nov 06 '25 18:11

Iman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!