Perancangan dan Implementasi Proses Video Streaming Dengan Menggunakan Media Sistem Radio Point To Point.

ABSTRAK

Ide dasar dari proses video streaming adalah membagi paket video ke
dalam beberapa bagian, mentransmisikan paket tersebut. Kemudian penerima
(receiver) dapat men-decode dan menjalankan potongan paket file video tanpa harus
menunggu seluruh file terkirim ke mesin penerima. Proses video streaming ini
berlangsung antara komputer server dan komputer client.
Media yang digunakan untuk proses video streaming ini adalah sistem
radio point to point yang menggunakan teknik direct seqrence spread spectrrm.
Teknik ini memungkinkan sinyal informasi disebar dengan sinyal penebar yang
mempunyai lebar bidang frekuensi yang lebih besar dibandingkan lebar frekuensi
sinyal informasi. Sinyal informasi dimodulasi secara langsung oleh pengkode data
yang memakai deret kode yang memiliki sifat acak semu.
Untuk merealisasikan proses video streaming, maka dibuat suatu halaman
server yang dapat menampilkan gambar yang terekam melalui web camera dan juga
mengirimkan gambar-gambar tersebut ke komputer client. Sedangkan pada halaman
client dapat ditampilkan gambar-gambar hasil proses video streaming dari komputer
server dan juga dapat dilakukan proses penyimpanan dari gambar-gambar yang
muncul pada halaman client. Perancangan proses video streaming ini menggunakan
bahasa pemrograman Visual Basic.


i

Universitas Kristen Maranatha

ABSTRACT

The basic idea of video streaming process is to divide the video packet
into several parts and to transmit the packet. After that the receiver decodes and runs
the part of video file packet without having to wait for all the files to be received.
This video streaming process is being performed between the server and the client’s
PC.
The media that is used for this video streaming process is point to point
radio system with direct sequence spread spectrum technique. This technique allows
information signal being spreaded by spreader signal which has bigger bandwidth
than the information signal. Information signal is directly modulated by data coder
using pseudo random line.
In order to realize the video streaming process, a server page is made to
show pictures that are captured by web camera and also send those pictures to the
client’s PC. The pictures resulted from video streaming can be shown and stored by
the client. This video streaming process uses Visual Basic Programming.


ii

Universitas Kristen Maranatha

KATA PENGANTAR

Puji dan syukur kepada Tuhan Yang Maha Esa atas hikmat dan karuniaNya, sehingga Laporan Tugas Akhir dengan judul PERANCANGAN DAN
IMPLEMENTASI

PROSES

VIDEO

STREAMING

DENGAN

MENGGUNAKAN MEDIA SISTEM RADIO POINT TO POINT ini dapat
diselesaikan.

Laporan Tugas Akhir ini diajukan untuk memenuhi persyaratan dalam
menempuh program pendidikan sarjana strata satu ( S-1 ) pada fakultas Teknik
Jurusan Teknik Elektro, Universitas Kristen Maranatha.
Pembuatan Laporan Tugas Akhir ini tidak dapat selesai dengan baik tanpa
bantuan dan dukungan dari berbagai pihak. Untuk itu penulis ingin mengucapkan
terima kasih yang sebesar-besarnya kepada :
1. Ibu Ir. Anita Supartono, M.Sc. dan Bapak Roy Pramono Adhie, ST. MT. selaku
pembimbing I dan II yang telah meluangkan waktu, tenaga dan perhatiannya
untuk memberi bimbingan, pengarahan dan petunjuk serta motivasi selama
penyusunan tugas akhir ini.
2. Bapak Ir. Aan Darmawan, MT. selaku Ketua Jurusan Teknik Elektro Universitas
Kristen Maranatha
3.

Bapak Marvin CH Wijaya, ST. MM. MT. selaku Sekretaris Jurusan Teknik
Elektro dan penguji yang telah memberi masukan yang sangat berguna dalam
menyelesaikan tugas akhir ini.

4. Bapak Ir. Judea J Jarden, MT. dan Bapak Ir. Supartono, M.Sc. selaku penguji yang
telah memberi masukan yang sangat berguna dalam menyelesaikan tugas akhir

ini.
5. Dosen wali dan segenap dosen Fakultas Teknik Jurusan Teknik Elektro Universitas
Kristen Maranatha yang telah membekali penulis dengan berbagai ilmu selama
penulis menuntut ilmu di Fakultas Teknik Jurusan Teknik Elektro.

iii

Universitas Kristen Maranatha

6. Bapak Tunggul Arief, ST. MT. yang telah memberikan ijin atas peminjaman radio
point to point dan membantu selama proses pengerjaan tugas akhir ini.
7. Seluruh staf administrasi dan tata usaha Fakultas Teknik Jurusan Teknik Elektro
yang telah banyak membantu penulis mendapatkan bahan-bahan dalam
penyusunan tugas akhir.
8. Koordinator Laboratorium Komputer yang telah memberikan ijin atas pemakaian
komputer yang ada di Laboratorium Komputer.
9. Papa dan Mama tercinta yang selalu memberikan dukungan baik moral
maupun materi.
10. Kakakku Marlin yang selalu memberikan dukungan dan doa untuk penulis.
11. Keluarga besar Iwan Gunawan dan Supardi Sutedja atas dukungan baik moral

