|
From: Roman G. <hac...@gm...> - 2013-02-22 21:58:52
|
This quick and dirty patch makes ACTi cameras work, but breaks all
other cameras :( - looking for a better solution:
diff --git a/netcam.c b/netcam.c
index 85e398a..7ed88d7 100644
--- a/netcam.c
+++ b/netcam.c
@@ -1312,10 +1312,22 @@ static int
netcam_read_html_jpeg(netcam_context_ptr netcam)
*/
if (gettimeofday(&curtime, NULL) < 0)
MOTION_LOG(WRN, TYPE_NETCAM, SHOW_ERRNO, "%s: gettimeofday");
netcam->receiving->image_time = curtime;
/*
+ ** Quick-n-dirty mode: Skip unsignificant(?) bytes
+ ** for ACTi
+ */
+ if (netcam->receiving->used > 44)
+ {
+ memmove(netcam->receiving->ptr, netcam->receiving->ptr + 44,
+ netcam->receiving->used - 44);
+ netcam->receiving->used -= 44;
+ }
+
+
+ /*
* Calculate our "running average" time for this netcam's
* frame transmissions (except for the first time).
* Note that the average frame time is held in microseconds.
On 22 February 2013 21:43, Roman Gaufman <hac...@gm...> wrote:
> It appears if I manually vim the MJPEG dump and strip out the first 45
> characters of the JPEG data:
> ^@^@^A²^D^@^@^@U¶^@^@YevO^L^A^@^CªÀ^B^@@^N^@^OYevO>
> ^L^@^@^@^@^@^@^@^@^@
>
> Then the image is recognisable by Finder (on a mac).
>
> I'm assuming if I do something similar it will work in motion too?
>
> Is there any solution to this that doesn't break compatibility with
> other cameras?
>
>
> On 22 February 2013 21:21, Roman Gaufman <hac...@gm...> wrote:
>> I've enabled the highest loglevel and this is what I see when motion
>> tries to read an image:
>>
>> [1] [INF] [NET] [Feb 22 21:17:34] netcam_http_request: about to try to
>> connect, time #0
>> [1] [INF] [NET] [Feb 22 21:17:34] netcam_connect: with keepalive set,
>> invalid socket.This could be first time, created a new one with fd 6
>> [1] [INF] [NET] [Feb 22 21:17:34] netcam_connect: SO_KEEPALIVE is OFF
>> [1] [INF] [NET] [Feb 22 21:17:34] netcam_connect: SO_KEEPALIVE set on socket.
>> [1] [INF] [NET] [Feb 22 21:17:34] netcam_connect: re-using socket 6
>> since keepalive is set.
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('HTTP/1.0 200 OK')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('Cache-Control: no-cache')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_length: Content-Length -1
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('Connection: Keep-Alive')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_length: Content-Length -1
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('Pragma: no-cache')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_length: Content-Length -1
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('Content-Type:
>> multipart/x-mixed-replace;boundary=GetStreamBoundary')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_type:
>> Content-type multipart/x-mixed-replace
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Streaming camera
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Boundary
>> string [GetStreamBoundary]
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_first_header: Received
>> first header ('')
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_type:
>> Content-type image/jpeg
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_length: Content-Length -1
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_check_content_length:
>> Content-Length 46611
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_read_next_header: Found image
>> header record
>> [1] [NTC] [NET] [Feb 22 21:17:35] netcam_setup_html: connected, going
>> on to read image.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [0/0] to [0/4096] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [2940/4096] to [2940/8192] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [7284/8192] to [7284/12288] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [11628/12288] to [11628/16384] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [15972/16384] to [15972/20480] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [20316/20480] to [20316/24576] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [23212/24576] to [23212/28672] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [27556/28672] to [27556/32768] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [31900/32768] to [31900/36864] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [36244/36864] to [36244/40960] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [40588/40960] to [40588/45056] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_check_buffsize: expanding
>> buffer from [44932/45056] to [44932/49152] bytes.
>> [1] [DBG] [NET] [Feb 22 21:17:35] netcam_output_message: Not a JPEG
>> file: starts with 0x00 0x00
>> [1] [INF] [NET] [Feb 22 21:17:35] netcam_error_exit: netcam->jpeg_error 1
>> [1] [CRT] [NET] [Feb 22 21:17:35] netcam_start: libjpeg decompression
>> failure on first frame - giving up!
>>
>> Any ideas?
>>
>> On 22 February 2013 20:25, Roman Gaufman <hac...@gm...> wrote:
>>> Hi,
>>>
>>> I'm trying to record an ACTi E32 camera with motion, I'm using the URL
>>> http://192.168.1.118/cgi-bin/cmd/system?GET_STREAM with
>>> netcam_userpass admin:123456
>>>
>>> I'm getting:
>>>
>>> 2230 [1] [ALR] [NET] [Feb 22 20:16:40] netcam_start: Network Camera
>>> thread starting... for url
>>> (http://192.168.1.118/cgi-bin/cmd/system?GET_STREAM)
>>> 2231 [1] [CRT] [NET] [Feb 22 20:16:40] netcam_start: libjpeg
>>> decompression failure on first frame - giving up!
>>>
>>> I'm able to get the stream with curl and here is a sample of the stream:
>>>
>>> http://itstar.co.uk/acti_e32_stream.mjpg
>>>
>>> I'm able to play the stream with vlc and mplayer and looking at the
>>> stream, this is the head:
>>>
>>> ^M
>>> --GetStreamBoundary^M
>>> Content-Type: image/jpeg^M
>>> Content-Length: 46689^M
>>>
>>> Looks pretty valid to me?
>>>
>>> Any ideas why motion won't recognise it?
>>>
>>> Roman
|