Shell command as image source
Posted: Sun Feb 13, 2011 8:45 am
I've been playing around with this Hawking HNC210, recently. It's an IP camera with a weird image delivery format. Someone posted to the forum a perl script to retrieve a JPG from it, which works great.
My issue is, the "easy" way to make this work with ZM is to export the jpeg to a file, then set up a "File" source type. This is a really yucky solution, though. This requires that I have another program running that is constantly updating the file, and then have ZM read that same file -- a recipe for garbled images. I have to set the polling rate in my external program, and within ZM.
So, my alternate solution was to have ZM get the image on demand, instead of having this yucky asynchronous file transfer going on. It's fairly simple: I converted the same perl script to a simple CGI, and have apache serve it. Then as my image source in ZM, i set it as "Remote", pointing to the address of the perl script. It works beautifully; no more torn images or anything!
So, that brings me to the feature request. What I've done works great... but it's a lot of unnecessary overhead. I've got to fetch the image, then re-encode it for HTTP, then ZM has to parse the HTTP again immediately. It'd be so much nicer if there was a new source type "Shell script" or something, that would just execute an arbitrary command of your choosing and take STDOUT as the image.
My issue is, the "easy" way to make this work with ZM is to export the jpeg to a file, then set up a "File" source type. This is a really yucky solution, though. This requires that I have another program running that is constantly updating the file, and then have ZM read that same file -- a recipe for garbled images. I have to set the polling rate in my external program, and within ZM.
So, my alternate solution was to have ZM get the image on demand, instead of having this yucky asynchronous file transfer going on. It's fairly simple: I converted the same perl script to a simple CGI, and have apache serve it. Then as my image source in ZM, i set it as "Remote", pointing to the address of the perl script. It works beautifully; no more torn images or anything!
So, that brings me to the feature request. What I've done works great... but it's a lot of unnecessary overhead. I've got to fetch the image, then re-encode it for HTTP, then ZM has to parse the HTTP again immediately. It'd be so much nicer if there was a new source type "Shell script" or something, that would just execute an arbitrary command of your choosing and take STDOUT as the image.