maupun materi.
12. Semua saudara dan keponakan di Bandung atas doa dan bantuannya.
13. Sahabatku Han Ming, Tina, Anil, Grace, dan Yohanes atas dukungannya.
14. Rina, Charles, Dhira, Ola, Andreas, Iksan, Ching Shia, Daut, An Lie, Ken, Anton,
Tuti, Wulan, Dian, Adi, Suhai, Rosy, teman-teman angkatan 2002 dan temanteman yang tidak dapat penulis sebutkan satu persatu.
15. Semua pihak yang telah membantu baik secara langsung maupun tidak
langsung, yang tidak dapat disebutkan namanya satu persatu.
Semoga Tuhan selalu melimpahkan anugerah dan berkat-Nya kepada
semua pihak yang telah banyak membantu. Laporan Tugas Akhir ini telah dibuat
sebaik mungkin, namun penulis menyadari bahwa laporan ini masih jauh dari
sempurna. Oleh karena itu, penulis sangat mengharapkan kritik dan saran yang
sifatnya membangun untuk kemajuan di masa yang akan datang.

Bandung,

Juli 2006

Penulis

iv


Universitas Kristen Maranatha

DAFTAR ISI

ABSTRAK………………………………………………………………………... i
KATA PENGANTAR…………………………………………………………….. iii
DAFTAR ISI………………………………………………………………………. v
DAFTAR GAMBAR………………………..…………………………………….. viii
DAFTAR TABEL…………………………………………………………………. ix
BAB I PENDAHULUAN………………………..………………………………... 1
1.1 Latar belakang Masalah……………..…………………………..... 1
1.2 Perumusan Masalah…………………..………………………....... 2
1.3 Tujuan…………………………………..…………………..…….. 2
1.4 Pembatasan Masalah………………………………………............ 2
1.5 Sistematika Penulisan…………………….……………………..... 3
BAB II LANDASAN TEORI……………………….....……...………………...... 4
2.1

Video Streaming………………………………………………….. 4

2.1.1

Metode Transfer Video Streaming……………......…….... 5

2.1.2

Masalah Dasar Dalam Video Streaming………..…….….. 5

2.1.3

Sistem Transmisi Pada Proses Streaming……….…….…. 6
2.1.3.1 Sistem Transmisi Unicast…………..........….....…. 6
2.1.3.2 Sistem Transmisi Multicast…………………….... 7

2.2

TCP / IP ( Transmission Control Protocol / Internet Protocol )…. 8

2.3


LAN ( Local Area Network )…….......……..…………………..... 9

2.4

Bridge……………………………………….....………………… 10

2.5

Modem……………………………………......…………….……. 11

2.6

2.5.1

Amplitude Shift Keying ( ASK )……......………….……. 11

2.5.2

Frequency Shift Keying ( FSK )……..……………….….. 12


2.5.3

Phase Shift Keying ( PSK )…………...…………………. 12

Media Transmisi……………………………...………………….. 13

v

Universitas Kristen Maranatha

2.6.1

Media Transmisi Guided…………….......…………….…. 15

2.6.2

Media Transmisi Unguided………….......……………….. 15

2.7


Satuan Transmisi……………………………....……………….… 16

2.8

Full-Duplex dan Half-Duplex………………………….……….... 18

2.9

Client-Server……………………………………………………... 18

2.10 Sistem Transmisi Spread Spectrum…………………..………….. 18
2.11 Dasar Komunikasi Radio……………………………………….... 20
BAB III SISTEM RADIO POINT TO POINT…………………………….……... 24
3.1 Konfigurasi Sistem ………………………………........................... 24
3.2 Ethernet.............................................................................................. 25
3.3 Ethernet Bridge…………………………………………….....….… 26
3.4 Direct Sequence Spread Spectrum……………………………...….. 26
3.4.1

Transmitter Direct Sequence Spread Spectrum………….. 27

3.4.1.1 PN Code Generator…………………………...….. 28
3.4.1.2 Binary Adder........................................................... 29
3.4.1.3 Modulator…………................................................ 30

3.4.2

Receiver Direct Sequence Spread Spectrum………..….… 30
3.4.2.1 Demodulator………………………………...….… 32
3.4.2.2 Low Pass Filter……………………………...….… 32
3.4.2.3 Korelator..…………………………………...….... 32

3.5 Transceiver…………………………………………………...…….. 33
3.6 Perhitungan dan Analisa Link………………………………...……. 33
BAB IV PERANCANGAN DAN ANALISA PROSES VIDEO STREAMING… 37
4.1 Mekanisme Komunikasi Jaringan ……………………………...….. 37
4.2 Video Digital……………………………………………………..... 37
4.3 Socket……………………………………………………………... . 38
4.4 TCP ( Transmission Control Protocol )…………………………..... 39
4.5 Perancangan Video Streaming…………………………………...… 39
4.6 Pemrograman Pada Sisi Server…………………………………...… 41

vi

Universitas Kristen Maranatha

4.6.1

Diagram Alir Server……………………………………… 42

4.6.2

Halaman Server…………………………………………... 43
4.6.2.1 Satu Tampilan Pada Halaman Server...................... 43
4.6.2.2 Dua Tampilan Pada Halaman Server.…………..... 44

4.7 Pemrograman Pada Sisi Client…………………………….……..... 45
4.7.1

Diagram Alir Client……………………………………… 46

4.7.2

Halaman Client……………………………………..……. 47
4.7.2.1 Satu Tampilan Pada Halaman Client...................... 47
4.7.2.2 Dua Tampilan Pada Halaman Client…….……...... 50

