0

I know that mjpeg stream is jpeg picture 1 by 1.

I sniffing stream and want to recognize if that stream contain mjpeg stream.

How can I recognize mjpeg stream?

And how can I split 1 jpeg to watch the picture?

yfr24493AzzrggAcom
  • 159
  • 1
  • 2
  • 13
  • Possibly relevant is [How does MPlayer recognize an MJPEG stream?](https://stackoverflow.com/questions/43369429/how-does-mplayer-recognize-an-mjpeg-stream) This states there is no standard definition for MJPEG header. But if you are trying to extract a JPEG image shouldn't *that* have a standard header that you can recognise? – Weather Vane Feb 12 '20 at 19:59
  • @Weather Vane I saw that post. I want an algorithm to take 1 jpeg from mjpeg stream not a tool that do it – yfr24493AzzrggAcom Feb 12 '20 at 20:02
  • 1
    I wasn't recommending the tool given in an answer, but observing a [comment](https://stackoverflow.com/questions/43369429/how-does-mplayer-recognize-an-mjpeg-stream#comment73804353_43369429) stating there is no standard header definition, and so there is no reliable way to detect it. My algorithm would be to examine the stream for a JPEG header, since that is what you want to extract. – Weather Vane Feb 12 '20 at 20:06
  • @Weather Vane What do you mean `to examine the stream for a JPEG header`. Each jlpeg must to start with 0xffd8ffe0 so check if each packet include that header? – yfr24493AzzrggAcom Feb 12 '20 at 20:14
  • This would be like JPEG recovery - often given as a student exercise. This link: [JPEG File Interchange Format](https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format) shows that the data begins with the marker code hex values `FF D8` and ends with `FF D9`. The JPEG format is well documented, and your task seems to be to rip it from a stream. Of course those might be random data bytes too so you would have to be careful to verify that the supposed header part makes sense. The start of the header quite likely won't align with the packet, since a packet doesn't care about its content. – Weather Vane Feb 12 '20 at 20:19

0 Answers0