1

Normally, I can get a still snapshot from an IP camera with a vendor provided url. However, the jpegs served this way are not of good enough quality and the vendor says there is no facility provided for serving snapshots in other image formats or smaller/lossless compression.

I noticed when I open an rtsp h264 stream from the camera with VLC then manually take a screenshot, the resulting image has none of the jpeg artifacts observed previously.

The question is, how would I obtain these superior snapshots from an h264 stream with a c++ program? I need to perform multiple operations on the image (annotations, cropping, face recognition) but those have to come after getting as high quality as possible initial image.

(note that this is related to my previous question. I obtained jpeg images with CURL but would now like to replace the snapshot getter with this new one if possible. I am again running on linux, Fedora 11)

Community
  • 1
  • 1
Morpork
  • 551
  • 1
  • 6
  • 21

1 Answers1

1

You need an RTSP client implementation to connect to the camera, start receiving video feed, defragment/depacketize the video frame and then you will get it and save/process/present as needed.

You might want to look towards live555 library as a well known RTSP library/implemetnation.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Correct me if my understanding is wrong: Use a RTSP client to send a SETUP request, then a PLAY request; Store the video in some buffer on memory; Decode whatever is in the buffer to some lossless image format; Get a frame from the decoded images; DoStuff(); Repeat when the buffer is refilled. – Morpork Oct 24 '11 at 08:06
  • This is basically correct, but there are so many details omitted. With JPEG over HTTP, where you send request and get the whole thing back. In RTSP the conent may be delivered through TCP or UDP, more than one format descriptor to find H.264 at, depacketization to obtain original H.264 bitstream. Not a rocket science, but still not as simple as in case of JPEG snapshot. – Roman R. Oct 24 '11 at 08:24