Python Forum

Full Version: Getting EXIF data from image AND video files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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
}