CP1030 : Multimedia

download report

Transcript CP1030 : Multimedia

Multimedia

Contents
 Multimedia
 Graphics / Pictures
 Audio / Sound
 Video
Multimedia

Multimedia is:
 Sound
 Graphics
 Videos

Multimedia applications





Office documents
Webpage content
Movies
Music
Pictures
Multimedia
Multimedia files are quite large
 Use compression to reduce file sizes

 Lossless Compression – algorithms reduce
size of files
○ No information is lost
 Lossy Compression – algorithm reduces
size of files
○ Some information is lost
Multimedia

Trade offs between lossless and lossy
compression
 Lossy can reduce file sizes much more

Example: File compression like 7-zip
 Uses lossless compression
 If some data is lost, then file becomes
corrupted
 Lossy compression is used in multimedia
Multimedia

Example: 38.56666666

Lossless compression
 38.56(7)

Lossy compression
 38.6
Pictures / Graphics

Graphics
 Bitmap (BMP) - windows
 Graphics Interchange Format (GIF)
 Joint Photographic Experts Group (JPEG)
 Tagged Image File Format (TIFF)
 Portable Network Graphics (PNG)

Note – the abbreviations are the file
extensions
Pictures / Graphics



Digitizing Images
Bit Map – each image is laid out in a grid
pattern
Pixel - each cell in the image
 Pixel could be black or white
 Grey scale value
 Color


The more pixels, the better the image quality
Digital cameras – megapixels
 My camera is 14.1 megapixels
 Each picture has 14.1 million cells that compose the
pictures
Pictures / Graphics




Grey Scale Bit Map Image
The snowman face is a 7x7
bitmap
Composed of 15, 15, 0, 0, 0,
15, 15, 15, 15, 0, 0, 0, 15, 15,
15, 0, 0, 0, 0, 0, 15, 7, 15, 3,
15, 3, 15, 7, 7, 15, 15, 7, 15,
15, 7, 7, 15, 3, 3, 3, 15, 7, 15,
7, 7, 7, 7, 7, 15
The file also contains a
header containing the size of
the bitmap which is 7 x 7
Bitmap of a snowman
Pictures / Graphics



Color Bit Map Image
The top photograph is a
picture with birds flying in the
sky
The bottom picture is one bird
blown up to show pixels
Pictures / Graphics
RGB (Red-Green-Blue)
 All digital images are composed of red, green and
blue
 Usually represented by hexadecimal numbers
 24 = 16;
 Numbers – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F

Example: HTML command
 bgcolor =“#0F69F3”
 bgcolor is background color
 Red = 0F, Green = 69, and Blue = F3
Pictures / Graphics

Each color has two
hexademical digits or 00
– FF, which ranges from
0 to 255

Each color is 28 and
three colors 28 28 28 =224
24-bit true color
We also have 32-bit
color


RBG can make the other
colors
Pictures / Graphics
Windows BitMap
 Bitmaps do not use compression
 Bitmaps have very large file sizes

Easy to calculate the file size

Image is 800 x 600 with 8 bit (1 byte)
color
 256 color values
Pictures / Graphics
 Calculating
Image File Size (BitMap)
Number of pixels = 800 x 600 = 480,000
pixels
 Image size = number of pixels x
number of bits

 Image size = 480,000 pixels x 1 byte =
480,000 bytes
 Image size = 480,000 / 1024 = 468.75
KBytes
Pictures / Graphics


Graphics Interchange Format (GIF)
Moderately compresses images
 Lossless compression (simple pictures)
 Good for simple pictures and graphics
Displays 256 colours or 8 bit
 Palette – it chooses the best 256 colors out of 24bit color

Common for websites
 Animated GIFs – images can display simple
animation, especially for websites

Pictures / Graphics

The animated GIF
shows a four cycle
gasoline engine

Requires special
software to create
animated GIFs
File size 369 kb

Pictures / Graphics


Joint Picture Experts Group (JPEG)
JPEG uses complex mathematical compression
 Reduces file size up to ten times that of GIF
 Causes lossy compression
 Supports True Color - 24 bit color

JPEG is great for photographs
 Used on websites
Pictures / Graphics

Note
 If the same JPEG image is re-edited, then the image can
degrade
 If you have photos that are never edited, then leave them
in JPEG
 If you re-edit the same photographs, then keep photo in
another format
○ PNG is good; file compression
○ BMP is okay if you have the space; no compression
Pictures / Graphics




Picture is 858x643
True color, 32 bit or 4
bytes
Bitmap = 2.2 MB
I converted this to BMP
and it was 2.1 MB
Tuzla, Bosnia
Pictures / Graphics
JPEG (20%) – very small
file size; 34 k
JPEG (95%) – medium
size; 212 k
Pictures / Graphics

Portable Network Graphics (PNG)
 Uses loseless data compression
 Uses 24-bit or 32-bit color
 Can be used for webpages
 Note: 32-bit color is RBGA
○ A is for alpha
○ Alpha allows translucent pictures
○ 50% alpha – can see images behind the picture
 Windows Aero effects
Pictures / Graphics

Creating digital pictures
 Scanning – digitizing an image using a
scanner
 Digital cameras
 Paint programs
 Screen capture – use prtsc to capture a
screen
Pictures / Graphics


Software
Create pictures by hand
 Microsoft Paint – comes with Windows
 Paint,net - free

