Compare FFmpeg Video Signatures for Copyright
This article provides a practical guide on how to compare video
fingerprints generated by the FFmpeg signature filter to
detect copyright infringement. You will learn how to generate unique
signature files for your original videos, compare suspected videos
against those signatures, and interpret FFmpeg’s output to automate the
detection of unauthorized duplication.
Understanding FFmpeg Video Signatures
The FFmpeg signature filter generates a robust,
content-based fingerprint of a video stream. Unlike cryptographic hashes
(like MD5 or SHA-256), which change completely if a single pixel or bit
is modified, video signatures analyze the visual content. This makes
them highly effective for detecting copyright infringement because they
can identify matches even if the video has been:
- Re-encoded at a different bitrate or resolution.
- Converted to a different container format.
- Subjected to minor color adjustments or compression artifacts.
Step 1: Generate a Signature File for the Original Video
To build a database of copyrighted content, you must first generate and save the binary signature of your original video. Run the following command to output a signature file:
ffmpeg -i original_video.mp4 -vf "signature=format=binary:filename=original_signature.bin" -map 0:v -f null --vf "signature=...": Activates the signature filter.format=binary: Saves the output in a compact binary format (recommended for speed and storage).filename=original_signature.bin: The path where the generated fingerprint will be saved.-f null -: Prevents FFmpeg from writing a duplicate video file, processing only the metadata.
Step 2: Compare a Suspected Video Against the Signature
To check if a suspected video infringes on your copyrighted original,
you can compare the suspected video directly against the previously
saved .bin signature file.
Run the following command:
ffmpeg -i suspected_video.mp4 -vf "signature=detect=on:nb_inputs=1:filenames=original_signature.bin" -f null -detect=on: Tells FFmpeg to perform a pattern-matching analysis.nb_inputs=1: Specifies that you are comparing the input video against one external signature file.filenames=original_signature.bin: The path to your original video’s signature file.
Step 3: Compare Two Video Files Directly
If you have both video files on hand and do not want to generate separate signature files first, you can compare them side-by-side in real-time using a complex filtergraph:
ffmpeg -i original_video.mp4 -i suspected_video.mp4 -filter_complex "[0:v][1:v]signature=detect=on" -f null -FFmpeg will analyze the visual streams of both inputs simultaneously and calculate the similarity.
Step 4: Interpret the Matching Results
When the comparison command runs, FFmpeg outputs the match status to
the console (stderr). Look for lines containing
Parsed_signature in the console log.
A successful match output will look similar to this:
[Parsed_signature_0 @ 0x55bbf890] Match of src 0 and src 1 at 12.000000s and 12.050000s, duration 45.300000s frames 1132
Key Metrics to Analyze:
- Match detected: Confirms that a visually similar sequence was found between the two files.
- Timestamps (e.g.,
at 12.000000s): Shows exactly where the matching segment starts in both videos. This is useful for identifying if a user has uploaded a specific clip of your movie or broadcast. - Duration: The length of the matching sequence. For copyright enforcement, a match duration of more than a few seconds usually indicates a positive hit.
If the videos are completely different, the console will not output any “Match of src…” lines, confirming that no copyright infringement was detected based on visual fingerprints.