Efficient Storage and Analysis of Videos Through M

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

E cient Storage and Analysis of Videos through

Motion-Based Frame Removal


Akash R (  akash@onepercent.club )
RV College of Engineering
Leandra Shania Anderson
RV College of Engineering

Research Article

Keywords: cctv, surveillance, video analysis, motion detection, frame removal, storage optimization, video
compression, computer vision, image processing, video processing, big data, data analytics

Posted Date: June 14th, 2023

DOI: https://doi.org/10.21203/rs.3.rs-3035803/v1

License:   This work is licensed under a Creative Commons Attribution 4.0 International License.
Read Full License

Additional Declarations: No competing interests reported.


Efficient Storage and Analysis of Videos through
Motion-Based Frame Removal
AKASH R1, LEANDRA SHANIA ANDERSON2
Department of MCA, RV College of Engineering, Bangalore, Karnataka, India

ABSTRACT
The storage and analysis of CCTV footage pose a significant challenge in modern surveillance systems.
This paper presents an innovative and modern solution for efficient storage optimization and analysis
through motion-based frame removal techniques. By leveraging the OpenCV library redundant frames are
removed, resulting in substantial storage reduction without losing important motion events. The
methodology uses Python’s OpenCV, Django, SQLite, and Bootstrap, ensuring reliability, scalability,
usability, and effective data visualisation. Experimental results have demonstrated the efficacy across
different camera setups and their ability to preserve critical information. The approach offers a practical
solution for decreasing cost, improving analysis efficiency, and enhancing usability. This research
contributes to the field of CCTV surveillance by providing a practical and industry-oriented solution. The
findings inspire further improvements in storage optimization and pave the way for more intelligent
surveillance systems.

Keywords: cctv, surveillance, video analysis, motion detection, frame removal, storage optimization,
video compression, computer vision, image processing, video processing, big data, data analytics

INTRODUCTION footage. However, the existing solutions rely on


traditional methods, such as video compression [2],
Video surveillance is the most useful technology timed deletion [3], and manual intervention, none of
used in the field of security. One of the most which are efficient when it comes to the 21st
challenging problems in installing cameras at a century’s technology standards.
large scale is the storage space occupied by the
footage[1]. This paper presents an efficient solution for the
However, with the exponential increase in the usage storage and analysis of CCTV footage through
of these cameras comes the challenge of storing and motion-based frame removal [4]. The approach
managing the vast amounts of data (video footage) leverages OpenCV, a widely-used open-source
they generate. In most cases, this footage is stored computer vision library, to detect motion in the
for long periods or indefinitely consuming footage. By removing redundant frames, the space
significant amounts of storage space which drives required to store footage can be significantly
up the costs. Manual analysis and discarding of reduced as well as make it easier to access
purposeless videos are time-consuming and require important information without needing to filter out
skilled personnel which is again, expensive. redundant data each time.

Various approaches have been developed to address The approach removes frames in which little or no
the above-mentioned challenges to optimize storage motion is detected, preserving only the important
requirements and facilitate the analysis of CCTV portions of the footage. According to estimates, a
video with 10% motion can be expected to reduce approximately 13 GB of data per day, and in most
the storage requirements by approximately 80%, cases, there are multiple cameras, leaving us with
which represents a substantial decrease in the costs 100 or even 1000 GB of data per day. With the huge
associated with maintenance. amounts of data being generated, the issue of
storage space for this footage is yet to be solved. In
this section, some of the previously proposed
solutions are discussed and compared with our
proposal.

A time-dependent compression technique, adjusting