BAB V PENUTUP…………………………………………………........................ 54
5.1

Kesimpulan……………………………………..........……...……. 54

5.2

Saran…………………………………………......…….......……... 54

DAFTAR PUSTAKA
LAMPIRAN A : PERANGKAT LUNAK
LAMPIRAN B : SPESIFIKASI ALAT DAN FOTO

vii

Universitas Kristen Maranatha

DAFTAR GAMBAR

Gambar 2.1 Prinsip Kerja Video Streaming............................................................ 4
Gambar 2.2 Sistem Transmisi Unicast.................................................................... 7
Gambar 2.3 Sistem Transmisi Multicast................................................................. 7
Gambar 2.4 Hubungan Tiap Lapisan Protokol………………………………….... 8
Gambar 2.5 Kunci Pemindah Amplitudo …………………………..……………. 11
Gambar 2.6 Kunci Pemindah Frekuensi…………………………..……………… 12
Gambar 2.7 Kunci Pemindah Fase……………………………………………….. 13
Gambar 2.8 Sistem Komunikasi Radio................................................................... 21
Gambar 3.1 Konfigurasi Sistem.............................................................................. 24
Gambar 3.2 Blok Diagram Sistem……………………………………………….. 25
Gambar 3.3 Direct Sequence Spread Spectrum………………………………….. 27
Gambar 3.4 Transmitter Direct Sequence Spread Spectrum…………………….. 28
Gambar 3.5 Sinyal informasi…………………………………………………….. 29
Gambar 3.6 Sinyal pita modulasi……….………………………………………... 29
Gambar 3.7 Spreading……………………………………………………………. 30
Gambar 3.8 Receiver Direct Sequence Spread Spectrum………………………... 32
Gambar 3.9 Despreading…………………………………………………………. 33
Gambar 3.10 Perhitungan Link Budgetting……………………………………….. 36
Gambar 4.1 Konfigurasi Sistem Proses Video Streaming..……………………… 37
Gambar 4.2 Proses Interaksi Socket Antara Client-Server………………………. 41
Gambar 4.3 Diagram Alir Server………………………………………………… 42
Gambar 4.4 Satu Tampilan Pada Halaman Server……………………………….. 43
Gambar 4.5 Dua Tampilan Pada Halaman Server................................................... 44
Gambar 4.6 Diagram Alir Client............................................................................. 46
Gambar 4.7 Satu Tampilan Pada Halaman Client.................................................... 47
Gambar 4.8 Dua Tampilan Pada Halaman Client.................................................... 50

viii

Universitas Kristen Maranatha

DAFTAR TABEL

Tabel 2.1 Rentang band frekuensi……….............................................................. 16

ix

Universitas Kristen Maranatha

BABBI
PENDAHULUAN

B1.1 LatarBBelakangB
Sebuah file video yang akan ditampilkan pada client dapat menggunakan
dua metode transfer. Pertama dengan men-download file video tersebut dan yang
kedua adalah dengan melakukan proses streaming. Sebuah file video yang diambil
dari sebuah mesin server dengan men-download-nya tidak dapat ditampilkan
sebelum seluruh file video selesai dikirimkan ke client. Untuk menanggulangi hal
tersebut, maka metode yang akan digunakan pada tugas akhir ini adalah video
streaming. Video streaming adalah suatu kegiatan dari pengiriman audio dan video
melalui suatu jaringan dari satu komputer menuju komputer yang lain kemudian filefile media tersebut dijalankan bersamaan dengan penerimaan file-file tersebut, dan
bukan merupakan proses downloading. Data yang dialirkan dikirimkan oleh aplikasi
server. Aplikasi user mulai menayangkan video secara real time secepatnya setelah
data yang diterima mencukupi.
Media yang akan digunakan untuk proses video streaming ini adalah suatu
sistem radio point to point yang menggunakan teknologi komunikasi direct sequence
spread spectrum. Dengan penggunaan sistem radio point to point sebagai media
transmisi, proses komunikasi tidak memerlukan sambungan kabel ataupun pulsa
telepon / internet. Sehingga daerah-daerah yang tidak terhubung dengan kabel tetap
dapat melakukan proses video streaming. Sistem radio point to point dengan teknik
komunikasi direct sequence spread spectrum ini memiliki beberapa keunggulan yaitu
mempunyai tingkat keamanan yang tinggi, kekebalan terhadap noise serta
kemampuan untuk multiple access.

1

Universitas Kristen Maranatha

1.2BPerumusanBMasalah
Adapun perumusan masalah yang akan dianalisa adalah :
1. Bagaimana perancangan dari proses video streaming dan juga proses
penyimpanannya ?
2.B BBagaimanaB Bperancangan dari proses video streaming dengan dua tampilan
dalam satu halaman baik pada sisi client maupun pada sisi server ?
3. Apakah sistem radio point to point dapat diimplementasikan sebagai media
dalam proses video streaming ?

1.3BTujuanB
Adapun tujuan dari penyusunan tugas akhir ini yaitu :
1. Merancang program pada sisi server dan sisi client untuk merealisasikan
proses video streaming dan juga proses penyimpanannya.
2. Merancang program video streaming dengan dua tampilan dalam satu
halaman baik pada sisi client maupun pada sisi server.
3. Mengimplementasikan sistem radio point to point sebagai media dalam
proses video streaming.

