i’m programming an application (in C++/Qt Designer 4.6 and using some librairies like ffmpeg and v4l2) which capture from webcam and i want to send the captured QImage via IP, so i send it into a QTcpSocket and i succed in receiving it in my server application but the problem it’s too slow, crearly because the QImage isn’t compressed so i’m not getting the wanted result which is live video streaming via IP, my question is how can i compress the QImage? I think in converting it to the YUV format but i can’t realize it, this is some lines from my code to send the available QImage:
QImage image;
QByteArray ba;
QBuffer buffer(&ba);
image.save(&buffer, "PNG");
imsocket->write(ba);
You would be better off sending an MPEG compressed video stream instead of compressing each frame as QImage and sending it over network.
MPEG compressed video streams use a technique which uses a full scale image for first frame and then only records changed pixels for each proceeding frame thus providing maximum compression as well as smooth video playback over the network.
On the client end, you will playback by getting frames generated by the library from the compressed MPEG stream.