Skip to main content

Features

  • Formatted data from ffprobe/mediainfo
  • Fallback data in case ffprobe/mediainfo cannot get data
  • Identical data structure
  • Full compatability with Python 3

Install

pip install PyProbe

Usage

import pyprobe
parser = pyprobe.VideoFileParser(ffprobe="/usr/bin/ffprobe", includeMissing=True, rawMode=False)
data = parser.parseFfprobe(inputFile)

This code will return a dictionary of values (as described below).

  • includeMissing Will remove values where ffprobe/mediainfo does not return data
  • rawMode Will make each value the raw output from ffprobe/mediainfo, which will be a string (except resolution, which is a tuple of strings).

There are also two helper functions provided to create more nicely formatted data -

>>> import pyprobe
>>> pyprobe.timeToTuple(12345.44)
(3, 25, 45, 440)
>> pyprobe.sizeStr(12345678.99)
'11.8 MB'

Data format

{
    "path": str,
    "bit_rate": int,
    "duration": float,
    "size": int,
    "videos": [
        {
            "aspect_ratio": str,
            "bit_rate": int,
            "codec": str,
            "format": str,
            "framerate": float,
            "pixel_format": str,
            "resolution": (
                int # Width,
                int # Height
            )
        }
    ],
    "audios": [
        {
            "bit_rate": int,
            "channel_count": int,
            "channel_layout": str,
            "codec": str,
            "format": str,
            "sample_rate": int # Hz
        }
    ],
    "subtitles": [
        {
            "codec": str,
            "language": str
        }
    ],
    "chapters": [
        {
            "title": str,
            "start": float,
            "end": float,
        }
    ]
}

Release files for PyProbe 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyProbe 0.1.2
File Size Uploaded
PyProbe-0.1.2.tar.gz 7.6 kB Details

Release files / PyProbe-0.1.2.tar.gz

Download URL PyProbe-0.1.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3c4b0b7cb008851f3bd2629702bcf54f62d5284ee0556069cdbf1097f6866ce9
BLAKE2b-256 checksum
How to use checksums
cd0a60e89a889adf6e43667eac62d055930507b9b5f5cce8418d1ca210e10699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page