compression levels based on the age of the video.
The research aims to optimize video storage by
balancing the need for extensive footage with the
desire for higher-quality recordings. However, one
potential disadvantage of the time-dependent
compression technique is that it may result in
The solution is built on Django, a popular Python reduced video quality for older recordings, as
framework for developing scalable web higher levels of compression are applied. This can
applications. SQLite is used as the database to store be detrimental as the need to access old footage
metadata about the footage like timestamps, motion may arise at any moment and reducing the quality
detection values, data related to optimization and of this footage just because it’s old reduces the
the location of the stored video files. Bootstrap, a effectiveness of video surveillance [5].
responsive web design framework, is used to
present the application interface and provide an Another approach is "A Cloud-Based Storage
intuitive and user-friendly experience for users. Optimization Framework". The framework
comprises a cloud storage layer, a cloud computing
This paper presents a detailed analysis of the layer, and a cloud-based video surveillance
solution which includes its advantages, application. It employs techniques such as data
methodology, and improvements over existing compression, deduplication, fragmentation, and
approaches. An evaluation of the solution using encryption to optimize storage and management.
real-world CCTV footage is also presented, Although it’s a great tool addressing security
demonstrating its effectiveness in reducing storage concerns, data compression is redundant without
requirements and improving analysis efficiency. the use of Machine Learning. This is because
Overall, it represents a significant contribution to modern file formats like MP4 already use this
the field of CCTV footage storage and analysis and technique to store videos efficiently and another
has the potential to make a significant impact in a layer of compression saves very little storage.
variety of settings, from large-scale surveillance Additionally, implementing and managing a
operations to small-scale installations in homes and cloud-based storage optimization framework can be
businesses. complex and require specialized knowledge and
resources, again driving up the costs. Uploading
and retrieving large volumes of CCTV video data
from the cloud is time-consuming due to data
LITERATURE REVIEW
transfer speeds and latency issues. This may affect
Video surveillance has become widespread in real-time access and analysis capabilities in a time
modern society. A single security camera generates
of need [6]. information of the optimized metrics.

These concerns are addressed by employing motion a. OpenCV


detection and frame removal techniques. This
enables us to achieve an exponential reduction in Open Source Computer Vision (OpenCV) Library is
storage requirements without compromising the a popular library used for computer vision and
quality of the footage. Moreover, the software image processing tasks in Python. It provides a
seamlessly integrates into existing infrastructure wide range of algorithms for image and video
without necessitating any additional overhead. It analysis, object detection and tracking, facial
operates efficiently by utilizing the raw video for recognition, motion detection, etc. OpenCV is
processing, allowing for the storage of the known for its efficiency and versatility, making it a
optimized video in the usual manner, ensuring easy valuable tool in various applications such as
access and playback whenever required. robotics, augmented reality, and surveillance
systems [7].
When it comes to motion detection, OpenCV
METHODOLOGY provides a common technique known as
thresholding. Thresholding is an effective method
This section presents the methodology employed to
to segment an image or video into the foreground
optimize storage for CCTV footage through
and background based on the intensity of pixels.
motion-based frame removal. The methodology
The same concept can be applied to identify moving
includes the problem statement, software
objects by comparing the intensity difference
architecture, data processing steps, algorithms
between consecutive frames. By setting a threshold
utilized, experimental setup, metrics used to
value, pixels showing significant changes in
evaluate, etc.
intensity can be marked as foreground, indicating
the presence of motion.
Problem Statement
The primary objective of this research is to develop The proposed algorithm follows these key steps:
a software solution that optimizes storage
● Video Information Retrieval: Total frame
requirements for CCTV footage while not
count and frames per second (FPS) are
compromising on crucial information. The
extracted from the input video file using
challenge lies in reducing the storage requirements
OpenCV.
without compromising the integrity and
● Video Capture and Initialization: The
significance of the captured data.
video is opened for reading using the
OpenCV library. Frame width and height are
Software Architecture retrieved to determine the video frame
dimensions.
The proposed solution utilizes Django, a popular
● Video Writer Initialization: A video writer
Python web framework, as the foundation for the
object is created using the specified
software architecture. Footages from the CCTV
codec(compression and decompression
cameras are sent to the server at regular intervals,
techniques), FPS, and frame dimensions.
with the frequency determined by the user. Upon
The output file is set to store the optimized
receiving the footage, the system initiates the
video.
processing pipeline which removes the frames that
aren’t required and stores the video along with the
● Frame Processing and Redundancy b. Motion-Based Optimization Algorithm
Detection: Frames are read one by one from To ensure compatibility with various footage types,
the input video. Each frame is converted to the video extensions are modified using the
grayscale to simplify subsequent operations. movie.py package. This ensures that the software
Frame differencing is employed by can handle data from any type of camera
calculating the absolute difference between irrespective of the manufacturer of the camera, the
the current frame and the previous frame. software being used, etc.
The resulting difference frame is
thresholded to obtain a binary mask, Upon receiving the raw footage from the cameras
highlighting significant changes. (be it any type of camera storing video in any file
The number of white pixels in the mask is format), it undergoes processing for identifying and
computed to quantify the extent of change in removing frames with no discernible motion. The
the frame. Frames with fewer than a steps, as mentioned above, involve comparing the
predefined threshold of white pixels are intensity difference between a set of frames. When
considered redundant. there are moving objects, comparing the intensity
● Output Video Generation: Non-redundant difference between consecutive frames can result in
frames are written to the output video using the moving object being recognised as “in motion”.
the video writer object. Redundant frames Upon recognition, it determines whether to keep or
are skipped, reducing the file size without discard the frame. Frames with minimal or no
compromising visual quality. motion would identify as redundant and removed
● Metadata Storage: Relevant video from the video sequence, while frames with
metadata, such as duration and dimensions, significant motion would be retained. The decision
are stored in a binary file for future to retain or discard a frame is based on the
reference. user-defined threshold value. More the threshold
value, the lesser the size of the video while, the
lesser the threshold value, the more the smoothness
and integrity of the video. The balance depends on
the specific use case of the user.

