Skip to main content

Description

This library uses ffmpeg to check if a file (such as an mkv video) is corrupt. Any errors generated by ffmpeg when reading the file are assumed to be caused by file corruption.

Installation

pip3 install mediachecker

The ffmpeg command must also be available on your system (and PATH).

Usage

from mediachecker import AVFile

f = AVFile('some_file_to_check.mp4')
file_is_good = f.is_good()

By default, we only scan the first audio track of the file. This should be relatively fast. Alternatively, you can do:

file_is_good = f.is_good(method='full')

which will probably be slower.

If you want to see the output that was generated by ffmpeg, you can use write_log:

file_is_good = f.is_good(write_log=True)

This will save any errors to some_file_to_check.mp4.log.

CLI

Installing the mediachecker package also creates a command-line tool called check_media.

Run check_media -h for help using it. Example usage:

$ check_media -r -l /path/to/my/media/

That will recursively search for media in /path/to/my/media/, scan each file (using the default method), and write logs for all of them.

TODO

  • Add more command line options

  • Add more tests

  • Enable HW acceleration, e.g. ffmpeg -hwaccel cuda ...

  • Enable debug statements regarding progress, etc.

Metadata

Release files for mediachecker 2022.9.19

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

Source distribution (sdist)

Source distribution for mediachecker 2022.9.19
File Size Uploaded
mediachecker-2022.9.19.tar.gz 63.9 MB Details

Built distribution (wheel)

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

Total release size: 63.9 MB

Release files / mediachecker-2022.9.19.tar.gz

Download URL mediachecker-2022.9.19.tar.gz
Size 63.9 MB
Tags Source
SHA-256 checksum
How to use checksums
50166f0f4270642eaf64e25733b07d56d24888e65524f91d546c0225da6b0b1e
BLAKE2b-256 checksum
How to use checksums
a15acdb112820f1953ac0be39d17f5cddb0bd20ff5a270673241a552f924ec27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / mediachecker-2022.9.19-py3-none-any.whl

Download URL mediachecker-2022.9.19-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff450d38711f6bd9040b94ce7ec616f0da427f2393599f800c47a7abc8fcf70
BLAKE2b-256 checksum
How to use checksums
ba5577d40d7d19ca6e846fde5a8055c8a043ea71eb86374838d0c4eb4a4463fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

2022.9.19 This release

2 release files

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