This repository contains two Python scripts for working with a SQLite database (.ritt format) that stores metadata for video files. The scripts allow filtering, extracting, and organizing .mp4 files based on their tags.
- Scripts Overview
- Installation
- Usage
- Script Details
tag_filter_ritt.pyextract_videos&tags.py
- Requirements
| Script | Purpose |
|---|---|
tag_filter_ritt.py |
Filters and retrieves .mp4 files based on specific tags in the database. |
extract_videos&tags.py |
Extracts video-tag relationships and organizes them into categories, saving the results in a CSV file. |
-
Clone this repository:
git clone
cd -
Install required dependencies:
pip install -r requirements.txt
python tag_filter_ritt.py
This script:
- Connects to the SQLite database (
.ritt). - Filters video files that match a specific set of tags.
- Searches for corresponding
.mp4files in a given directory. - Prints the matching files and their counts.
python extract_videos&tags.py
This script:
- Extracts all videos and their associated tags from the SQLite database.
- Categorizes the extracted tags into predefined families (e.g., shot type, quality, lighting conditions).
- Searches for the corresponding
.mp4files. - Saves the organized data into a CSV file.
This script is designed to filter video files based on specific tags stored in the SQLite database. It performs the following steps:
- Connects to the SQLite database and searches for records that match the provided tags.
- Extracts video file names associated with the matching tags.
- Searches for
.mp4files in the specified directory. - Prints the list of matching files along with the number of times each file appears.
This script is useful when you need to retrieve a subset of videos from a large dataset based on specific filtering criteria.
This script is designed to extract video-tag relationships and save them into a structured CSV file. It performs the following steps:
- Extracts all videos and their IDs from the SQLite database.
- Extracts all available tags and associates them with their corresponding videos.
- Categorizes the extracted tags into predefined families:
- Camera angle (e.g., orbital, higher, lower)
- Shot type (e.g., close-up, panoramic)
- Environment (e.g., indoor, outdoor)
- Lighting conditions (e.g., backlight, shadows)
- Quality (e.g., poor, best)
- Camera movement (e.g., static, dynamic)
- Density (e.g., low, high)
- Finds the corresponding
.mp4files in the directory. - Saves the results in a CSV file for further analysis.
This script is useful when you need a structured dataset that links videos to their descriptive tags.
- Python 3.x
- SQLite3
- JSON support (built-in)
- CSV support (built-in)
- OS module (built-in)
Ensure that your .ritt database file and .mp4 footage are accessible from the paths specified in the scripts.
- If the database file is missing, the scripts will raise an error.
- If any
.mp4file is not found, it will be skipped. - The CSV output is generated in the script's directory and can be modified to save elsewhere.
Developed for video metadata processing and automatic tagging.