title: Grab one image frame from MJPEG stream
body: <p>I have VideoSec IP camera, and daemon running on embedded linux NPE controler. Daemon needs to gram images from IP camera, that part is implemented with libcurl in standard way, and with axis camera is working just fine:</p>
  
  <pre><code>static size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
       size_t written = fwrite(ptr, size, nmemb, stream);
       return written;
  }
  
  void refreshCameraImage(char *target, char *url)
  {
       CURL *image;
       CURLcode imgresult;
       FILE *fp;
  
       image = curl_easy_init();
  
       if (image)
       {
            fp = fopen(target, "wb");
            if(fp == NULL)
            printf("\nFile cannot be opened");
  
  
            curl_easy_setopt(image, CURLOPT_URL, url);
            curl_easy_setopt(image, CURLOPT_WRITEFUNCTION, NULL);
            curl_easy_setopt(image, CURLOPT_WRITEDATA, fp);
  
            imgresult = curl_easy_perform(image);
            if( imgresult )
            {
                 printf("\nCannot grab the image!");
            }
       }
       curl_easy_cleanup(image);
       fclose(fp);
  }
  </code></pre>
  
  <p>Problem with VideoSec camera is that i cannot define any jpeg stream, only MJPEG.
  So, i need a way to grab only one frame from mjpeg stream with libcurl.
  OpenCV is not an option.</p>