Skip to main content

Check A/V files for corruption using ffmpeg.

Project description

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.

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

mediachecker-2022.9.19.tar.gz (63.9 MB view details)

Uploaded Source

Built Distribution

mediachecker-2022.9.19-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file mediachecker-2022.9.19.tar.gz.

File metadata

  • Download URL: mediachecker-2022.9.19.tar.gz
  • Upload date:
  • Size: 63.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for mediachecker-2022.9.19.tar.gz
Algorithm Hash digest
SHA256 50166f0f4270642eaf64e25733b07d56d24888e65524f91d546c0225da6b0b1e
MD5 c0f5e5f8cf6648cb8224dd6209b5d854
BLAKE2b-256 a15acdb112820f1953ac0be39d17f5cddb0bd20ff5a270673241a552f924ec27

See more details on using hashes here.

File details

Details for the file mediachecker-2022.9.19-py3-none-any.whl.

File metadata

File hashes

Hashes for mediachecker-2022.9.19-py3-none-any.whl
Algorithm Hash digest
SHA256 2ff450d38711f6bd9040b94ce7ec616f0da427f2393599f800c47a7abc8fcf70
MD5 87a72b541f6f7d8c6ee62f036dfa26ca
BLAKE2b-256 ba5577d40d7d19ca6e846fde5a8055c8a043ea71eb86374838d0c4eb4a4463fa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page