1.4BPembatasanBMasalah
Pada tugas akhir ini, masalah yang akan dibahas dibatasi pada :
1. Perekaman video menggunakan web camera yang sudah tersedia dengan
spesifikasi pada lampiran.
2. Data dikirimkan melalui proses video streaming dengan menggunakan
media sistem radio point to point.
3. Sistem radio point to point yang digunakan sebagai media sudah tersedia
dengan spesifikasi alat pada lampiran.

2

Universitas Kristen Maranatha

1.5BSistematikaBPenulisan
Penulisan laporan tugas akhir ini terdiri dari lima bab dengan penyusunan
sebagai berikut :

1.BBBBabBIBPendahuluan
Pada bab ini dibahas tentang latar belakang, perumusan masalah, tujuan,
pembatasan masalah dan sistematika penulisan dari laporan tugas akhir ini.
2.BBBBabBIIBLandasanBTeori
Pada bab ini dibahas mengenai video streaming, TCP/IP ( Transmission
Control Protocol / Internet Protocol ), LAN ( Local Area Network ), bridge,
modem, media transmisi, satuan transmisi, half-duplex dan full-duplex,
client-server, sistem transmisi spread spectrum, serta dasar komunikasi
radio.
3.BBBBabBIIIBSistemBRadioBPointBToBPoint
Pada bab ini dibahas tentang pemancar dan penerima pada sistem radio
point to point yang menggunakan teknik direct sequence spread spectrum.
4.BBBBabBIVBPerancanganBdanBAnalisaBProsesBVideoBStreaming
Pada bab ini dibahas tentang perancangan program untuk merealisasikan
proses video streaming dengan media sistem radio point to point serta
analisa hasil dari proses video streaming.
5.BBBBabBVBKesimpulanBdanBSaran
Pada bab ini dibahas tentang kesimpulan berdasarkan hasil analisa data serta
saran-saran bagi pengembangan lebih lanjut.

3

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Server Untuk Satu Tampilan
Dim iSockets As Integer
Dim sServerMsg As String
Dim sStatusBar As String
Dim sRequestID As String
Dim i As Integer
Const PORT = 1007
Private Declare Function Preview Lib "CamCap.dll" () As Long
Private Declare Sub CleanUp Lib "CamCap.dll" ()
Private Declare Function StartUp Lib "CamCap.dll" () As Long
Private Sub Form_Load()
If (StartUp = 0) Then
MsgBox "Error in Initializing. Make sure that video capture device is installed properly",
vbOKOnly Or vbCritical, "Error"
Unload Me
Else
Me.ScaleMode = 3
sStatusBar = "Local IP Address :" & socket(0).LocalIP
socket(0).LocalPort = PORT
sServerMsg = "Listening to port: " & socket(0).LocalPort
List1.AddItem (sServerMsg)
StatusBar1.SimpleText = sStatusBar
socket(0).Listen
Preview Me.Picture1.hwnd, 0
End If
End Sub
Private Sub Form_Unload()
CleanUp
End Sub
Private Sub socket_Close(Index As Integer)
Timer1.Enabled = False
sServerMsg = "Connection closed: " & socket(Index).RemoteHostIP
List1.AddItem (sServerMsg)
socket(Index).Close
Unload socket(Index)
iSockets = iSockets - 1
sServerMsg = "Connection : " & iSockets
List1.AddItem (sServerMsg)
End Sub
Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
sServerMsg = "Connection request id " & requestID & " from " & socket(Index).RemoteHostIP
If Index = 0 Then
List1.AddItem (sServerMsg)
sRequestID = requestID
iSockets = iSockets + 1
sServerMsg = "Connection : " & iSockets

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

List1.AddItem (sServerMsg)
Load socket(iSockets)
socket(iSockets).LocalPort = PORT
socket(iSockets).Accept requestID
If iSockets > 1 Then
List1.AddItem ("Connection refused : " & socket(Index).RemoteHostIP & " Reason : Busy")
socket(iSockets).SendData "Busy"
socket(iSockets).Close
Unload socket(iSockets)
iSockets = iSockets - 1
sServerMsg = "Connection : " & iSockets
List1.AddItem (sServerMsg)
Else
Timer1.Enabled = True
End If
End If
End Sub
Private Sub Timer1_Timer()
Dim Ih As Object
Dim nQuality As Integer
Dim strPath As String
Dim strMsg As String
Dim lngResult As Long
strPath = "temp.jpg"
nQuality = 75
Set Ih = CreateObject("ImageHandler.RectToJpeg")
If IsObject(Ih) Then
lngResult = Ih.HdcToJpeg(Picture1.hDC, _
0, _
0, _
Picture1.Width - 4, _
Picture1.Height - 4, _
nQuality, _
strPath, _
strMsg)
Else
MsgBox ("Could not create 'ImageHandler.RectToJpeg' object")
Timer1.Enabled = False
Exit Sub
End If
If iSockets = 1 Then
Dim varInput As Byte
Dim length As Long
Dim i As Long
length = FileLen("temp.jpg")

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