c. Add-Ons
Storage: After the optimization is complete, the
final footage, devoid of redundant frames, is stored
on the server. The metrics related to optimization
results, including the percentage of optimization,
motion percentage, duration, camera details,
timestamp, and other relevant information, are
stored in an SQLite database. This allows for
efficient retrieval and analysis of the stored footage
and associated information.
performed well in all the scenarios and the variables
had little to no effect on the efficacy of the result.

RESULTS AND LIMITATIONS


The results demonstrated that the proposed
methodology successfully optimized storage.
Videos with a motion of 10% achieved an
approximate 80% reduction in storage size while
User Interface: The optimization results, along preserving all relevant information. The algorithm
with the summary are presented to the users exhibited robustness in detecting various types of
through a control panel designed using Bootstrap. motion even hard-to-detect motions such as shadow
This responsive web design framework is visually change, birds flying, and even objects thrown
appealing with the inclusion of various charts to ensuring that crucial frames will not be lost.
display the data. This allows users to gain insights
into the storage optimization metrics and help make However, the effectiveness of the algorithm and the
informed decisions. smoothness of the resulting videos depend on the
threshold value customizable by the user. Adjusting
the threshold value to the optimum point is crucial
in finding the balance between storage optimization
and preserving important motion events. Setting the
threshold too high may lead to the loss of
significant information, while setting it too low may
result in minimal storage optimization. Therefore, it
is essential to consider specific requirements and
constraints before determining the optimal
threshold value.
To address this limitation, the methodology
includes a user-friendly interface along with
guidelines that allow users to adjust the threshold
value according to their specific needs. The
TESTING AND EVALUATION interface provides real-time feedback on the impact
of threshold adjustments, enabling users to make
To evaluate the effectiveness of the proposed
better decisions based on their needs
solution, experiments were conducted using
different types of cameras placed in different
locations with different angles, backgrounds,
lighting and resolution. The cameras used included
both indoor and outdoor surveillance cameras, each
with different specifications such as resolution,
frame rate, and field of view. The captured footage
was stored in their native file formats like AVI,
MP4, and MOV simulating a real-life environment
encountered in surveillance systems. The algorithm
CONCLUSION that rely on CCTV systems for security and
monitoring purposes.
This paper presents an efficient storage and analysis
solution for CCTV footage through motion-based To further improve the system's performance, future
frame removal. By leveraging the OpenCV library enhancements can focus on automating the
and implementing a user-customizable threshold selection process or implementing
threshold-based approach, storage requirements adaptive thresholding algorithms based on the
were significantly reduced while also improving environment and varying conditions like video
analysis efficiency. The solution demonstrated quality. This would further improve the efficacy by
promising results in terms of storage optimization, striking a perfect balance between storage
with a video containing 10% motion expected to optimization and data retention using the power of
reduce storage by approximately 80%. Moreover, it Machine Learning. Additionally, future
preserved crucial motion events while removing enhancements include improving the accuracy and
only the redundant frames, ensuring that no relevant efficiency of motion detection as there is always
data was lost during the optimization process. room for further improvements with the increase in
data and efficacy of algorithms.
The methodology section detailed the software
architecture, algorithms, and experimental setup In summary, this paper has demonstrated the
used. By utilizing Django as the web framework, effectiveness of the approach in addressing the
OpenCV for video processing, SQLite as the challenges of CCTV footage storage and analysis.
database, and Bootstrap for the presentation, a We hope that the findings and methodologies will
scalable and user-friendly system was successful. inspire further advancements in this area, ultimately
The experiments conducted with different camera leading to more efficient and intelligent surveillance
types across different environments validated the systems in the future.
effectiveness, showcasing its adaptability to various
surveillance scenarios.

