This web app will compare and analyze two videos and determines the similarity score between them.
![]() |
![]() |
- Clone the repository
git clone https://github.com/MusfiqDehan/video-analyzer.git
- Change the working directory
cd video-analyzer
- Setup and run
pipenv
environmentpipenv shell
- Install dependencies
pip3 install -r requirements.txt
- Run the app
python3 app.py
- Go to
http://127.0.0.1:5000/
Here are the use cases of the library imports used in the app.py
script and why they are used for this project:
-
cv2
: This is the OpenCV library, which is used for image and video processing. In this project, it is used to extract frames from video files. -
Flask
: These are all part of the Flask web framework, which is used to create the web application.Flask
is the main Flask class, redirect andurl_for
are used to redirect the user to different pages,render_template
is used to render HTML templates, request is used to handle HTTP requests, andjsonify
is used to return JSON responses. -
BadRequest
: This is an exception class from theWerkzeug
library, which is used to handle HTTP errors. In this project, it is used to raise a BadRequest exception if the user does not upload both videos. -
numpy
: This is a numerical computing library for Python. In this project, it is used to perform numerical operations on arrays of video frames. -
os
: This is a module for interacting with the operating system. In this project, it is used to join file paths and get the current working directory. -
pytube
: This is a library for downloading YouTube videos. In this project, it is used to download YouTube videos for comparison. -
scipy.spatial.distance, scipy.io.wavfile, scipy.signal.resample
: These are all part of theSciPy
library, which is used for scientific computing. In this project, they are used to calculate the similarity between two videos based on their audio and visual features. -
skimage
: These are part of thescikit-image
library, which is used for image processing. In this project, they are used to calculate the structural similarity index (SSIM) between two video frames. -
python_speech_features
: This is a library for computing Mel-frequency cepstral coefficients (MFCCs), which are commonly used in speech recognition. In this project, it is used to extract audio features for comparison. -
subprocess
: This is a module for running external commands. In this project, it is used to run the ffmpeg command to extract audio from video files. -
tempfile
: This is a module for working with temporary files and directories. In this project, it is used to create a temporary directory for storing downloaded videos. -
urllib.request
: This is a module for working with URLs. In this project, it is used to download videos from URLs. -
librosa
: This is a library for audio analysis. In this project, it is used to extract audio features for comparison. -
moviepy
: This is a library for video editing. In this project, it is used to extract audio from video files. -
pyAudioAnalysis
: This is a library for audio analysis. In this project, it is used to segment audio files into speech and non-speech regions.