On Error GoTo FileError
socket(iSockets).SendData "START"
Open "temp.jpg" For Binary As #1
For i = 1 To length
Get #1, i, varInput
socket(iSockets).SendData varInput
Next i
Close #1
socket(iSockets).SendData "STOP"
Exit Sub
FileError:
Timer1.Enabled = False
Else
Timer1.Enabled = False
End If
End Sub

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Server Untuk Dua Tampilan
Dim iSockets As Integer
Dim sServerMsg As String
Dim sStatusBar As String
Dim sRequestID As String
Dim i As Integer
Private Declare Function Preview Lib "CamCapSelectable.dll" () As Long
Private Declare Sub CleanUp Lib "CamCapSelectable.dll" ()
Private Declare Function StartUp Lib "CamCapSelectable.dll" () As Long
Private Sub Command1_Click()
If (StartUp(CInt(Text1.Text)) = 0) Then
MsgBox "Error in Initializing. Make sure that video capture device is installed properly",
vbOKOnly Or vbCritical, "Error"
Unload Me
Else
Me.ScaleMode = 3
sStatusBar = "Local IP Address :" & socket(0).LocalIP
socket(0).LocalPort = CInt(Text2.Text)
sServerMsg = "Listening to port: " & socket(0).LocalPort
List1.AddItem (sServerMsg)
StatusBar1.SimpleText = sStatusBar
socket(0).Listen
Preview Me.Picture1.hwnd, 0
Command1.Enabled = False
Text1.Enabled = False
Text2.Enabled = False
End If
End Sub
Private Sub Form_Unload()
CleanUp
End Sub
Private Sub socket_Close(Index As Integer)
Timer1.Enabled = False
sServerMsg = "Connection closed: " & socket(Index).RemoteHostIP
List1.AddItem (sServerMsg)
socket(Index).Close
Unload socket(Index)
iSockets = iSockets - 1
sServerMsg = "Connection : " & iSockets
List1.AddItem (sServerMsg)
End Sub
Private Sub socket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
sServerMsg = "Connection request id " & requestID & " from " & socket(Index).RemoteHostIP
If Index = 0 Then
List1.AddItem (sServerMsg)
sRequestID = requestID

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

iSockets = iSockets + 1
sServerMsg = "Connection : " & iSockets
List1.AddItem (sServerMsg)
Load socket(iSockets)
socket(iSockets).LocalPort = CInt(Text2.Text)
socket(iSockets).Accept requestID
If iSockets > 1 Then
List1.AddItem ("Connection refused : " & socket(Index).RemoteHostIP & " Reason : Busy")
socket(iSockets).SendData "Busy"
socket(iSockets).Close
Unload socket(iSockets)
iSockets = iSockets - 1
sServerMsg = "Connection : " & iSockets
List1.AddItem (sServerMsg)
Else
Timer1.Enabled = True
End If
End If
End Sub
Private Sub Timer1_Timer()
Dim Ih As Object
Dim nQuality As Integer
Dim strPath As String
Dim strMsg As String
Dim lngResult As Long
strPath = "temp.jpg"
nQuality = 75
Set Ih = CreateObject("ImageHandler.RectToJpeg")
If IsObject(Ih) Then
lngResult = Ih.HdcToJpeg(Picture1.hDC, _
0, _
0, _
Picture1.Width - 4, _
Picture1.Height - 4, _
nQuality, _
strPath, _
strMsg)
Else
MsgBox ("Could not create 'ImageHandler.RectToJpeg' object")
Timer1.Enabled = False
Exit Sub
End If
If iSockets = 1 Then
Dim varInput As Byte
Dim length As Long
Dim i As Long

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

length = FileLen("temp.jpg")
On Error GoTo FileError
socket(iSockets).SendData "START"
Open "temp.jpg" For Binary As #1
For i = 1 To length
Get #1, i, varInput
socket(iSockets).SendData varInput
Next i
Close #1
socket(iSockets).SendData "STOP"
Exit Sub
FileError:
Timer1.Enabled = False
Else
Timer1.Enabled = False
End If
End Sub

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Client Untuk Satu Tampilan
Private state As Byte
Private Buffer As String
Private Const WRITING = 1
Private Const IDLE = 0
Private saving As Boolean
Private counter As Integer
Private Declare Function SetRect Lib "user32.dll" (ByRef lprc As AVI_RECT, ByVal xLeft As Long,
ByVal yTop As Long, ByVal xRight As Long, ByVal yBottom As Long) As Long

Private Sub WriteAVI(ByVal filename As String, ByVal FrameRate As Integer)
Dim s$
Dim InitDir As String
Dim szOutputAVIFile As String
Dim res As Long
Dim pfile As Long
Dim bmp As cDIB
Dim ps As Long
Dim psCompressed As Long
Dim strhdr As AVI_STREAM_INFO
Dim BI As BITMAPINFOHEADER
Dim opts As AVI_COMPRESS_OPTIONS
Dim pOpts As Long
Dim I As Long
szOutputAVIFile = filename$
res = AVIFileOpen(pfile, szOutputAVIFile, OF_WRITE Or OF_CREATE, 0&)
If (res AVIERR_OK) Then GoTo error
Set bmp = New cDIB
s$ = App.Path & "\temp\temp.bmp"
s2$ = App.Path & "\data2\dat0.jpg"
Set Picture2.Picture = LoadPicture(s2$)
Call SavePicture(Picture2.Picture, s$)
If bmp.CreateFromFile(s$) True Then
MsgBox "Could not load first bitmap file in list!", vbExclamation, App.Title
GoTo error
End If

With strhdr
.fccType = mmioStringToFOURCC("vids", 0&)
.fccHandler = 0&
.dwScale = 1
.dwRate = Val(FrameRate%)
.dwSuggestedBufferSize = bmp.SizeImage
Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height)

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

