Page 1 of 1

ZM is not able to decode JPEG file

Posted: Thu May 22, 2008 12:09 am
by onidlo
Dear all,

I found very strange problem with ZoneMinder. It is not able to decode JPEG image, even the image is valid.

The following lines can be found in my zmdc.log:

Code: Select all

05/22/08 01:59:02.027187 zmdc[10618].INF [Starting pending process, zmc -m 1]
05/22/08 01:59:02.039857 zmdc[10618].INF ['zmc -m 1' starting at 08/05/22 01:59:02, pid = 10735]
05/22/08 01:59:02.173704 zmdc[10618].ERR ['zmc -m 1' exited abnormally, exit status 255]
If I set debug level = 3, zm_debug.log.PID contains:

Code: Select all

05/22/08 01:57:42.208080 zmc_m1[10730].WAR-zm_jpeg.c/62 [Corrupt JPEG data: premature end of data segment]
05/22/08 01:57:42.208522 zmc_m1[10730].ERR-zm_jpeg.c/38 [Invalid JPEG file structure: two SOI markers]
05/22/08 01:57:42.208652 zmc_m1[10730].ERR-zm_remote_camera.cpp/1355 [Unable to decode jpeg]
05/22/08 01:57:42.208765 zmc_m1[10730].ERR-zmc.cpp/252 [Failed to post-capture monitor 0] 
The image can be viewed without any problems in IE, FF, ... I tried also different sizes (640x480, 320x240) - but it does not have effect on the problem. I put this code to RemoteCamera::GetResponse():

Code: Select all

ofstream outdata;
outdata.open("/var/www/zm/events/1/test1.jpg");
int ind;
for (ind=0;ind<buffer.Size();ind++) {
       outdata.put(buffer[ind]);
}
outdata.close();
I can open the image in ACDSee, FF, MS Office Picture Manager, Corel Paint Shop Pro, etc - so it is probably valid JPEG file.

Do you have any idea, what could be wrong?
Thanks!

P.S.: I uploaded two JPEG's captured from webcam here:
www.dazzler.sk/test1.jpg
www.dazzler.sk/test2.jpg

Re: ZM is not able to decode JPEG file

Posted: Thu May 22, 2008 4:32 pm
by onidlo
onidlo wrote:...problem with ZoneMinder. It is not able to decode JPEG image, even the image is valid.
...
P.S.: I uploaded two JPEG's captured from webcam here:
www.dazzler.sk/test1.jpg
www.dazzler.sk/test2.jpg
Hi,

I just found out, what causes the problem. It is similar to my previous problem with a different IP camera http://www.zoneminder.com/forums/viewtopic.php?t=11649 and http://www.zoneminder.com/forums/viewtopic.php?t=11574. So, again: the problem was caused by improper implementation of standards. In this case, the camera does not send valid JPEG file. Even I thought, it is valid. It could be opened in several programs (Firefox, ACDSee), but other programs are not able to open it (for example GIMP).

You can take a look at those two images I posted here in my previous post. If you look carefully at bottom right corner, you can see an "effect" with squares - this is caused by missing data in the image... But I managed to get it working by replacing the following line in zm_image.cpp:

Code: Select all

jpeg_finish_decompress( cinfo );
by:

Code: Select all

jpeg_abort_decompress( cinfo );
Now it seems to be working (but with small errors in the bottom right corner), but did not have a lot of time to test it.

So, for you info:
1) Don't buy Micronet SP5511W
2) Don't buy Trendnet TV-IP110
3) Don't buy Asus Mimic CX200

Software in these cams is probably written by idiots and I'm really shocked that someone can "produce" that kind of crapy software.

Posted: Tue Sep 09, 2008 5:16 am
by razametal
I've a dark square with one dlink DCS-2100 camera. I'm using the version 1.22.3 on ubuntu 8.04 server.

Code: Select all

Sep  9 00:14:30 intranet zmdc[29109]: INF [Starting pending process, zmc -m 1] 
Sep  9 00:14:30 intranet zmdc[29767]: INF ['zmc -m 1' started at 08/09/09 00:14:30] 
Sep  9 00:14:30 intranet zmdc[29109]: INF ['zmc -m 1' starting at 08/09/09 00:14:30, pid = 29767] 
Sep  9 00:14:30 intranet zmc_m1[29767]: INF [Debug Level = 0, Debug Log = <none>]
Sep  9 00:14:30 intranet zmc_m1[29767]: INF [Starting Capture]
Sep  9 00:14:30 intranet zmc_m1[29767]: ERR [Not a JPEG file: starts with 0x35 0x39]
Sep  9 00:14:30 intranet zmdc[29109]: ERR ['zmc -m 1' exited abnormally, exit status 255] 
What means Not a JPEG file? I can open the JPEG file with gimp, firefox, gthum, etc. :(

Posted: Fri Jan 29, 2010 7:44 pm
by thenextdon13
having the same problem with a dlink dcs-5300, details posted here:
http://www.zoneminder.com/forums/viewto ... highlight=

camera trouble

Posted: Sat Dec 04, 2010 11:08 pm
by merlinthemagic
I could not for the life of me get the DCS-5300 and zoneminder 1.24-2 to work, on a standard Centos 5.5 install. FFMPEG is a moving target and the camera software from dlink is really crappy. here are the changes i had to make in order for FFMPEG and the dlink cameras to work nicely on centos 5.5 64bit.

http://www.zoneminder.com/wiki/index.php/CentOS


Replace the following lines (2) in zm_image.cpp (camera fix):

Code:
jpeg_finish_decompress( cinfo );


by:

Code:
jpeg_abort_decompress( cinfo );


(zoneminder / ffmpeg fix)

cd /usr/src

svn checkout -r 21010 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg


cd libswscale

svn switch svn://svn.ffmpeg.org/mplayer/trunk/libswscale -r 30172

./configure --with-ffmpeg=/usr/local/bin --enable-crashtrace=no --enable-mmap=no --enable-debug=no --with-mysql=/usr/local/bin
--with-libarch=lib64 --with-webdir=/var/www/html/zm --with-cgidir=/var/www/cgi-bin --with-webuser=apache --with-webgroup=apache ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass --with-extralibs="-L/usr/lib64 -L/usr/lib64/mysql"


Cameras:

options / network / http version 1.0 (not default 1.1)

source:

max frames=2
max frames when alert = 10
path: /cgi-bin/video.jpg?size=3 (remember to set cam to the same)
resolution: 704 x 480

So basically use a specific version of FFMpeg and make ZM ignore/abort broken frames from the camera.

And for the first time i have an error free setup of Zone Minder.

Regards,

Martin Madsen

Posted: Mon Dec 06, 2010 10:42 am
by markrocker
There are various softwares available in the market which helps in converting the files easily and quickly into the JPEG.