Skip to main content

knowit

Know your media files better.

Read the metadata of video files: codecs, resolution, HDR, audio channels, languages, and subtitles.

PyPI version Python versions Tests Docker pulls License

Why knowit

Different tools give video metadata in different formats and with different names. knowit reads the output of MediaInfo, ffprobe, mkvmerge, or enzyme. It gives the result in one format, with the same names and units for all of them. You can use knowit as a command or as a Python library.

Quick start

  1. Install knowit:

    uv tool install "knowit[pint]"
    
  2. Read a video:

    $ knowit movie.mkv
    {
        "title": "Big Buck Bunny",
        "path": "movie.mkv",
        "duration": "0:00:46",
        "size": "31.76 MB",
        "bit_rate": "5.4 Mbps",
        "container": "mkv",
        "video": [
            {
                "id": 1,
                "width": "1024 pixel",
                "height": "576 pixel",
                "resolution": "576p",
                "frame_rate": "24.0 FPS",
                "codec": "H.264",
                ...
            }
        ],
        "audio": [
            {
                "id": 2,
                "codec": "AAC",
                "channels": "2.0",
                "sampling_rate": "48.0 KHz",
                ...
            }
        ],
        "subtitle": [
            {
                "id": 3,
                "language": "English",
                "format": "SubRip",
                "default": true
            },
            ...
        ]
    }
    

To try knowit without installing it, use uvx knowit movie.mkv.

Installation

Install knowit

Use one of these commands:

Command When to use it
uv tool install "knowit[pint]" Recommended. uv also installs Python if necessary.
pipx install "knowit[pint]" You already use pipx.
pip install knowit You want to use knowit as a Python library.

The pint extra adds units to the values, for example 31.76 MB or 1024 pixel. Without it, knowit shows plain numbers.

To upgrade, use uv tool upgrade knowit or pipx upgrade knowit.

Install a provider

A provider is the program that knowit uses to read the file. knowit uses the first installed provider in this order:

Provider Program Files Notes
mediainfo MediaInfo All video files Default. Gives the most information.
ffmpeg ffprobe, from FFmpeg All video files
mkvmerge mkvmerge, from MKVToolNix .mkv, .mka, .mks
enzyme Included in knowit .mkv Gives less information.

On most systems, knowit installs the MediaInfo library with the pymediainfo package. You do not need to install more programs.

If your system has no MediaInfo library, or if you want other providers, install the programs:

Ubuntu, Debian, and WSL

sudo apt-get install mediainfo ffmpeg mkvtoolnix

Windows (with Chocolatey)

choco install mediainfo ffmpeg mkvtoolnix

macOS (with Homebrew)

brew install media-info ffmpeg mkvtoolnix

To see which providers knowit finds, run knowit --version.

Docker

The Docker image contains knowit, MediaInfo, FFmpeg, and MKVToolNix:

docker run -it --rm -v /medias:/medias ratoaq2/knowit /medias/movie.mkv

Usage

Read a video with a specific provider:

knowit -p ffmpeg movie.mkv

Show the result in YAML:

knowit -y movie.mkv

A profile changes how knowit shows the values. The same file with two profiles:

$ knowit -y -P human movie.mkv        $ knowit -y -P technical movie.mkv
  duration: 46 seconds                  duration: '0:00:46.665000'
  size: 31.76 MB                        size: 30.291 MiB
  bit_rate: 5.4 Mbps                    bit_rate: 5.193 Mibps

Main options

Option What it does
-p, --provider Use this provider: mediainfo, ffmpeg, mkvmerge, or enzyme.
-y, --yaml Show the result in YAML. The default is JSON.
-P, --profile Show the values with this profile: default, human, technical, or code.
-N, --no-units Show the values without units.
--mediainfo, --ffmpeg, --mkvmerge Look for the program in this folder.
--report Read a folder and list the values that knowit does not know.
--bug-report Write a file to attach to an issue. See Report a problem.
--version Show the knowit version and the providers that knowit finds.

Run knowit --help for all options.

Python API

from knowit import know

info = know('/medias/movie.mkv')
print(info['video'][0]['codec'])  # H.264

info = know('/medias/movie.mkv', {'provider': 'ffmpeg', 'profile': 'code'})

know returns a dict. It raises KnowitException when knowit cannot read the file.

Report a problem

Do not send your media file. Run this command instead, and attach knowit-report.yml to an issue:

knowit --bug-report "/path/to/your/video.mkv"

The report contains the output of every provider. Titles, file names, and free-text tags are masked.

When the problem is the name of the file, use knowit --check-name "The Accountant² (2025).mkv". It tells you which provider fails because of the name.

Troubleshooting gives all the details.

Help to improve knowit

knowit is more correct when it sees many different files. Run this command on your library, and attach the files that it writes to an issue:

knowit --collect /path/to/your/media

Your media is not needed. Titles and file names are masked. See Help to improve knowit.

Used by

FAQ

Which provider should I use? Use MediaInfo if you can. It gives the most information. If knowit gives a wrong value, try another provider with -p, and report the problem.

Which files does knowit read? With MediaInfo or ffprobe, knowit reads all common video files, for example .mkv, .mp4, .avi, and .ts. With only mkvmerge or enzyme, knowit reads only Matroska files (.mkv).

Does knowit send my files or file names anywhere? No. knowit reads the files on your computer. It does not use the network. A bug report or a collect file leaves your computer only when you attach it to an issue.

Release files for knowit 0.7.1

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

Source distribution (sdist)

Source distribution for knowit 0.7.1
File Size Uploaded
knowit-0.7.1.tar.gz 201.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for knowit 0.7.1
File Interpreter ABI Platform
knowit-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 263.7 kB

Release files / knowit-0.7.1.tar.gz

Download URL knowit-0.7.1.tar.gz
Size 201.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66e5601873c18776411eb18294a17ddfef9243e64bf9635df8cf6549090bbb80
BLAKE2b-256 checksum
How to use checksums
c5fe5a7691c55e27051a9b9d2657e8417b5bc927524db1507683111d54192542
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / knowit-0.7.1-py3-none-any.whl

Download URL knowit-0.7.1-py3-none-any.whl
Size 62.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c71a41624e7258a68002b0ddf6da34b1af4b67935604bb80d13f593ba610733d
BLAKE2b-256 checksum
How to use checksums
8bb0fd010a37efd6b74d939e3d7443f6b6e6e5083c47fc7a013af9b37189c8ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.11

2 release files

0.5.10

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.4.1

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

0.0.8

1 release file

0.0.7

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