How to Use the FFmpeg Signature Filter

This article provides a quick overview and practical guide on how to use the FFmpeg signature filter to generate and compare video fingerprints. You will learn how to export a video’s unique signature to a file and how to compare two different video files to detect duplicate or highly similar content, even if they have different resolutions, bitrates, or file formats.

The signature filter in FFmpeg is an advanced tool used for video fingerprinting. It analyzes the visual content of a video to create a unique identifier (signature) that can be used to detect duplicates, copyright infringement, or tampered media.


1. Generating and Exporting a Video Signature

To generate a signature file for a video without re-encoding or outputting a new video file, use the signature filter and direct the output to a null muxer (-f null -).

Run the following command to export the signature in XML format:

ffmpeg -i input.mp4 -vf "signature=format=xml:filename=signature.xml" -f null -

Parameter Breakdown:


2. Comparing Two Videos Directly

You can compare two video files in real-time to see if they contain matching content. This is useful for identifying if one video is a derivative, copy, or clip of another.

Run this command to compare two videos using the filter_complex flag:

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]signature=detect_matching=1" -f null -

Parameter Breakdown:


3. Fine-Tuning the Matching Sensitivity

If you are getting false positives or missing matches due to compression artifacts or resolution changes, you can adjust the threshold and match relationship parameters:

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]signature=detect_matching=1:threshold=10000:min_lines=15" -f null -