REG.
NO : 2022176029
NAME : M.NITHYA
BRANCH : M.TECH (IT) (AI & DS)
SUBJECT CODE : DS5002
SUBJECT NAME : STREAMING ANALYTICS
ASSIGNMENT NO : 01
ASSIGNMENT TOPIC : AUDIO & VIDEO COMPRESSION
DATE OF SUBMISSION : 26.05.2023
AUDIO COMPRESSION:
In the context of streaming analytics, audio compression refers to the process of
reducing the size of audio data while maintaining an acceptable level of audio
quality. Audio compression techniques are applied to efficiently store, transmit,
and process audio streams in streaming analytics systems. The goal is to minimize
the bandwidth and storage requirements without significantly compromising the
perceptual quality of the audio.
Audio compression in streaming analytics involves the
following key components:
Encoding:
Audio compression typically involves encoding the audio signal
using specific algorithms or codecs. These algorithms analyze the audio
data and apply various compression techniques to represent the audio in a
more compact form. The encoded audio is then ready for transmission or
storage.
Compression Algorithms:
Audio compression algorithms employ different techniques to
reduce the size of audio data. Some common compression techniques
include:
1. Lossless Compression: Lossless compression techniques
aim to reduce the file size without any loss of audio quality.
These algorithms exploit redundancies in the audio signal to
achieve compression. Examples of lossless compression
formats include FLAC (Free Lossless Audio Codec) and
ALAC (Apple Lossless Audio Codec).
2. Lossy Compression: Lossy compression techniques achieve
higher compression ratios by selectively discarding audio data
that is less perceptually significant. This leads to some loss of
audio quality, but it is often imperceptible to the human ear.
Common lossy compression formats include MP3 (MPEG
Audio Layer III), AAC (Advanced Audio Coding), and Opus.
Bitrate:
Bitrate refers to the amount of data used to represent the audio
stream per unit of time. It determines the level of compression and quality
of the compressed audio. Higher bitrates generally result in better audio
quality but require more bandwidth or storage space.
Streaming Considerations:
Audio compression in streaming analytics accounts for the real-time
nature of audio streaming. This involves techniques such as buffering,
segmenting, and adaptive bitrate streaming. These methods ensure that the
compressed audio can be efficiently transmitted over network connections
and adapt to changing network conditions.
PROCESS OF DIGITAL AUDIO COMPRESSION:
By employing audio compression techniques in streaming analytics, it becomes
possible to handle large volumes of audio data in real-time, optimize network
bandwidth utilization, and provide a seamless audio streaming experience while
maintaining acceptable audio quality. The specific audio compression techniques
used can vary depending on the streaming analytics platform, requirements, and
available resources.
AUDIO ENCODING AND DECODING:
Audio encoding and decoding are fundamental processes in digital audio systems
that involve converting analog audio signals into a digital format and vice versa.
Here's an overview of audio encoding and decoding:
Audio Encoding:
Audio encoding refers to the process of converting analog audio signals
into a digital representation. The purpose of encoding is to capture and
represent the audio waveform in a format that can be stored, transmitted,
and processed digitally. The encoding process involves the following steps:
Sampling:
The continuous analog audio signal is sampled at regular intervals
to capture discrete digital samples. The sampling rate determines the
number of samples taken per second, commonly measured in
kilohertz (kHz). Common sampling rates include 44.1 kHz (CD
quality) and 48 kHz (common in digital audio systems).
Quantization:
Each sample is assigned a numerical value to represent the amplitude
of the audio signal at that moment. Quantization assigns a specific
bit depth to each sample, which determines the range and precision
of the values. Common bit depths include 16-bit (CD quality) and
24-bit (high-resolution audio).
Compression (optional):
Audio compression algorithms may be applied to reduce the size of
the digital audio data. Lossless compression techniques maintain the
exact audio quality, while lossy compression methods discard some
audio information to achieve higher compression ratios. Popular
lossy audio compression formats include MP3, AAC, and Ogg
Vorbis.
Encoding Format:
The final step is to package the digital audio data in a specific format
or file container. Common audio formats include WAV, AIFF,
FLAC, and MP3. These formats determine the organization,
metadata, and other features of the encoded audio data.
Audio Decoding:
Audio decoding, also known as audio playback or decompression, involves the
reverse process of converting digital audio data back into analog audio signals for
playback through speakers or headphones.
The decoding process typically includes the following steps:
Decoding Format: The audio decoding process starts by
determining the format of the encoded audio data. Based on the file
container or format, the decoder identifies the specific encoding
scheme used, such as MP3 or AAC.
Decompression: If the audio was compressed using a lossy
algorithm, such as MP3, the decoder decompresses the data using
the corresponding decompression algorithm. Lossless formats, like
FLAC, do not require decompression.
Quantization: The decoder assigns the appropriate numerical
values to the quantized samples, reconstructing the original digital
samples.
Digital-to-Analog Conversion: The digital audio samples are
converted back into an analog waveform using a digital-to-analog
converter (DAC). The analog audio signal can then be amplified and
sent to speakers or headphones for playback.
By encoding analog audio into a digital format and decoding it back into analog,
audio encoding and decoding enable the storage, transmission, and playback of
audio in various digital audio systems, including streaming platforms, media
players, and communication devices.
VIDEO COMPRESSION:
Video compression is a crucial aspect of streaming analytics as it enables efficient
transmission and processing of video data in real-time.
Here's an overview of video compression in the context of streaming analytics:
Video Compression Standards: Video compression algorithms, also
known as codecs (coder-decoder), are used to compress and decompress
video data. Popular video compression standards include H.264/AVC
(Advanced Video Coding), H.265/HEVC (High-Efficiency Video
Coding), VP9, and AV1. These codecs employ various techniques to
reduce the size of video data while maintaining acceptable visual quality.
Lossy Compression: Video compression techniques often employ lossy
compression, where certain information is discarded to achieve higher
compression ratios. This information may include details that are less
perceptually significant, such as high-frequency components or spatial
redundancies in the video frames.
Spatial and Temporal Compression: Video compression techniques
exploit both spatial and temporal redundancies in video data. Spatial
compression reduces redundancy within individual frames by representing
image areas with similar characteristics using fewer bits. Temporal
compression takes advantage of similarities between consecutive frames to
further reduce data size by representing changes between frames instead of
encoding every pixel.
Bitrate Control: Video streaming analytics systems implement bitrate
control mechanisms to optimize the trade-off between video quality and
bandwidth utilization. Bitrate control adjusts the amount of data used to
represent the video stream dynamically, based on factors such as available
network bandwidth, video complexity, and quality requirements.
Keyframes and Interframes: Video compression techniques use a
combination of keyframes (also called I-frames or intra-frames) and
interframes (P-frames and B-frames) to encode video data efficiently.
Keyframes are fully encoded frames that serve as reference points, while
interframes encode only the differences or motion vectors between frames,
leading to higher compression ratios.
Adaptive Streaming: Video streaming analytics platforms often
incorporate adaptive streaming techniques to adjust the video quality
dynamically based on network conditions and device capabilities.
Adaptive bitrate streaming protocols such as MPEG-DASH and HLS
(HTTP Live Streaming) allow streaming clients to switch between
different video quality levels in real-time, depending on available
bandwidth and network congestion.
Preprocessing and Postprocessing: Video compression in streaming
analytics may involve preprocessing steps to optimize video data for
compression, such as noise reduction, color space conversion, and resizing.
Postprocessing techniques, such as deblocking and denoising filters, may
be applied during decompression to enhance the visual quality of the
decoded video.
There are two types of video compression: lossless compression and lossy
compression.
1. Lossy compression:
Lossy compression is the traditional and most commonly used type of
compression for reducing file size. It’s the type of compression where the size of
the original video file is reduced by removing parts of the original video deemed
unnecessary. These parts can be anything, like repeated sounds and image
sequences.Note that the rendering quality remains relatively good due to video
codecs.
For example, DVDs are compressed using the video codec MPEG-2. This codec
reduces the file size considerably, sometimes up to 30 times smaller than the
original file. Yet, the compressed DVD videos still appear in good sound and
visual quality.
Here are scenarios where you can use lossy compression:
You don’t mind the video rendering quality.
Reducing the file size.
Uploading it to a platform with limited storage and bandwidth.
Your video hosting platform improves video rendering.
You want to make the file lighter for faster transfer.
Note that lossy compression will sometimes result in a glaring drop in quality, as
it can cause a lot of video information to be lost.
2. Lossless compression:
As the name suggests, lossless compression compresses the video file with no
loss of information or quality (visual image or audio) whatsoever. This technique
is undoubtedly the best for preserving the quality of your videos while reducing
their overall size. The catch, however, is that it results in a compressed file of
almost the same size as the original file. Also, it has a limited scope and doesn’t
compress data to the same degree as lossy techniques. But if you don’t mind the
file size, it’s the best compression technique because it gives you better and purer
video quality.
Here are potential situations where you can use lossless compression:
You want to play the video on another device that doesn’t support its current
format.
You want to upload it to a video platform with a specific file format
requirement without losing its quality.
You want to transfer the video file from one hard drive to another without
losing its quality.
Here is how video compression affects your files.
Bit rate:
Video bit rate refers to the number of bits processed in a video sequence
over time and is expressed in bits per second (bps), kilobits per second
(Kbps), or megabits per second (Mbps).Video compression is about
minimizing the number of bits needed to represent a video sequence,
meaning the first thing affected during a video compression is the bit rate.
By compressing the video file, the compression software reduces the
number of bits per time frame by eliminating unnecessary bits of
information.
Rendering quality:
The final visual quality of a video depends on the type of compression.
While both lossy and lossless video compressions are meant to improve
your video without hurting its quality, lossy compressions generally result
in lesser video quality. This is because of the reduction of the overall file
size. But again, most visual quality drops are unseeable to the naked eye.
File size:
Video compression implies that an uncompressed video file contains much
more data than is necessary to process it properly. Therefore, video
compression seeks to achieve an optimal compromise between data
reduction and quality.
By employing video compression techniques in streaming analytics, video
streaming platforms can deliver high-quality video content over limited network
bandwidth and accommodate a range of devices and network conditions. These
techniques optimize storage, bandwidth utilization, and streaming performance
while maintaining an acceptable level of video quality for viewers.
VIDEO ENCODING AND DECODING PROCESS:
Video encoding and decoding are fundamental processes in streaming analytics
that involve converting video signals into a digital format for transmission,
storage, and analysis.
Here's an overview of video encoding and decoding in streaming analysis:
Video Encoding:
Video encoding refers to the process of converting raw video data into a
compressed digital format suitable for storage, transmission, or analysis.
The encoding process involves the following steps:
Spatial and Temporal Redundancy Removal: Video encoding
algorithms employ techniques to remove spatial and temporal
redundancies in video data. Spatial redundancy removal reduces the size
of each video frame by exploiting similarities between neighboring pixels.
Temporal redundancy removal focuses on differences between consecutive
frames to represent changes instead of encoding every pixel in each frame.
Video Compression Codecs: Video compression codecs, such as
H.264/AVC, H.265/HEVC, VP9, or AV1, are used to apply specific
encoding algorithms and techniques. These codecs employ various
compression methods, including intra-frame compression for individual
frames (I-frames or keyframes) and inter-frame compression for
differences between frames (P-frames and B-frames).
Bitrate Control: Video encoding often involves bitrate control, which
determines the amount of data used to represent the video stream. Bitrate
control is essential for optimizing video quality, bandwidth usage, and
storage requirements. Variable Bit Rate (VBR) or Constant Bit Rate (CBR)
encoding strategies can be employed based on the application
requirements.
Encoding Parameters: Video encoding involves setting parameters such
as resolution, frame rate, bitrate, and encoding presets to determine the
trade-off between video quality and file size. These parameters influence
the overall encoding process and the resulting quality of the encoded video.
Video Decoding:
Video decoding is the process of converting compressed video data back into a
viewable video format.
It involves the following steps:
Codec Detection: The video decoding process starts with identifying the
codec used for video compression. The decoder needs to match the codec
used during encoding to ensure compatibility.
Bitstream Decoding: The compressed video data, often in the form of a
bitstream, is decoded using the corresponding video codec. The decoder
applies the inverse processes of compression, such as decompression,
entropy decoding, and inverse transformations, to reconstruct the video
frames.
Frame Reconstruction: The decoded video frames are reconstructed
based on the information extracted from the bitstream. Keyframes are fully
reconstructed, while subsequent frames are reconstructed using motion
vectors and residuals obtained during encoding.
Digital-to-Analog Conversion: The decoded digital video data is
converted back into analog signals using a digital-to-analog converter
(DAC) for display on screens or playback devices.
Video encoding and decoding in streaming analysis enable the efficient
transmission, storage, and processing of video data. These processes ensure
optimal utilization of network bandwidth, storage resources, and computing
power while maintaining acceptable video quality for streaming analytics
applications.