1 p2p digital tv recorder supervisor: professor michael r. lyu prepared by:ho tsz wing, andy lau wai...
TRANSCRIPT
1
P2P Digital TV Recorder
Supervisor: Professor Michael R. Lyu
Prepared by: Ho Tsz Wing, AndyLau Wai Shun, Jack
LYU0502
2
Content
1. Project background and objectives2. Summary of Work in Semester 13. Improvements in Semester 2
a) Decentralized searching algorithm and buddy list
b) Decentralized recording algorithm and bonus system
c) Streaming and video format conversion
4. Difficulties and Solution5. Further Improvements6. Conclusion
LYU0502
3
Project backgroundWatching TV is a major entertainmentPeople often miss their favorite
programsPeople need to schedule the
recording of the programs
LYU0502
4
Project objectivesAllow people to view back a previous
TV program without doing scheduling themselves
Let the users view the program on demand
Increase the availability of the TV programs
Achieve load balancing among the participating peers
LYU0502
5
Summary of Work in Sem1
Program CoreProgram Core1. Download the video file from
other peers2. No Buddy List3. All peers’ information is stored in
a centralized server4. A centralized scheduling
algorithm5. Peers unable to reject the
recording task6. Using a complex algorithm to
achieve high availability
P2P Digital TV RecorderP2P Digital TV Recorder
Performance enhancementPerformance enhancement 1. Whole file replication2. Erasure code replication
Research ResultsResearch Results1. In most cases, erasure code
replication performs better than whole file replication
2. When the peer availability attains a certain level, the performance of the whole file replication close to erasure code replication
LYU0502
6
Improvement Work in Sem2
Problem
Performance of the server become the bottleneck of the system
Cause
Queries needed to handle increase dramatically with the increase of the number of peers
Solution
Use buddy list system
Try to keep as less as information in the sever
LYU0502
7
Improvement Work in Sem2
Problem
Peers cannot reject the recording tasks => Inflexible
Cause
A centralized server will assign the recording task to the online peer without considering their contribution to the system
Solution
A distributed scheduling algorithm
Implement a bonus system
The user is able to accept or reject the task
LYU0502
8
Improvement Work in Sem2
Problem
Replication methods take too much time and CPU resource
Cause
As the original video in dvr-ms format is too large, no matter which replication we use, much time is consumed.
Solution
Implement a streaming server
Real time encoding is fast enough
9
Improvement Work - 1
1. Decentralized searching algorithm and buddy list2. Decentralized recording algorithm and bonus system
LYU0502
10
User Search Application
Login/Logout Application
Xml.asp
Database
Component of Server
LYU0502
11
Login / Logout / User Search
DirectoryDirectoryServerServer
BB
EE
CC
DD
AAOnline
Offline
Offline
Online Online
Online
Login message
Buddy Information
LYU0502
12
Task of Client Side
Client Application
Download
Streaming Recording
Download (Implemented)
• Basic function • Send the video file to the
requested peer
Streaming
• Encoding to wmv• Preview function
Recording
• Scheduling among
peers• Bonus system
LYU0502
13
Download Topology – Napster (Sem1)
Owner@
Client
Lookup(“TVB News”)
N6
N9 N7
Server
N8
N3
N2N1
Simple, but O(N) states and a single point of failure
Key=“TVB News”
N4
LYU0502
14
Download Topology – Gnutella (Sem 2)
N4Owner@
Client
N6
N9
N7N8
N3
N2N1
Robust, but in the worst case O(N) messages per lookup
Key=“TVB News”
Lookup(“TVB News”)
LYU0502
15
P2P Digital TV Recorder Protocol
Download & Streaming / Recording MessageIP
IDType
Program TitleTTL / Hop
Port / Channel
LYU0502
16
Performance Enhancement
Forward the message to other peersForward the message to other peersForward the message to other peersForward the message to other peers
All pass
CheckCheckIPIP
FieldField
Check Check Message Message
IDID
Check Check TTLTTL
Check Check File File
ExistExist
LYU0502
17
Scheduling of Recording Task
1. Peers initialize the recording task when the program starts
2. Peers are able to determine recording or not if the bonus points of the peers attain a particular level
3. Peers forward the recording message to one of its buddies
1. Server will schedule the recording of all program in the morning
2. Send out the recording request to 2 peers randomly before the program starts
3. Peers who received the recording request cannot reject it.
Centralized Decentralized
LYU0502
18
Scheduling PoliciesIncoming message
Check IP Field
Check Message ID
Unequal
Forward the Recording message
Equal
Check Points
Check Hops
First Time
Repeated
Equal
Unequal
LYU0502
19
Scheduling Policies
Check Points
Forward the Recording message
Recording the Program
Record Or Not ?
Above 10
Below 10
NoPoint
DecrementYes
PointIncrement
PointIncrement
LYU0502
20
Bonus System
Free Rider
unable to decide record or not
Normal User
able to decide record or not
10 10+
21
Improvement Work - 2
Video-On-Demand (VoD) streaming
LYU0502
22
Why use VoD streaming?
Download the user needs to wait for a long time errors may occur in the downloading process
VoD streaming save the user a lot of time and storage space can be used as a preview function
LYU0502
23
Windows Media Encoder SDK
DirectShow Library
GraphEdit
Tools used in developing the streaming application
LYU0502
24
DirectShow Library
a media-streaming architecture for the Microsoft Windows® platform
provides for high-quality capture and playback of multimedia streams
Example uses: file players video editing applications file format converters etc.
LYU0502
25
DirectShow Filters and Filter Graphs
DirectShow Filters receive multimedia streams as input and produce
output A source filter introduces data into the graph. A transform filter takes an input stream, processes
the data, and creates an output stream. Renderer filters receive data and present it to the user
Filter Graphs A set of connected filters controlled by a high-level component called the Filter
Graph Manager
LYU0502
26
DirectShow Architecture
LYU0502
27
Writing a DirectShow Application
The application1. creates an instance of the Filter Graph Manager.
2. uses the Filter Graph Manager to build a filter graph.
3. uses the Filter Graph Manager to control the filter graph and stream data through the filters.
LYU0502
28
Approaches in Graph Building
Approach Method Used
The Filter Graph Manager builds the entire graph
RenderFile
The Filter Graph Manager builds part of the graph
Render
The application builds the entire graph AddFilter, Connect or ConnectDirect
LYU0502
29
Reasons for using DirectShow Library
1. Windows MCE records TV programs in dvr-ms format
2. Dvr-ms files are not efficient for storage (1hr TV program recorded in good quality requires about 1668MB)
3. Dvr-ms files cannot be streamed over the internet
4. DirectShow is used to convert dvr-ms file to wmv file that can be used for streaming
5. The file size of 1 hr wmv file is only 101MB if the bit rate is 225kbps
LYU0502
30
Number of days of TV programmes that can be recorded with a given hard disk size
20.63
1.250
5
10
15
20
25
0 20 40 60
Harddisk size (GB)
Num
ber
of d
ays
Harddisk size dvr-ms wmv
1.31
22.09
LYU0502
31
GraphEditThe filter graph built by our
application
LYU0502
32
Uses of DirectShow Library
Steps to convert dvr-ms file to wmv file using DirectShow Library:1. start once Windows MCE has finished recording a
particular TV program
2. create the filter graph and render the dvr-ms file
3. original dvr-ms file will be deleted in the case that the storage space is not sufficient for new recording
LYU0502
33
Experiment Result
Bit Rate (Kbps)
Video Size File Size (KB)
Conversion Time (s)
218 320 x 240 1,711 58
441 320 x 240 3,317 60
666 320 x 240 4,928 62
218 480 x 360 1,731 115
441 480 x 360 3,413 116
666 480 x 360 5,069 125
The dvr-ms file used in this experiment has a length of 60s, a file size of 27,399KB and is recorded in good quality
LYU0502
34
Experiment Result
Bit Rate (Kbps)
Video Size File Size (KB)
Conversion Time (s)
666 320 x 240 4,928 62
666 480 x 360 5,069 125
666 640 x 480 5,170 209
666 800 x 600 5,194 327
The dvr-ms file used in this experiment has a length of 60s, a file size of 27,399KB and is recorded in good quality
LYU0502
35
Windows Media Encoder SDK
used to compress live or stored audio and video content into Windows Media files or streams
create multimedia productions from devices attached to their computers
LYU0502
36
Steps to create an encoding application
Create Encoder Object
Create/Load Profile Object Associate
Profile with Encoder
Add Source in Source Group Collection in
Encoder Object
Provide Audio Or Video Input source (e.g. File, Device
Name)
Add Source type (Audio or Video or
Both) in source Group
Provide Encoder output (e.g. File,
Broadcast)
Start the encoding session
General Encoder Flow
LYU0502
37
Encoding with CBR and VBR
Constant Bit Rate (CBR) Encoding bit rate and size of the content are known before
encoding for content that varies in complexity, the encoding
quality is not constant
Variable Bit Rate (VBR) Encoding it compensates for changes in the complexity of the
content bit rate and size of the content are not known before
the encoding
LYU0502
38
Uses of Windows Media Encoder SDK
1. When the client receives a streaming request, it will create an encoder object, encode the appropriate file using CBR encoding and broadcast it at the address http://localhost:8080
2. It then connects to the requesting peer and the peer will view the file at the specified address
LYU0502
39
Streaming Architecture
DirectoryDirectoryServerServer
BB
EE
CC
DD
AAStreaming Host
Streaming Host
Streaming Host
Streaming Host
Streaming Host
Streaming request
Streaming request
Connection established
LYU0502
40
Difficulties and Solutions
Difficulty Dvr-ms file (the default file format for the recorded TV
in Windows MCE) cannot be streamed over the Internet
Cause Windows Media Encoder 9 Series SDK does not
support the encoding and broadcasting of dvr-ms file
Solution We have to use DirectShow Library to convert the
dvr-ms file to a format that is compatible with Windows Media Encoder 9 Series SDK (i.e. wmv file).
LYU0502
41
Difficulties and Solutions
Difficulty The wmv file resulted from the conversion of dvr-ms
file by DirectShow Library has sound only but no video.
Cause The default transform filter chosen by the RenderFile
method (InterVideo Video Decoder) cannot decode MPEG-2 stream to MPEG-1 stream
Solution So we have chosen to use the GPL MPEG-1/2
Decoder in our filter graph to solve this problem
LYU0502
42
Further improvement
It is possible to have real time streaming in the following ways: First, we can start the file conversion as soon as
Windows MCE starts to record the TV program Next, we can use Windows Media Encoder SDK to
encode the wmv file and broadcast it at http://localhost:8080
Finally, the client can connect to the above address to get the video content instantly
However, there is one drawback as doing recording and converting at the same time takes up a lot of CPU time
LYU0502
43
Further improvementIt is also possible to use p2p
technique to stream the file It can reduce the network bottleneck at the video
server It can provide a fault tolerant Video-on-Demand
streaming it raises technical, performance, quality, business,
and legal issues
LYU0502
44
Conclusion
We have implemented our application in a decentralized ways using a buddy list system to enhance the performance.
We have introduced a distributed scheduling algorithm and a bonus system to enhance the availability of the TV programmes.
We have also developed a streaming server to reduce the storage requirement and enabled the user to preview the TV programmes.
45