End With
If strhdr.dwRate < 1 Then strhdr.dwRate = 1
If strhdr.dwRate > 30 Then strhdr.dwRate = 30
res = AVIFileCreateStream(pfile, ps, strhdr)
If (res AVIERR_OK) Then GoTo error
pOpts = VarPtr(opts)
res = AVISaveOptions(lHwnd, ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE,
1, ps, pOpts)
If res 1 Then
Call AVISaveOptionsFree(1, pOpts)
GoTo error
End If
res = AVIMakeCompressedStream(psCompressed, ps, opts, 0&)
If res AVIERR_OK Then GoTo error
With BI
.biBitCount = bmp.BitCount
.biClrImportant = bmp.ClrImportant
.biClrUsed = bmp.ClrUsed
.biCompression = bmp.Compression
.biHeight = bmp.Height
.biWidth = bmp.Width
.biPlanes = bmp.Planes
.biSize = bmp.SizeInfoHeader
.biSizeImage = bmp.SizeImage
.biXPelsPerMeter = bmp.XPPM
.biYPelsPerMeter = bmp.YPPM
End With
res = AVIStreamSetFormat(psCompressed, 0, ByVal bmp.PointerToBitmapInfo,
bmp.SizeBitmapInfo)
If (res AVIERR_OK) Then GoTo error
For I = 1 To (counter - 1)
s$ = App.Path & "\temp\temp.bmp"
s2$ = App.Path & "\data2\dat" & CStr(I) & ".jpg"
Set Picture2.Picture = LoadPicture(s2$)
Call SavePicture(Picture2.Picture, s$)
bmp.CreateFromFile (s$)
res = AVIStreamWrite(psCompressed, I - 1, 1, bmp.PointerToBits, bmp.SizeImage,
AVIIF_KEYFRAME, ByVal 0&, ByVal 0&)
If res AVIERR_OK Then GoTo error
Next
error:
Set bmp = Nothing
Call AVIFileExit

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

MsgBox "There was an error writing the file.", vbInformation, App.Title
End Sub
Private Sub cmdClose_Click()
If Winsock1.state sckClosed Then
List1.AddItem "Connection Closed"
Winsock1.Close
End If
End Sub
Private Sub cmdConnect_Click()
Winsock1.Close
Winsock1.RemoteHost = txtIP.Text
Winsock1.RemotePort = 1007
Winsock1.Connect
End Sub
Private Sub Command1_Click()
If saving = True Then
saving = False
If counter > 0 Then
Call AVIFileInit
Dim s As String
s = App.Path & "\result\citMovie.avi"
Call WriteAVI(s, 15)
Call AVIFileExit
End If
counter = 0
Command2.Enabled = True
Command1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
If saving = False Then
saving = True
Command2.Enabled = False
Command1.Enabled = True
End If
End Sub
Private Sub Form_Load()
state = IDLE
Buffer = ""
saving = False
counter = 0
Command1.Enabled = False
End Sub

Private Sub Winsock1_Close()
List1.AddItem "Connection closed by server"

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
List1.AddItem "Connected"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock1.GetData sData, vbString
Buffer = Buffer & sData
If state = IDLE Then
If (InStr(Buffer, "START") > 0) Then
state = WRITING
End If
End If
If state = WRITING Then
If (InStr(Len(Buffer) - 4, Buffer, "STOP") > 0) Then
state = IDLE
Dim temp As String
Open "temp.jpg" For Binary As #1
temp = Mid(Buffer, 6, Len(Buffer) - 9)
If saving = True Then
Dim s As String
s = App.Path & "\data2\dat" & CStr(counter) & ".jpg"
frmMain.Caption = s
Open s For Binary As #2
Put #2, , temp
Close #2
counter = counter + 1
End If
Put #1, , temp
Close #1
Buffer = ""
End If
End If
Me.Picture1.Picture = LoadPicture("temp.jpg")
End Sub

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Client Untuk Dua Tampilan
Private state As Byte
Private Buffer As String
Private Const WRITING = 1
Private Const IDLE = 0
Private state2 As Byte
Private Buffer2 As String
Private saving As Boolean
Private saving2 As Boolean
Private counter As Integer
Private counter2 As Integer
Private Declare Function SetRect Lib "user32.dll" (ByRef lprc As AVI_RECT, ByVal xLeft As Long,
ByVal yTop As Long, ByVal xRight As Long, ByVal yBottom As Long) As Long

Private Sub WriteAVI(ByVal filename As String, ByVal FrameRate As Integer)
Dim s$
Dim InitDir As String
Dim szOutputAVIFile As String
Dim res As Long
Dim pfile As Long
Dim bmp As cDIB
Dim ps As Long
Dim psCompressed As Long
Dim strhdr As AVI_STREAM_INFO
Dim BI As BITMAPINFOHEADER
Dim opts As AVI_COMPRESS_OPTIONS
Dim pOpts As Long
Dim I As Long
szOutputAVIFile = filename$
res = AVIFileOpen(pfile, szOutputAVIFile, OF_WRITE Or OF_CREATE, 0&)
If (res AVIERR_OK) Then GoTo error
Set bmp = New cDIB
s$ = App.Path & "\temp\temp.bmp"
s2$ = App.Path & "\data\dat0.jpg"
Set Picture3.Picture = LoadPicture(s2$)
Call SavePicture(Picture3.Picture, s$)
If bmp.CreateFromFile(s$) True Then
MsgBox "Could not load first bitmap file in list!", vbExclamation, App.Title
GoTo error
End If
With strhdr
.fccType = mmioStringToFOURCC("vids", 0&)
.fccHandler = 0&
.dwScale = 1

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