Enhance photographs
 Microsoft Picture Editor
 Google Picasso
 Paint.net

Professional Software
 Adobe Photoshop
 Adobe Illustrator
 Adobe Pagemaker
Pictures / Graphics

Conclusion
 For websites
○ JPEG
○ GIF
○ PNG
○ Cannot use BMP or TIFF; too large
Pictures / Graphics

Conclusion
 No compression
○ BMP
○ TIFF
 Lossless compression
○ GIF
○ PNG
 Lossy compression
○ JPEG
Audio / Sound

Data is processed in two ways: analog or
digital

People generally process analog data that
is continuous wave patterns.

Everything we see and hear is transmitted
to our eyes and ears as light and sound
waves.
 We are equipped with analog receptors

A computer is digital
 Two discrete states: on (or 1) and off (or 0).
Audio / Sound


Computers:
Analog to digital
converters
 Convert analog to digital
○ Microphone

Digital to analog
converters
 Convert digital to analog
○ CD, MP3, etc.
Analog and digital signals
Audio / Sound
Sound cards and Modems are digitalto-analog and analog-to-digital signal
converters
 The Wave file (.wav) – used in PCs.

 Windows systems sounds
○ Start up sound
○ Many game sounds
 Wave files do not use compression
 Files are quite large
Audio / Sound

Wave file is created by
 Sampling sound – convertor samples the sound so many
times per second
 CD quality is 44,100 samples per second
 Less sampling is lower quality

Sound information is stored as bits
 Commonly 8, 16, or 32 bit sound file

Sampling – how often a sound file is read

Bitrate – how much information is stored per second
 Includes magnitude
 Includes how often sound is sampled
Audio / Sound
Audio / Sound


MP3 (MPEG-1 Audio Layer 3)
MP3 compresses sound information
 Uses lossy compression
 Some information is lost

Example: 128 kbits per second
 Reduces the file size of CD sound quality by 11
times
 Good for webpages, because file sizes are
small

Note – many audio sound formats exist;
usually for movie files
Audio / Sound
Audio Software
 Audio Editing Software lets users modify
audio clips and produce studio quality
sound tracks.

 Contains equalizers, controls, etc to modify clips
Rippers – converts audio to different
formats
 Windows 7 contains a music CD to MP3
ripper

Videos
More complex
 Has RGB color and sound
 RGB is Red-Green-Blue

 Video has three colors and a sound
Stream – picture and sound change
over time
 Requires much more information

Videos

Frame – the dimensions of a video in
pixels
 Width x height
 Example: 320x120

Each picture has color
 24-bit color

Picture changes each second
 Called bit rate
 Bit rate 25 frames per second
Videos
Our video is one hour (or 3600 seconds)
 File size = (frame)(color)(bit rate)(time)

 = 320*120*24*25*3600 = 82 Giga bits
 = 10.4 GB
 Video files are always compressed
 Most use lossy compression
○ Use compression to reduce size of the image
of a frame
○ Use compression to reduce the bit rate
Videos

Frame – dimensions of the video
 Small videos can be blown up

Bit rate
 Important for video quality
 The higher the bit rate, the higher the quality
 Videos – fast motion requires a higher bit
rate

Example – vastly simplified
Videos
An example of a video compression
 Uses three frames

 I-frame: The true picture
 P-frame: predict which pixels change
 B-frame: uses difference between the next
frame and previous frame
Videos

Compressor-decompressor (CODEC) –
a program that encodes or decodes a
streaming file
 Streaming file is video and/or audio

Companies hold patents or copyrights
for their codecs
 Restrictions apply
Videos

Video files





mp4
Windows (avi)
Windows (wmv)
Flash video (flv)
Matroska (mkv)
Files are containers (not codec)
 A variety of codecs are used which are in
the file
 MPEG2 is a codec
○ Used for DVDs
Videos


Some codecs are open source
Windows pays for the rights
 Some codecs play in MediaPlayer

Users either use
 K-lite – a windows program that contains most
codecs
 VLC Player – media player that contains most
codecs

Software may be illegal in the United States
Videos

Linux is free
 They do not pay for rights to use codecs
 Installers have to manually install codecs

Most distributions want to be legal,
especially for businesses
 Distribution is a particular Linux operating
system
 Most do not come with codecs
 Forums teach people how to install codecs
Videos

Ubuntu – install codes as software update
 Manually install DVD codec via terminal
 Businesses and companies can get into trouble
installing codecs without paying for them
 England

Linux Mint – comes with all codecs
including DVD
 France
Videos
Video editing software - users can modify a
segment of a video, called a clip.
 Users can





Reorder sequence of clips
Reduce length of clip
Add special effects to clips
Add extra tracks to clip (eg. Sound, text captions)
Video Editing Software usually includes audio
editing capabilities.
Videos

Video editing – requires a very fast
computer
 Expensive program
 VirtualDub.org – free video editing
○ Powerful filters to clean video
○ Had trouble encoding videos
○ Files were much bigger
Videos

DVD ripping – the process of converting a
DVD into a regular video file
 Converting may or may not be illegal in the U.S.
 Software may or not be illegal in the U.S.
 Windows – most programs were terrible
 Linux – AcidRip
○ Free simple program
○ Majority of the time produced good quality videos
with good file sizes
○ Linux tends to be faster than Windows