While the solution offers significant benefits in


terms of storage optimization and analysis
efficiency, it is important to note the limitations.
The threshold value plays a vital role in balancing
storage reduction and preserving important motion
events. Finding the optimal threshold value based
on specific requirements is crucial to achieving the
desired results.

Overall, the research contributes to the field of


CCTV footage storage and analysis by providing a
practical and industry-oriented solution. The
combination of efficient storage optimization,
accurate motion detection, and user-friendly
interfaces makes the solution suitable for a wide
range of surveillance applications. The work can
greatly benefit individuals as well as organizations
REFERENCES ACKNOWLEDGEMENTS
The authors express their sincere gratitude to Dr
1. Storage Optimization of CCTV Footage Deepika K, Dr B. Renuka Prasad, and Dr Andhe
Authors: Sonali Shelar | Shweta Gaikwad | Shital Kakade Dharani from the MCA Department of RV College of
Publication: IJSRD - International Journal for Scientific Engineering for their unwavering encouragement and
Research & Development | Vol 8, Issue 1, 2020 | Paper ID: invaluable support and guidance.
IJSRDV8I10030.
FUNDING
2. Video Compression Algorithm Based on Frame Difference
Approaches
The development and publication of this paper are
Authors: MuzhirShaban Al-Ani | Talal Ali Hammouri
graciously funded by RV College of Engineering,
Publication: International Journal on Soft Computing | Vol 2, Bangalore.
No.4, November 2011
CONTRIBUTION
3. Time Based Automatic Data Deletion in Role and Policy Both authors have made equal contributions to this
Based Access Control System paper. The final manuscript has been reviewed and
Authors: M. Vanitha | C. Kavitha | C. Karthikeyan approved by both authors.
Publication: World Applied Sciences Journal 34 (3): 307-311,
2016
AUTHOR’S INFORMATION
4. A Motion Detection System in Python and OpenCV
Akash R and Leandra Shania Anderson are Postgraduate
Authors: Suraiya Parveen | Javeria Shah students from RV College of Engineering.
Publication: 2021 Third International Conference on
Intelligent Communication Technologies and Virtual Mobile Akash R is an innovative software engineer driven by a
Networks (ICICV) | DOI: passion for exploring cutting-edge technologies and
10.1109/ICICV50876.2021.9388404 solving complex problems. As the founder and director
of OnePercent Software, he has spearheaded the
5. Time Dependent Video Compression For Efficient Storage. development of 50 highly successful mobile applications
Authors: Soumya Shaw, Saurav Kumar Mishra, Sirajul Islam, with an impressive download count of 250,000 and an
Vaishanav Shukla. active user base of 50,000.
Publication: International Journal of Scientific & Technology
Research Volume 9, Issue 06, June 2020 Leandra Shania Anderson is a passionate software
engineer who thrives on bringing her ideas to life
6. A Cloud-Based Storage Optimization Framework for CCTV
through code. With over 2 years of industry experience,
Video Surveillance.
she has successfully delivered numerous impactful
Authors: A. K. Sahoo, S. K. Patnaik, and B. K. Panigrahi.
projects. Currently, she is pursuing her post-graduate
Publication: Advances in Computing and Data Sciences: 6th
International Conference, ICCDS 2021, Coimbatore, India,
studies at RV College of Engineering, further honing her
March 18-20, 2021, Proceedings, Part I, Lecture Notes in skills and knowledge in the field.
Computer Science, vol 12659. Springer, Cham, 2021.
ETHIC DECLARATIONS
7. OpenCV for Computer Vision Applications
Authors: M. Naveenkumar | A. Vadivel
Ethics approval and consent to participate
Publication: Proceedings of National Conference on Big Data
Not applicable.
and Cloud Computing (NCBDC’15), March, 2015
Consent for publication
Not applicable.

Competing interests
The authors declare that they have no competing
interests.

You might also like