Compare FFmpeg Video Fingerprints for Copyright
Perceptual video fingerprinting enables content owners and platforms
to identify unauthorized re-uploads, even if the video has been
re-encoded, scaled, or slightly compressed. FFmpeg provides a built-in
signature filter that generates unique visual hashes based
on MPEG-7 video descriptors. This guide explains how to export video
fingerprints using FFmpeg, how to compare two streams directly to detect
copyright infringement, and how to analyze matching scores from the
output.
1. Direct Dual-Stream Comparison
The fastest way to determine whether a suspicious video infringes on
a reference video is by running both through FFmpeg simultaneously. The
signature filter accepts multiple inputs and evaluates
their visual similarity frame-by-frame.
Run the following command:
ffmpeg -i candidate.mp4 -i reference.mp4 -filter_complex \
"[0:v][1:v]signature=nb_inputs=2:detectmode=full" -f null -Key Parameters:
nb_inputs=2: Tells the filter to accept two video streams.detectmode=full: Enables complete matching across the entirety of both videos, searching for duplicated sequences regardless of position or minor time-shifts. Alternatively,detectmode=fastreduces processing overhead at the cost of detection sensitivity.
Interpreting the Log Output:
FFmpeg outputs the detection results directly to the console stderr stream. Look for lines indicating matched intervals:
[Parsed_signature_0 @ 0x7fa890407a80] matching intervals:
[Parsed_signature_0 @ 0x7fa890407a80] 1: 0.000000 - 14.500000 -> 2: 3.200000 - 17.700000 (score: 98, whole: 98)
- Interval ranges: Identifies which timestamp range
in Input 1 (
candidate.mp4) matches an interval in Input 2 (reference.mp4). - Score: A confidence metric (0–100) reflecting visual correlation. A high score (typically above 80–90) across multiple continuous seconds confirms that the content is visually identical, indicating copyright infringement.
2. Exporting Signatures for Database Storage
If you run a pipeline where reference videos cannot be re-processed every time a query video arrives, export the reference fingerprint to disk during ingestion.
To export a video's signature to a binary file:
ffmpeg -i reference.mp4 -vf "signature=detectmode=full:format=bin:filename=reference.bin" -f null -To export the signature as a readable XML structure (ideal for debugging or custom matching algorithms):
ffmpeg -i reference.mp4 -vf "signature=detectmode=full:format=xml:filename=reference.xml" -f null -The resulting file contains the compressed visual descriptors (spatial and temporal luminance changes across a 3x3 block grid) representing the video's perceptual timeline.
3. Comparing a Query Video Against Stored Signatures
You can load a pre-generated binary signature alongside an incoming query video to evaluate matching without loading the full reference video:
ffmpeg -i candidate.mp4 -vf "signature=detectmode=full:format=bin:filename=candidate.bin" -f null -Once you have both .bin files
(candidate.bin and reference.bin), you can
compare them by passing both signature files back to FFmpeg or by
utilizing custom matching scripts. In FFmpeg, comparing pre-generated
files is supported by initializing the filter with the reference
signature:
ffmpeg -i candidate.mp4 -vf "signature=detectmode=full:nb_inputs=1:filename=candidate.bin" -f null -Note: For large-scale automated databases, read the exported XML or binary vector definitions into an indexing system (such as Milvus, FAISS, or custom database tables) to perform nearest-neighbor lookups across millions of stored frame descriptors.
4. Fine-Tuning Detection Sensitivity
Distorted, resized, or re-compressed videos might fall below default
detection thresholds. You can adjust the internal evaluation metrics in
the signature filter:
th_di(Distance threshold): Minimum distance between words to consider them distinct. Lower values result in stricter matches.th_it(Interval threshold): Minimum duration (in frames) an identical sequence must maintain to trigger a match alert. Setting this prevents false positives caused by generic visual elements like blank black screens or common bumper intros.th_score: The threshold ratio for accepted matches. Lowering this value catches heavily altered video (e.g., strong color grading, cropped borders), though it increases the risk of false positives.
Example configuration for aggressive matching:
ffmpeg -i candidate.mp4 -i reference.mp4 -filter_complex \
"[0:v][1:v]signature=nb_inputs=2:detectmode=full:th_it=45:th_score=60" -f null -This ensures segments sharing at least 45 continuous matching frames with a correlation score of 60% or higher are flagged as copyright matches.