several bugs found in zm_rtsp + help request with AV201 RTSP
Posted: Wed Mar 18, 2009 11:59 am
Hi all,
i am working at the following setup:
Camera type: AVTECH AV201
OS: Ubuntu 8.04.2
Zoneminder: 1.24.1 revision 2806 from svn
FFMpeg: SVN-r18021 from svn
I was trying to use RTSP with the AV201 camera without success.
After several analyses with tcpdump and wireshark, now i am able to use that camera with the following settings:
Please notice that i found the following bugs in zm_rtsp.cpp:
1- mUrl is used instead of tempUrl, so path is not correctly used.
2- session is badly interpreted. only digits are accepted, while session is an HEX value.
Now, perhaps that next changes are camera dependent. i mean, i had to apply also these changes to make my avtech AV201 camera work. i'm not an RTSP/RTP expert, so perhaps that these changes will break other cameras compatibility ... ?
3- my camera subpath has to be "track0" and not "track1". so i changed i+1 to i in sprintf...
4- i had to add the "Range" value to PLAY method. without Range value, camera will not send the Rtp-info back, so RTP session can't be initiated... dunno if it is camera dependent ...
How can i attach a diff patch?
Now, Zoneminder can see the camera, but the images is broken: it is splitted by two (the images is duplicated intwo horizontal splits), with the bottom part broken with a black banner.
I know that this appened on several cameras. Suggestions ?
i am working at the following setup:
Camera type: AVTECH AV201
OS: Ubuntu 8.04.2
Zoneminder: 1.24.1 revision 2806 from svn
FFMpeg: SVN-r18021 from svn
I was trying to use RTSP with the AV201 camera without success.
After several analyses with tcpdump and wireshark, now i am able to use that camera with the following settings:
Code: Select all
Source type: Remote
Remote Protocol: RTSP
Remote Method: RTP/Unicast
Remote Host Name: admin:admin@192.168.X.Y
Remote Host Port: 554
Remote Host Path: /live/m.peg4
Remote Host SubPath: /track
Remote Image Colours: 24 bit colour
Capture Width (pixels): 320
Capture Height (pixels): 240
1- mUrl is used instead of tempUrl, so path is not correctly used.
Code: Select all
@@ -296,9 +296,9 @@ int RtspThread::run()
if ( !mPath.empty() )
{
if ( mPath[0] == '/' )
- mUrl += mPath;
+ tempUrl += mPath;
else
- mUrl += '/'+mPath;
+ tempUrl += '/'+mPath;
}
}
if ( av_open_input_file( &mFormatContext, tempUrl.c_str(), NULL, 0, NULL ) != 0 )
Code: Select all
@@ -363,7 +363,7 @@ int RtspThread::run()
for ( size_t i = 0; i < lines.size(); i++ )
{
- sscanf( lines[i].c_str(), "Session: %a[0-9]; timeout=%d", &session, &timeout );
+ sscanf( lines[i].c_str(), "Session: %a[0-9;A-F]; timeout=%d", &session, &timeout );
sscanf( lines[i].c_str(), "Transport: %s", transport );
}
Now, perhaps that next changes are camera dependent. i mean, i had to apply also these changes to make my avtech AV201 camera work. i'm not an RTSP/RTP expert, so perhaps that these changes will break other cameras compatibility ... ?
3- my camera subpath has to be "track0" and not "track1". so i changed i+1 to i in sprintf...
Code: Select all
@@ -315,7 +315,7 @@ int RtspThread::run()
{
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
{
- trackUrl += mSubpath+stringtf( "%d", i+1 );
+ trackUrl += mSubpath+stringtf( "%d", i );
// Hackery pokery
rtpClock = mFormatContext->streams[i]->codec->sample_rate;
break;
Code: Select all
@@ -431,7 +431,7 @@ int RtspThread::run()
Debug( 2, "RTSP Remote Ports are %d/%d", remotePorts[0], remotePorts[1] );
Debug( 2, "RTSP Remote Channels are %d/%d", remoteChannels[0], remoteChannels[1] );
- message = "PLAY "+trackUrl+" RTSP/1.0\r\nSession: "+session+"\r\n";
+ message = "PLAY "+trackUrl+" RTSP/1.0\r\nSession: "+session+"\r\nRange: npt=0.000-\r\n";
if ( !sendCommand( message ) )
return( -1 );
if ( !recvResponse( response ) )
Now, Zoneminder can see the camera, but the images is broken: it is splitted by two (the images is duplicated intwo horizontal splits), with the bottom part broken with a black banner.
I know that this appened on several cameras. Suggestions ?