Python Forum
Getting EXIF data from image AND video files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Getting EXIF data from image AND video files (/thread-7376.html)



Getting EXIF data from image AND video files - kahlenberg - Jan-07-2018

Hi,
I want to sort lots of image and video files according to recorded date. I want to read EXIF data from these files.
I have found a script named EXIF.py but it can read only EXIF data in image files, not video files i.e. mp4 and mov.
How can I read EXIF information from image files AND mp4, mov files?

Thanks.


RE: Getting EXIF data from image AND video files - wavic - Jan-07-2018

Look at Hachoir.
Perhaps you could use it for images too.

On https://pypi.python.org look for some wrapper for FFmpeg. You could get video metadata easy.


RE: Getting EXIF data from image AND video files - metulburr - Jan-07-2018

try PIL ffor images
import PIL.Image
img = PIL.Image.open('img.jpg')
exif_data = img._getexif()
or
import PIL.ExifTags
exif = {
    PIL.ExifTags.TAGS[k]: v
    for k, v in img._getexif().items()
    if k in PIL.ExifTags.TAGS
}