Skip to main content

Wrapper for pymediainfo that retrieves information such asmedia type, duration, resolution, etc. from media files

Project description

Python class to return a list of local media files from a folder with metadata of the files


  • Python 3


  • pymediainfo
  • click



  • GetMedia.get_all(…) will raise an Exception if there’s a file containing an odd character such as ‘/’. (e.g.: Exception raised if file “my/image.jpg” is encountered)
    • glob.glob(…) converts ‘/’ to some codes or different type of codec


Description: Returns list of files with data & file path of each file in its own list sorted by creation/metadata change time (oldest to newest (ascending order)) by default

Input: path to media files

Output: list of lists each containing media info of each media file


Use as CLI app such as python -m get_media_files my_path/Pictures or use it as an API and import via from get_media_files import GetMediaFiles.


Suppose I have 2 image files, test2.jpg and test3.jpg, 1 text file, and 1 folder in the following path and

run the following code:

from get_media_files import GetMediaFiles

path = '/home/j/Documents/_Github-Projects/MediaToVideo/temp-imgs'
media = GetMediaFiles(path)
info = media.get_info(path, track_types=['Image','Video'])

printed output:

    {'duration': None, 'format': 'JPEG', 'size': (1920, 1080)}},
    {'duration': None, 'format': 'JPEG', 'size': (291, 1080)}},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

get_media_files-0.1.2.tar.gz (3.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page