Media Types
N4 & 5 Computing Science
Contents
National 4
• Sound, graphics, video, text
National 5
• Standard file formats:• text: txt, rtf• audio: wav, mp3• graphics: jpeg, bmp, gif, png• video: mp4, avi• pdf • Factors affecting file size and quality,
including resolution, colour depth, sampling rate.
• Calculation of file size for colour bitmap
• Need for compression
Media Types
• Information Systems can contain the following types of media:
• Sound, graphics, video & text
4/5
Sound
• Sound files can be very useful when developing an information system.
• Sound files can hold e.g. :• recordings of – Facts / information e.g. Explanations of complex
ideas– Music– Sound effects
4/5
Graphics
• Graphics are very useful for • Illustrating facts / information / explanations• Making the information system more
attractive
4/5
Video
• Video clips are very useful • They combine moving images and sound and
can illustrate very complex ideas• They can make the information in a system
readily accessible to everyone e.g.– Here is a video clip of Asimo the robot
• Asimo videos can be found here:-http://asimo.honda.com/asimotv/
4/5
Text
• Information systems can -• Display text on a screen• Hold text files which you can choose to open
5
Text files• Text files can be saved in many formats• You need to know about txt and rtf• A .txt file has no information about the format of the
document e.g.– text style, alignment, fonts, sizes
• Because it lacks formatting information -– a .txt file will be smaller than a Rich Text file– will need less storage space– be quicker to transmit across a network
• You can open a .txt file using any text editor or word processor
5
Rich Text Format (RTF)
• Rich Text Format (RTF)• A file saved in .rtf has formatting information
and the actual text
• It includes information about styles, fonts, sizes, paragraphing and indentation
• It will be larger than an equivalent .txt file
5
Questions
1. Describe an advantage of saving a document as an RTF file
2. A document is saved as a txt file and as an RTF file:-
a) Which is larger?b) Why is it larger?c) Which is quicker to transfer across a network?
4/5
The need for compression• Graphic, Sound and Video files can be very
large • Video files can be Gigabytes in size• They take up lots of storage space• They can take a long time to transmit across a
network• So they need to be compressed
5
Factors affecting the file size and quality of graphics files
• Resolution
• Colour depth
5
Resolution
• The resolution is the number of pixels that make up an image e.g
• 1280 x 1024• 1600 x 1200• 1920 x 1200
The higher the resolution the better the quality of the graphic & the greater the file size
5
Resolution example 5
Resolution 5
Colour Depth
• The colour depth is the number of bits used to represent each pixel
• The greater the colour depth:- – the more colours – the greater the file size
Colour depth Number of possible colours.
1 2 ( black or white)
8 256
16 65,536
24 16,777,216
5
How graphics are stored 4/5
Colour Depth5
Questions
3. How does the resolution affect the:-a) the quality of a graphic?b) the file size of a graphic?
4. How does the bit depth affect the:-a) the quality of a graphic?b) the file size of a graphic?
4/5
Calculating the size of a graphic - 1
• Use this formula to calculate the size of a graphic:
File size = number of pixels x bit depth
• File size = 6 x 150 x 4 x 150 x 24 • = 1.54 Megabytes
Colour depth Resolution Dimensions
24 150 dpi 6” x 4“
5
Calculating the size of a graphic - 2
• Use this formula to calculate the size of a graphic:
File size = number of pixels x bit depth
• File size = 3664 x 2748 x 16 • = 19.2 Megabytes• Without compression graphic files can be very large
Colour depth Resolution
16 3664 x 2748
5
Questions
5. Calculate the file size of these graphics:-
Colour bit depth Resolution Dimensions
a 24 1920 x 1200
b 8 72 dpi 4” x 3”
c 16 3264 x 2448
5
5.a) File size = 1920 x 1200 x 24 bits = 55296000 bits = 6912000 bytes = 6750 Kilobytes = 6.592 Megabytes
Colour bit depth Resolution Dimensions
a 24 1920 x 1200
b 8 72 dpi 4” x 3”
c 16 3264 x 2448
5
5.b) File size = 4 x 72 x 3 x 72 x 8 bits = 497664 bits = 62208 bytes = 60.75 Kilobytes
Colour bit depth Resolution Dimensions
a 24 1920 x 1200
b 8 72 dpi 4” x 3”
c 16 3264 x 2448
5
5.c) File size = 3264 x 2448 x 16 bits = 127844352 bits = 15980544 bytes = 15606 Kilobytes = 15.3 Megabytes
Colour bit depth Resolution Dimensions
a 24 1920 x 1200
b 8 72 dpi 4” x 3”
c 16 3264 x 2448
5
Graphic Files
• You need to know about the following graphic files:
.BMP, .GIF, .JPEG, .PNG
5
BitMap (BMP)
• The .bmp format stores color data for each pixel in the image without any compression
• .bmp files can be very large
5
Graphics Interchange Format (GIF)
• Each pixel is represented by an 8-bit colour code
• Number of possible colours is 28= 256 • Unsuitable for storing photographic images• Used to represent charts, cartoons, or
drawings • Uses lossless compression to reduce the file
size without losing any of the data about the image
5
JPEG• A bit map graphics file format which uses lossy
compression
• Makes the graphic file smaller by changing the colour of some pixels (to match neighbouring pixels) that won’t be noticed by the human eye
• Often used in digital cameras when storing digital photographs
• Not used for storing cartoons or drawings because some of the data is lost and this reduces the quality of the image
5
Portable Network Graphics {PNG}
• PNG compresses files• Like GIF format it uses lossless compression• Compresses graphics more than the GIF format
{ a PNG file can be up to 25% smaller than the equivalent GIF file}
• Used for graphics that will be sent across a network because they are lossless and small
• Bit depth of up to 48 bits = variety of 248 colours• Graphic can have a degree of transparency
5
Questions6. Name 2 graphic file formats that use lossless
compression7. Name a graphic file format that uses lossy
compression8. Name a graphic file format that does not use
compression9. State 3 facts about the GIF format10.State the graphic file format that is most suitable
for a photo that will be sent across a network
5
Practical Task Find a graphic that you like and save it in a folder called
Graphic files. Open the graphic with Paint then save it a number of times
using different file types to complete this table:-
File type Resolution File size Number of colours
Bit Depth Quality
JPEG 329 x 299 82.8 Kb 224 24 Excellent
GIF 329 x 299 256 8
16 colour bitmap
329 x 299 16 4
2 colour bitmap
329 x 299 2 1
5
Factors affecting the file size and quality of sound files
• Sampling rate (frequency):– E.g. 44.1 kHz
• Bit depth– E.g. 8 bits, 16 bits
• Time ( seconds) affects the size – but not the quality
5
Sampling Rate
• The sampling rate is the number of samples of a sound wave measured each second
• This is measured in kHz ( thousands per second) e.g. 44.1 kHz = 44,100 samples per second
5
Sampling rateThe higher the sampling rate the better the quality of the sound + the bigger the file size
5
Audio sample Bit depth (Sample depth)
• The bit depth is the number of bits used to represent each sample of the sound wave
• The more bits used = the higher the quality = the larger the file size
5
Audio Files
• You need to know about these audio file formats:
WAV , MP3
5
WAV
• WAV is the standard for storing sound files on windows systems
• Bit depth: 8 bits or 16 bits• Sampling rates: 11.025KHz, 22.05 KHz, or
44.1KHz• Wav files can be very large• 1 minute of sound can take up as much as
27Mbytes of storage
5
MP3
• MP3 is a file format for compressing sound files
• It cuts out parts of the sound that human ears cannot hear
• It cuts out quiet sounds when a loud sounds happens at the same time
• It reduces the file size without a noticeable loss of quality
5
WAV and MP3 ComparisonNote the difference in file size between the .mp3 version and the WAV version
5
Factors affecting the file size and quality of video files
• Resolution of each image(frame)• Bit depth of each image• Frame rate: the number of frames per second• Time: in seconds
5
Video File Formats
• You need to know about the following Video File Formats:
AVI , MP4
5
Audio Video Interleave format (.AVI)
• The Audio Video Interleave format was developed by Microsoft and is commonly used in Windows applications like Media Player
• This format does not have built-in compression.
• Maximum resolution is 320 x 240• Maximum frame rate is 30 frames per second• File size limited to 2Gb
5
Avi
• AVI files contain the audio and video data in one file
• This allows synchronous audio/video playback of a file
• AVI is a container format, meaning it can contain video and audio compressed using many different combinations of codecs
• (A codec is a program that compresses and decompresses files)
5
MPEG4
• MPEG-4 is an(audio and video) compression method designed specially for low-bandwidth (less than 1.5MBit/sec bitrate) video/audio encoding purposes
• MPEG-4 can deliver high-quality audio and video over the Internet to desktops, laptops, tablets &smartphones
5
Comparison of AVI & Mpeg4
• Both AVI and MPEG are lossy formats which sacrifices quality for file size
• Both AVI and MPEG can contain both audio and video data in a file container
• The quality of a video file is not dependent on the type of container file format - it is dependent on the type of codec contained within the container file
• H.264 video codec frequently used with the MP4 container is thought to be one of the highest-quality video standards available.
5
PDF – Portable Document Format
• PDF was developed in the early 1990s as a way to share documents
• Adobe Acrobat or Foxit Reader are used to display the files
• Used for documents with text and images
• Allows documents to be viewed on different platforms that don’t have the same application software
5
Questions
13. Describe the purpose of a of a codec?14. Describe a container file15. Describe the AVI file format16.Describe the MPeg4 file format17.Do AVI and MPeg4 use lossy or lossless
compression?18.Describe the PDF format and explain why it is useful
5
File type Uses Type of compression Factors affecting file size
Text files
TXT
RTF
Graphics files
Bit map
Gif
JPEG
PNG
Audio files
WAV
MP3
Video files
AVI
MPEG-4
5
Revision
• Create a mind map about Media Types
4/5