PDA

View Full Version : Video Stream Over UDP



bajoelkid12
31st May 2011, 17:48
i'm workin on client - server video capturing and displaying application.. .my client capture the video via webcam then send it to the server over WLAN via UDP, then the server display the captured video stream continously (real - time).. i have made a simple client - server application using QUdpsocket. but the problem now is to put the video stream into the socket.. any suggestion ?

here is the udp client - server code that i developed :



#include "jcxudp.h"

jcxUDP::jcxUDP(QObject *parent) :
QObject(parent)
{
socket = new QUdpSocket(this);
socket->bind(QHostAddress::LocalHost,5678);
connect(socket,SIGNAL(readyRead()),this,SLOT(SiapB aca()));
}

void jcxUDP::NulisHallo()
{
QByteArray Data;
Data.append("halo dari jincheng");
socket->writeDatagram(Data,QHostAddress::LocalHost,5678);
}

void jcxUDP::SiapBaca()
{
QByteArray Buffer;
Buffer.resize(socket->pendingDatagramSize());

QHostAddress sender;
quint16 senderPort;
socket->readDatagram(Buffer.data(),Buffer.size(),&sender,&senderPort);

qDebug() << "Pesan Dari :" << sender.toString();
qDebug() << "Port Pesan :" << senderPort;
qDebug() << "Pesan :" << Buffer;
}

squidge
31st May 2011, 21:27
Break it down. How are you encoding the video stream for transfer? Are you using MPEG compression? MJPEG? Raw images? Take each frame and send it to the server and then re-assemble at the server side. Note that the server will need to know the expected sizes when receiving.

bajoelkid12
1st June 2011, 01:31
this is my problem too.. how can we implement the MPEG compression in Qt ? what class should i use ?

squidge
1st June 2011, 07:33
There isn't one as far as I know, you'll need to find an appropriate C++ class to do it for you.

SIFE
1st June 2011, 08:02
There a outdated tutorial about using ffmpeg (http://dranger.com/ffmpeg/) but it is still useful