CONTENTS

Home
Updates
Software
Electronics
Music
Resume
Contact


YouTube
BlueSky
GitHub
LinkedIn
Twitter

HTTPS VERSION


RTSP Library

libkohn_rtsp - RTSP Client Library

Here is a small library for connecting to RTSP servers and downloading video and such. I included a sample program which using libkohn_avi can record mpeg4 streams from Axis cameras into avi files.

Eventually I want to add an RTSP server to my Naken Web web server.

Related Projects @mikekohn.net

Graphics: SSE Image Processing, GIF, TIFF, BMP/RLE, JPEG, AVI, kunzip, gif2avi, Ringtone Tools, yuv2rgb, RTSP

Status

I have two test programs in this package. The first one records video from an rtsp source (in my case an Axis 211M camera) into an AVI container. This works well for my Axis 211M which does MPEG4 video. However, H264 video seems to have some extra stuff in each RTP packet and it seems it cannot go directly into an AVI container. I haven't figured this part out yet so it doesn't work.

The second program takes RTP and RTCP packets from a source and simply relays them to another server.

Usage

Basically there are only 2 or 3 functions needed:
int kohn_rtsp_open(struct _kohn_rtsp **kohn_rtsp, char *url, kohn_rtsp_callback_t data_callback, kohn_rtsp_callback_t rtcp_callback, int mode, void *context);
int kohn_rtsp_stop(struct _kohn_rtsp *kohn_rtsp);
int kohn_rtsp_close(struct _kohn_rtsp *kohn_rtsp);

Every time an RTP packet comes in it can be either ordered inside the library or sent immediately to a callback defined as:
void callback(unsigned char *data, int data_len, int id);

The following functions can be useful:
int kohn_rtsp_is_running(struct _kohn_rtsp *kohn_rtsp);
float kohn_rtsp_get_framerate(struct _kohn_rtsp *kohn_rtsp);
const char *kohn_rtsp_get_codec(struct _kohn_rtsp *kohn_rtsp);
int kohn_rtsp_get_width(struct _kohn_rtsp *kohn_rtsp);
int kohn_rtsp_get_height(struct _kohn_rtsp *kohn_rtsp);
int kohn_rtsp_get_packet_count(struct _kohn_rtsp *kohn_rtsp);

The test_rtsp program can be used with:

./test_rtsp rtsp://user:pass@host/mpeg4/media.amp
./redirect_rtsp rtsp://user:pass@host/mpeg4/media.amp 192.168.1.15 20000

Download

libkohn_rtsp-2014-01-08.tar.gz (Source Code)
libkohn_rtsp-2011-03-07-crisv32-axis.tar.gz (Axis EXTRAX binaries)

Copyright 1997-2024 - Michael Kohn