.dwRate = Val(FrameRate%)
.dwSuggestedBufferSize = bmp.SizeImage
Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height)
End With
If strhdr.dwRate < 1 Then strhdr.dwRate = 1
If strhdr.dwRate > 30 Then strhdr.dwRate = 30
res = AVIFileCreateStream(pfile, ps, strhdr)
If (res AVIERR_OK) Then GoTo error
pOpts = VarPtr(opts)
res = AVISaveOptions(lHwnd, ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE,
1, ps, pOpts)
If res 1 Then
Call AVISaveOptionsFree(1, pOpts)
GoTo error
End If
res = AVIMakeCompressedStream(psCompressed, ps, opts, 0&)
If res AVIERR_OK Then GoTo error
With BI
.biBitCount = bmp.BitCount
.biClrImportant = bmp.ClrImportant
.biClrUsed = bmp.ClrUsed
.biCompression = bmp.Compression
.biHeight = bmp.Height
.biWidth = bmp.Width
.biPlanes = bmp.Planes
.biSize = bmp.SizeInfoHeader
.biSizeImage = bmp.SizeImage
.biXPelsPerMeter = bmp.XPPM
.biYPelsPerMeter = bmp.YPPM
End With
res = AVIStreamSetFormat(psCompressed, 0, ByVal bmp.PointerToBitmapInfo,
bmp.SizeBitmapInfo)
If (res AVIERR_OK) Then GoTo error
For I = 1 To (counter - 1)
s$ = App.Path & "\temp\temp.bmp"
s2$ = App.Path & "\data\dat" & CStr(I) & ".jpg"
Set Picture3.Picture = LoadPicture(s2$)
Call SavePicture(Picture3.Picture, s$)
bmp.CreateFromFile (s$)
res = AVIStreamWrite(psCompressed, I - 1, 1, bmp.PointerToBits, bmp.SizeImage,
AVIIF_KEYFRAME, ByVal 0&, ByVal 0&)
If res AVIERR_OK Then GoTo error
Next

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

error:
Set bmp = Nothing
Call AVIFileExit
MsgBox "There was an error writing the file.", vbInformation, App.Title
End Sub
Private Sub WriteAVI2(ByVal filename As String, ByVal FrameRate As Integer)
Dim s$
Dim InitDir As String
Dim szOutputAVIFile As String
Dim res As Long
Dim pfile As Long
Dim bmp As cDIB
Dim ps As Long
Dim psCompressed As Long
Dim strhdr As AVI_STREAM_INFO
Dim BI As BITMAPINFOHEADER
Dim opts As AVI_COMPRESS_OPTIONS
Dim pOpts As Long
Dim I As Long
szOutputAVIFile = filename$
res = AVIFileOpen(pfile, szOutputAVIFile, OF_WRITE Or OF_CREATE, 0&)
If (res AVIERR_OK) Then GoTo error
Set bmp = New cDIB
s$ = App.Path & "\temp\temp2.bmp"
s2$ = App.Path & "\data2\dat0.jpg"
Set Picture4.Picture = LoadPicture(s2$)
Call SavePicture(Picture4.Picture, s$)
If bmp.CreateFromFile(s$) True Then
MsgBox "Could not load first bitmap file in list!", vbExclamation, App.Title
GoTo error
End If
With strhdr
.fccType = mmioStringToFOURCC("vids", 0&)
.fccHandler = 0&
.dwScale = 1
.dwRate = Val(FrameRate%)
.dwSuggestedBufferSize = bmp.SizeImage
Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height)
End With
If strhdr.dwRate < 1 Then strhdr.dwRate = 1
If strhdr.dwRate > 30 Then strhdr.dwRate = 30
res = AVIFileCreateStream(pfile, ps, strhdr)
If (res AVIERR_OK) Then GoTo error
pOpts = VarPtr(opts)

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

