Metadata-Version: 2.1
Name: mediachecker
Version: 2022.9.19
Summary: Check A/V files for corruption using ffmpeg.
Project-URL: Homepage, https://github.com/atpage/mediachecker
Project-URL: Bug Tracker, https://github.com/atpage/mediachecker/issues
Author-email: Alex Page <a.t.page@gmail.com>
License: MIT License
        
        Copyright (c) 2022 Alex Page
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown


# 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.
