cURL / Mailing Lists / curl-library / Single Mail


Re: How to get a frame of image data from rtsp stream

From: <>
Date: Fri, 07 Feb 2014 16:35:40 +0000

On Fri, Feb 7, 2014, at 8:07, zy wu wrote:
> I used CURLOPT_INTERLEAVEDATA parameter to set the receive buffer, and
> used CURLOPT_INTERLEAVEFUNCTION parameter to set the callback function

The CURLOPT_INTERLEAVEFUNCTION is used for receiving RTP over RTSP. The
interleave function is called in response to performing a
CURL_RTSPREQ_RECEIVE. The perform request will usually return after RTP
over RTSP data is received. The interleave function will be given a
single RTP packet per CURL_RTSPREQ_RECEIVE perfom. So the first thing
you need to do is change a line in rtsp.c:

  const char *transport = "RTP/AVP;unicast;client_port=1234-1235";  /* UDP */
  const char *transport = "RTP/AVP/TCP;unicast;interleaved=0-1";  /* TCP */

Next add something like this after rtsp_play()

  my_curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, my_function);
  my_curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, my_data);
  my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST,
  if (res != CURLE_OK) break;

List admin:
Received on 2014-02-07