res = AVISaveOptions(lHwnd, ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE,
1, ps, pOpts)
If res 1 Then
Call AVISaveOptionsFree(1, pOpts)
GoTo error
End If
res = AVIMakeCompressedStream(psCompressed, ps, opts, 0&)
If res AVIERR_OK Then GoTo error
With BI
.biBitCount = bmp.BitCount
.biClrImportant = bmp.ClrImportant
.biClrUsed = bmp.ClrUsed
.biCompression = bmp.Compression
.biHeight = bmp.Height
.biWidth = bmp.Width
.biPlanes = bmp.Planes
.biSize = bmp.SizeInfoHeader
.biSizeImage = bmp.SizeImage
.biXPelsPerMeter = bmp.XPPM
.biYPelsPerMeter = bmp.YPPM
End With
res = AVIStreamSetFormat(psCompressed, 0, ByVal bmp.PointerToBitmapInfo,
bmp.SizeBitmapInfo)
If (res AVIERR_OK) Then GoTo error
For I = 1 To (counter2 - 1)
s$ = App.Path & "\temp\temp2.bmp"
s2$ = App.Path & "\data2\dat" & CStr(I) & ".jpg"
Set Picture4.Picture = LoadPicture(s2$)
Call SavePicture(Picture4.Picture, s$)
bmp.CreateFromFile (s$)
res = AVIStreamWrite(psCompressed, I - 1, 1, bmp.PointerToBits, bmp.SizeImage,
AVIIF_KEYFRAME, ByVal 0&, ByVal 0&)
If res AVIERR_OK Then GoTo error
Next
error:
Set bmp = Nothing
Call AVIFileExit
MsgBox "There was an error writing the file.", vbInformation, App.Title
End Sub
Private Sub cmdClose_Click()
If Winsock1.state sckClosed Then
List1.AddItem "Connection Closed"
Winsock1.Close
End If
End Sub

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Private Sub cmdConnect_Click()
Winsock1.Close
Winsock1.RemoteHost = txtIP.Text
Winsock1.RemotePort = Text2.Text
Winsock1.Connect
End Sub
Private Sub Command1_Click()
Winsock2.Close
Winsock2.RemoteHost = txtIP.Text
Winsock2.RemotePort = Text3.Text
Winsock2.Connect
End Sub
Private Sub Command2_Click()
If Winsock2.state sckClosed Then
List2.AddItem "Connection Closed"
Winsock2.Close
End If
End Sub
Private Sub Command3_Click()
If saving = False Then
saving = True
Command3.Enabled = False
Command5.Enabled = True
End If
End Sub
Private Sub Command4_Click()
If saving2 = False Then
saving2 = True
Command4.Enabled = False
Command6.Enabled = True
End If
End Sub
Private Sub Command5_Click()
If saving = True Then
saving = False
If counter > 0 Then
Call AVIFileInit
Dim s As String
s = App.Path & "\result\citMovie.avi"
Call WriteAVI(s, 20)
Call AVIFileExit
End If
counter = 0
Command3.Enabled = True
Command5.Enabled = False
End If

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

End Sub
Private Sub Command6_Click()
If saving2 = True Then
saving2 = False
If counter2 > 0 Then
Call AVIFileInit
Dim s As String
s = App.Path & "\result\citMovie2.avi"
Call WriteAVI2(s, 20)
Call AVIFileExit
End If
counter2 = 0
Command4.Enabled = True
Command6.Enabled = False
End If
End Sub
Private Sub Form_Load()
state = IDLE
Buffer = ""
state2 = IDLE
Buffer2 = ""
saving = False
counter = 0
saving2 = False
counter2 = 0
End Sub
Private Sub Winsock1_Close()
List1.AddItem "Connection closed by server"
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
List1.AddItem "Connected"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock1.GetData sData, vbString
Buffer = Buffer & sData
If state = IDLE Then
If (InStr(Buffer, "START") > 0) Then
state = WRITING
End If
End If
If state = WRITING Then
If (InStr(Len(Buffer) - 4, Buffer, "STOP") > 0) Then
state = IDLE
Dim temp As String
Open "temp.jpg" For Binary As #1

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

temp = Mid(Buffer, 6, Len(Buffer) - 9)
If saving = True Then
Dim s As String
s = App.Path & "\data\dat" & CStr(counter) & ".jpg"
'frmMain.Caption = s
Open s For Binary As #3
Put #3, , temp
Close #3
counter = counter + 1
End If
Put #1, , temp
Close #1
Buffer = ""
End If
End If
Me.Picture1.Picture = LoadPicture("temp.jpg")
End Sub
Private Sub Winsock2_Close()
List2.AddItem "Connection closed by server"
Winsock2.Close
End Sub
Private Sub Winsock2_Connect()
List2.AddItem "Connected"
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock2.GetData sData, vbString
Buffer2 = Buffer2 & sData
If state2 = IDLE Then
If (InStr(Buffer2, "START") > 0) Then
state2 = WRITING
End If
End If
If state2 = WRITING Then
If (InStr(Len(Buffer2) - 4, Buffer2, "STOP") > 0) Then
state2 = IDLE
Dim temp As String
Open "temp2.jpg" For Binary As #2
temp = Mid(Buffer2, 6, Len(Buffer2) - 9)
If saving2 = True Then
Dim s As String
s = App.Path & "\data2\dat" & CStr(counter2) & ".jpg"
'frmMain.Caption = s
Open s For Binary As #4
Put #4, , temp
Close #4
counter2 = counter2 + 1
End If
Put #2, , temp

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Close #2
Buffer2 = ""
End If
End If
Me.Picture2.Picture = LoadPicture("temp2.jpg")
End Sub

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Spesifikasi Perangkat Radio Point To Point
No
1
2
3
4
5
6
7
8
9

Parameter
Interface
Mode operasi
BER (Bit Error Rate)
Power output
Frekuensi RF
Modulasi
Data rate
Jenis kode PN
Kode PN

Spesifikasi
RJ 45 Ethernet 10 Base T
continuous
< 10 − 5
0 dBm ( min )
350 MHz
QPSK
512 kbps
Kode Baker
11 bit

Spesifikasi Web Camera
No
1
2
3
4
5

Parameter
Tipe
Fame rate
Resolusi
Color depth
Interface

Spesifikasi
X-View
15 frame / second
320 x 240
24 bit
USB

Foto Pada Bagian Server

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Foto Pada Bagian Client

Universitas Kristen Maranatha

Lampiran : Perangkat Lunak Dan Spesifikasi Alat

Universitas Kristen Maranatha