AI video toolkit - detect, analyze, and work with AI-generated videos
Project description
aivid
AI video toolkit - detect, analyze, and work with AI-generated videos
Features
- AI Detection: Detect AI-generated videos through C2PA metadata and heuristic analysis
- C2PA Signing: Add C2PA manifests to media files (requires c2patool)
- Metadata Extraction: Extract comprehensive metadata from video files
- Multi-tool Support: Leverages ffprobe, mediainfo, exiftool, and c2patool for thorough analysis
- MP4 Box Analysis: Binary parsing of MP4/MOV container structure
- Software Detection: Identify editing software (FFmpeg, Adobe, DaVinci, OBS, etc.)
- Multiple Output Modes: Default summary, full details, C2PA focus, or quiet mode
- JSON Export: Export reports for automation and integration
- Batch Processing: Analyze multiple files with single command
Supported AI Generators
| Generator | Detection Method | Confidence |
|---|---|---|
| OpenAI Sora | C2PA manifest + 96kHz audio signature | High |
| OpenAI DALL-E | C2PA manifest | High |
| Google Gemini/Veo | Encoder tag + C2PA manifest | High |
| Adobe Firefly | C2PA manifest | High |
| Midjourney | C2PA manifest | High |
| Stability AI | C2PA manifest | High |
| Runway | C2PA manifest | Medium |
| Pika Labs | C2PA manifest | Medium |
| Kling AI | C2PA manifest | Medium |
| Luma AI | Handler name + C2PA manifest | Medium |
Requirements
System Dependencies
aivid requires these command-line tools to be installed:
- ffprobe (required) - Part of FFmpeg
- mediainfo (optional, recommended)
- exiftool (optional, recommended)
- c2patool (optional) - For accurate C2PA manifest parsing and signing
macOS
brew install ffmpeg mediainfo exiftool
Ubuntu/Debian
sudo apt-get install ffmpeg mediainfo exiftool
Windows
# Using Chocolatey
choco install ffmpeg mediainfo exiftool
# Or using Scoop
scoop install ffmpeg mediainfo exiftool
Install c2patool (optional)
c2patool provides more accurate C2PA manifest parsing and signing capabilities.
# Using Cargo (Rust package manager)
cargo install c2patool
# Or download prebuilt binaries from:
# https://github.com/contentauth/c2pa-rs/releases
Python Installation
pip install aivid
Or with uv:
uv pip install aivid
Quick Start
Command Line
# Basic analysis
aivid video.mp4
# AI detection focus (C2PA mode)
aivid --c2pa video.mp4
# Full metadata details
aivid --full video.mp4
# Quick summary for multiple files
aivid -q *.mp4
# Export to JSON
aivid -o report.json video.mp4
# Sign a file with C2PA manifest (requires c2patool)
aivid --sign manifest.json -o signed_video.mp4 video.mp4
Python API
from aivid import analyze_file, check_c2patool_available, sign_with_c2pa, VideoMetadata
# Analyze a video file
metadata = analyze_file("video.mp4")
# Check if AI-generated
if metadata.is_ai_generated:
print(f"AI Generator: {metadata.ai_generator}")
# Access metadata (pydantic models)
print(f"Duration: {metadata.duration}s")
print(f"Resolution: {metadata.resolution}")
print(f"Video codec: {metadata.technical.video.codec}")
print(f"Audio sample rate: {metadata.technical.audio.sample_rate}")
# C2PA information
if metadata.has_c2pa:
print(f"C2PA Issuer: {metadata.provenance.c2pa.issuer}")
print(f"C2PA Generator: {metadata.provenance.c2pa.generator}")
# Export as JSON
print(metadata.model_dump_json(indent=2))
# Sign a file with C2PA manifest (requires c2patool)
if check_c2patool_available():
sign_with_c2pa(
input_path="video.mp4",
manifest_path="manifest.json",
output_path="signed_video.mp4",
)
Output Modes
Default Mode
Basic metadata with file info, container details, encoding info, and C2PA summary.
aivid video.mp4
C2PA Mode (--c2pa)
Focused on AI content detection with indicators and confidence levels.
aivid --c2pa video.mp4
Output includes:
- C2PA manifest detection
- AI generation indicators (audio sample rate, encoder tags, etc.)
- Detection summary with confidence levels
Note: When c2patool is installed, aivid uses it for more accurate C2PA parsing.
Full Mode (--full)
Complete metadata dump including mediainfo, exiftool, all streams, and raw data.
aivid --full video.mp4
Quiet Mode (-q)
One-line summary per file, ideal for batch processing.
aivid -q *.mp4
Sign Mode (--sign)
Add a C2PA manifest to a media file (requires c2patool).
# Create a manifest file
cat > manifest.json << 'EOF'
{
"claim_generator": "aivid",
"title": "My Video",
"assertions": [
{
"label": "c2pa.actions",
"data": {
"actions": [{"action": "c2pa.edited"}]
}
}
]
}
EOF
# Sign the video
aivid --sign manifest.json -o signed_video.mp4 video.mp4
# Verify the signature
aivid --c2pa signed_video.mp4
Development
Setup
# Clone the repository
git clone https://github.com/SocialNetwork0/aivid.git
cd aivid
# Create virtual environment and install dependencies
uv venv
uv pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
Local CLI Testing
# Activate virtual environment
source .venv/bin/activate # macOS / Linux
# Install in editable mode (code changes reflect immediately)
uv pip install -e ".[dev]"
# Test CLI
aivid --help
aivid video.mp4
Running Tests
uv run pytest
Code Quality
# Linting
uv run ruff check .
# Formatting
uv run ruff format .
# Type checking
uv run mypy src
Supported File Formats
Native MP4/MOV parsing: .mp4, .m4v, .m4a, .mov, .3gp, .3g2
Other formats: Any format supported by ffprobe
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aivid-0.3.0.tar.gz.
File metadata
- Download URL: aivid-0.3.0.tar.gz
- Upload date:
- Size: 57.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
431589641a663a8236baa0eec572e10dfe0de3b260b1911098fd7a1b829c5eaf
|
|
| MD5 |
68c153ee54f4a294c7b1c157ca2df1a8
|
|
| BLAKE2b-256 |
522d7708ce5c28d7a642ad7cf4b4ce20d3b70a41a46db050ef3004eb48c4412d
|
Provenance
The following attestation bundles were made for aivid-0.3.0.tar.gz:
Publisher:
ci.yml on socialnetwork0/aivid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aivid-0.3.0.tar.gz -
Subject digest:
431589641a663a8236baa0eec572e10dfe0de3b260b1911098fd7a1b829c5eaf - Sigstore transparency entry: 827668043
- Sigstore integration time:
-
Permalink:
socialnetwork0/aivid@b69ad8bdd17550e90eaf1d64b13ece5795ce8e4b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/socialnetwork0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b69ad8bdd17550e90eaf1d64b13ece5795ce8e4b -
Trigger Event:
push
-
Statement type:
File details
Details for the file aivid-0.3.0-py3-none-any.whl.
File metadata
- Download URL: aivid-0.3.0-py3-none-any.whl
- Upload date:
- Size: 72.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8b3c66d591c31fe2e4785dd62c256e0e1673a9a1dcc9db1d1d1cc5b9ac75cbe
|
|
| MD5 |
e2c911f4a8eec356ab97a7d1170f18bd
|
|
| BLAKE2b-256 |
621fc94b7cd1fe037ac4ab6c20626f1a0bf13f663354ecef46c9c5e9ca9e0624
|
Provenance
The following attestation bundles were made for aivid-0.3.0-py3-none-any.whl:
Publisher:
ci.yml on socialnetwork0/aivid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aivid-0.3.0-py3-none-any.whl -
Subject digest:
e8b3c66d591c31fe2e4785dd62c256e0e1673a9a1dcc9db1d1d1cc5b9ac75cbe - Sigstore transparency entry: 827668115
- Sigstore integration time:
-
Permalink:
socialnetwork0/aivid@b69ad8bdd17550e90eaf1d64b13ece5795ce8e4b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/socialnetwork0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b69ad8bdd17550e90eaf1d64b13ece5795ce8e4b -
Trigger Event:
push
-
Statement type: