Skip to content

bennischober/MetaDataScraper

Repository files navigation

MetaDataScraper

Table of contents

Overview

A short python script to get video meta data.
Notes:

This project uses Python 3.10

This is an very early state of the tool. Many Null/None checks are missing and by now I´m only looking for .mkv files. These problems will be fixed in the future, but I don't have the time to address them currently.

Quickstart

Usage: Run the main python script (main.py) with the root of you movies folder (e.g. 'D:\Movies') as parameter.
Execute this command in the Windows Terminal or CMD.

python main.py 'path:\to\movie-root'

How to install

Basic setup

The first steps are to install Python (preffered the latest stable, currently 3.10), FFmpeg (short tutorial for windows) and pip.

Install external dependencies

Clone this repository

Run

git clone https://github.com/bennischober/MetaDataScraper.git

Automatically using the pip requirements file (requires pip!)

pip install -r requirements.txt

How it works

The scripts will search recursively for (by now .mkv) movie files. If the script found a movie file, it uses ffmpeg.probe() and looks specificly for its streams. If the return value is not None, it proceeds to get all the meta data. Some of the data has to be calculated/created/converted, e.g the raw duration of the movie, the aspect ratio, the size of the movie file (convertion only) and the duration (convertion only).
To detect black bars in the movie, we need to check some frames of the video by using a subprocess and using the ffmpeg cropdetect command. The output will checked against the codec data (using a threshold to be 100% sure, its not just some pixels that can be cut).
This is why we you need to install the ffmpeg-python package and the FFmpeg standalone tool.

External dependencies

Meta data detection: ffmpeg and ffmpeg python(GitHub)
Black bar detection: ffmpeg
Loading bar: tqdm
Python package installer: pip

Useful commands

-csv generates a csv file of the processed data.

python main.py 'path:\to\movie-root' -csv

Features for the future

  • config.json to change the settings (e.g. movie format, language, output, etc.)
  • support (almost) all common movie file formats
  • get missing meta data from external movie APIs, e.g. OMDB API or List

FAQ

  • The command python does not work in the command prompt. Have a look at this.
  • "No such filter: 'cropdetect'...". On Windows: Make sure you installed the gpl version of ffmpeg. On Linux/UNIX this might help

Install the external dependencies manually:

pip install tqdm
pip install ffmpeg-python

Additional ressources

FFmpeg Documentation
How the black bar detection works
tqdm Documentation

About

A tool to get and analyze video metadata.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages