Conceptronic C54netcam2 problem
I am trying to configure the Conceptronic C54Netcam2
, network webcam with motion with no total luck. I receive the error:
"motion:  libjpeg decompression failure on first frame - giving up!"
I have been able to get just one shot this way:
I have contacted with Conceptronic support to get the way to receive streaming directly from the webcam. I've been told I could get it from: http://192.168.1.45/cgi/mjpg/mjpeg.cgi
so I have put the line netcam_url http://192.168.1.45/cgi/mjpg/mjpeg.cgi
It crashes with: "motion:  libjpeg decompression failure on first frame - giving up!" in syslog messages.
I have tried to do it in my browser and it is not able to show me anything, it just propose me a download :(
I have found googling a workaround to be able to watch the streaming, but I don't know how to link it with Motion.
wget http://192.168.1.45/cgi/mjpg/mjpeg.cgi -O fifo.mjpeg&
mplayer -demuxer 35 fifo.mjpeg
I am able to read from the fifo pipe!!!
Thank you very much for your help,
| Motion version:
| ffmpeg version:
|| ffmpeg, mysql, postgresql
| Server OS:
|| CentOS 4.8 kernel 2.6.9-89.0.11.plus.c4smp
- 21 Oct 2009
Try replacing the netcam_url with mjpg://192.168.1.45/cgi/mjpg/mjpeg.cgi (note the mjpg:// part)
It is likely that this modification will not work, but please tell us. You may also post a part of the output of your camera in the NetcamMjpegStreamDumps
section, that will help us see what's wrong and wether this cam can be supported soon or not.
- 21 Oct 2009
I have tried with mjpg:// instead of http://
but -i am still no luck. The error now is motion:  Invalid netcam_url (mjpg://192.168.1.45/cgi/mjpg/mjpeg.cgi)
I have attached the result of the tool MjpegSniff
here and the NetcamMjpegStreamDumps
. I hope you could help me to make it work.
Ok, so first i was wrong about mjpg://. This is only supported in SVN versions. Anyways, that's not the protocol your camera is using. Your camera is emitting a stream of images, separated by HTTP headers. Motion is able to support this type of streaming. But unfortunately, the images are standard JPG images, but prefixed with some sort of header, so it doesn't work out of the box.
If you feel brave, you can try to re-compile motion with the patch below. See the Download page and Documentation pages for the sources and the how-tos.
I made this patch that just skips the header prefixing the JPG image, so you may be able to capture images this way. The patch applies against motion 18.104.22.168 sources and break support for every other netcam. This is just a proof of concept, and cannot be applied to the official motion sources as is.
Please tell us if that produces images
Apply the patch with the command: patch -p1 < C54Netcam2
-poc*.patch . You must be in the motion-22.214.171.124 folder.
Have a nice day.
- 23 Oct 2009
I have applied the patch and...... It works great!!!! Now motion is able to show me the streaming. I need to check the motion detecting and recording movement functionalities (I am not in the camera location until two days). I will let you know.
Thank you very much for the fantastic help and support!!! will this patch or this functionality added to the new version/sub-version??? I mean to be able to use the CentOS
RPM so far.
: I'm not part of the development team, i just wrote a small patch to support a particular IP cam, so i cannot speak for the development team. This post is merely what I personnally think, having seen only a small part of the source. I did not look at the 3.3 branch, so maybe all that I say here is already implemented, done an other way, or not doable at all... Someone of the development team, please make an official answer.
Good to know that's working
Now, for the actual support.
First, the quick fix that works for you breaks the functionality for every other camera in the world, so we need to detect this particular camera kind - if that's at all possible - or accept configuration options.
Motion currently uses an auto-detection of the camera based on the HTTP Content-Type, that work reliably for a number of cameras, but not specific ones. I ran into the problem for my Linksys cam, which used a particular type of streaming. I was constrained to make a specific url scheme, mjpg://, hoping that maybe other cameras are using the same protocol. It seems that's not the case, tough.
Therefore, i think we may keep the content-based autodetection via http://
for the currently supported cameras, as this approach works well. When using mjpg://, we may require a netcam_type option, which will be used to select a particular decoding scheme for the netcam. E.g for my camera i could specify linksys_wvc200, for yours conceptronic_c54, etc. We may also do an autodetection based on the first frame.
Sadly, this requires many changes to the netcam code.
So, this will not appear in motion 3.2.x. This perhaps may appear in 3.3.x if it's not too late (actually, since the linksys patch is in this release, at least the good netcam_type option should be implemented). Or it may be scheduled for a later release.
Have a nice day
- 25 Oct 2009
Thank you very much for the aclarations about your role. One more time, thank you very much for the patch for my netcam. I hope in future versions it could be added to code (i don't know if maybe some directive as Special_netcam with values as Conecptroni_c54 or Linksys_wvc200 or whatever could be customized for this special/non-standard netcams) to be in the standard and to be able to enjoy the next motion updates using still RPMs instead of patching and compiling...
Thanks a lot for everything!
The patch is good , but it's a custom patch because a crappy firmware and jpeg/multipart implementation from conceptronic adding "shit" before start of jpeg.
I'll try to figure out how to create a general solution to skip this issue for all cameras , detecting start of JPEG frame and skipping "shit".
- 15 Nov 2009
Added soi_fix.diff that gives a general solution for images with trash before SOI ( Start Of Image).
Get svn -r498 and apply the patch.
- 29 Mar 2010