Note that there are some explanatory texts on larger screens.

plurals
  1. POMJPEG Stream from iPhone to Server
    primarykey
    data
    text
    <p>I am writing an app to make an MJPEG-Stream from the iPhone to the Server. My problem is that the JPEG's I see are a weird collection of colored lines. I can post the specific code if more information is needed.</p> <p>These are the Steps:</p> <ol> <li>Get the frames via <code>AVCaptureVideoDataOutput</code></li> <li>Convert them to an <code>UIImage</code></li> <li>Get <code>NSData</code> <code>UIImageJPEGRepresentation()</code> from it</li> <li>Make an <code>NSMutableData</code> and wrap the Image with "Content-Type: image/jpeg" and --BOUNDARY</li> </ol> <p>Now i want to send them as UDP Packets to my server. I use asyncudpsocket on the iPhone and a small java datagrammserver on the PC.The first problem is the mtu. Asyncudpsocket says message too long if the <code>nsdata</code> is larger than 9kb. Therefore:</p> <ol> <li>Split the image into 9kb chunks</li> <li>Send them with asyncudp socket</li> <li>Accept an TCP Socket on port 2020 on the PC</li> <li>Receive the DatagrammPackets and stream them to the connected TCP Socket</li> <li>Open Firefox with localhost:2020 and watch the MJPEG</li> </ol> <p>I've tested each part seperated and can tell that they're okay. I can show the images in a <code>UIImageView</code>, I can send, receive and show the bytes from the socket and I can stream JPEG's over a serversocket and watch them in Firefox.</p> <p>The image fits in one datagrammpacket if they're small enough (that's sometimes the case), and I can see the header, bytes and the boundary.. but why is my MJPEG stream still showing me a weird colored image (instead of a black or white image, which should be the case)?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload