This repository contains two Python scripts designed for video and audio processing:
- VideoModifier: A script that allows you to apply various modifications to a video based on user-defined settings.
- ContentFingerprint: A script that generates and compares fingerprints for audio and video content to identify similarities between media files.
Before running the scripts, ensure you have Python installed. You'll also need to install the required Python libraries. You can install them using the following command:
pip install -r requirements.txtThe VideoModifier script allows you to apply a variety of modifications to a video, such as resizing, changing speed, adding borders, applying color filters, overlaying text, reversing the video, and adjusting audio pitch.
- compare.json: Specifies the input and output video paths.
- modify.json: Specifies the modifications to be applied.
{
"input_video_path": "input_video.mp4",
"output_video_path": "modified_video.mp4"
}{
"resize": {
"enabled": true,
"width": 640,
"height": null
},
"change_speed": {
"enabled": true,
"factor": 1.5
},
"add_border": {
"enabled": true,
"size": 15,
"color": [255, 0, 0]
},
"apply_color_filter": {
"enabled": true,
"filter_type": "sepia"
},
"overlay_text": {
"enabled": true,
"text": "Modified Video",
"position": "top",
"fontsize": 30,
"color": "yellow"
},
"reverse_video": {
"enabled": true
},
"adjust_audio_pitch": {
"enabled": true,
"pitch_factor": 1.2
}
}-
Create the
compare.jsonandmodify.jsonfiles with the appropriate settings. -
Run the
VideoModifierscript:python video_modifier.py
-
The modified video will be saved to the path specified in
compare.json.
The ContentFingerprint script is designed to generate and compare fingerprints for audio and video files, allowing you to identify similarities between different media files.
- compare.json: Specifies the input media path (audio or video) and the output path.
{
"input_video_path": "input_video_or_audio_file.mp4",
"output_video_path": "output_file_path.mp4"
}-
Create the
compare.jsonfile with the appropriate settings. -
Run the
ContentFingerprintscript:python content_fingerprint.py
-
If you want to compare two media files, you would:
- Create another
ContentFingerprintobject for the second file. - Use the
comparemethod to compare the fingerprints of both files. - Example:
modifier1 = ContentFingerprint() modifier2 = ContentFingerprint() similarity = modifier1.compare(modifier2._generate_fingerprints()) print(similarity)
- Create another
If you want to save the keyframes of a video for further analysis, use the save_keyframes method:
modifier.save_keyframes('output_keyframes_directory')This project is licensed under the MIT License. See the LICENSE file for more details.
These scripts are provided for educational purposes only. Please ensure that you comply with all relevant copyright laws and use these tools responsibly.
This README.md provides clear instructions for setting up and using both the VideoModifier and ContentFingerprint scripts, including how to configure them using JSON files and how to execute them. The details are presented in a structured way, ensuring that users can easily follow along.