Steve Evans 0 Posted June 22, 2008 Hi All, Recently a combination of Mac OS X and firefox updates broke my ability to see my AvTech DVR760 remotely from Apple machines. I tracked this to a Java applet bug causing a security exception as it tried to create a local file. Undaunted I downloaded the application.jar file from the DVR and decompiled it using the jad Java decompiler. I bit of hackery later and I now have a pure Java application which I can run on a PC or Mac (or indeed anywhere else should I choose to) which basically provides the same functions as the web interface but also nicely supports scaling of the displayed image to fit the window size, unlike in the web app. Is there a call for such an application from those wanting to use DVR760s from Mac/Linux platforms as well as Windows? Steve Share this post Link to post Share on other sites
scorpion 0 Posted June 27, 2008 I would be interested in putting this on my website as I am sure there is a need out there. Share this post Link to post Share on other sites
scorpion 0 Posted June 28, 2008 (edited) The application CCTV_1.0.dmg , and the CCTV.JAR file has been posted at http://scorpiontheater.com/javaapp.aspx A mac user would download the .dmg file which is a disk image. When they open it they'll see an application with a CCTV icon which they then copy to their Application folder. To run it they then double click the program under Applications. Thanks to Steve Evans for his work, and his research. Edited June 30, 2008 by Guest Share this post Link to post Share on other sites
Kiwi 0 Posted June 29, 2008 (edited) Sweet! Works great on my PC, even a little snappier than the original. I'll have to try it on my linux-based web tablet. Good work! ---- I have a shortcut in the same folder as .JAR file which contains the arguments. C:\WINDOWS\system32\javaw.exe -jar CCTV_JAR.jar 10.1.1.33 80 username password That folder can be located anywhere. Once placed, then created a shortcut on the desktop from that first shortcut to point to it (right-click, send to desktop.) Edited June 29, 2008 by Guest Share this post Link to post Share on other sites
scorpion 0 Posted June 29, 2008 I need your help in editing that webpage. Any advice? I am not familiar with Apple/Mac OS. Has anyone tried it on Linux yet? Thanks! Share this post Link to post Share on other sites
Kiwi 0 Posted July 1, 2008 This app is super-handy for quickly checking live cameras without keeping the old Video Server-E running in the task bar. On a LAN it comes up with working video in less than a second or two of being started. On a PC the aspect ratio comes out slightly wrong. Video Server E gives 1.400 or 641 x 458 while CCTV_JAR shows 1.157 or 641 x 554. Is there a way to correct this? Also, the video quality level appears to be on "medium." Again, can this be easily changed? TIA Share this post Link to post Share on other sites
Steve Evans 0 Posted July 2, 2008 As there seem to be some issues with the formatting of the webpage, here are the instructions, properly formatted, for users who want to set a default host/login on startup. If the application is run as supplied it will present you with a dialog box requesting login information, the default port being 80 and the username/password being admin/admin. It is also possible to supply these on the command line thus: $ java -jar CCTV.jar myhost 80 admin admin which is rather handy for Window shortcuts for specific machines. These arguments can also be passed to the Mac application by modifying the CCTV.app/Contents/Info.plist file to include an Arguments clause thus: <dict> <key>MainClass</key> <string>Cctv</string> <key>JVMVersion</key> <string>1.5*</string> <key>Arguments</key> <string>myhost 80 admin admin</string> <key>ClassPath</key> <string>$JAVAROOT/CCTV.jar</string> </dict> I hope that's clearer. Steve Share this post Link to post Share on other sites
Steve Evans 0 Posted July 2, 2008 This app is super-handy for quickly checking live cameras without keeping the old Video Server-E running in the task bar. On a LAN it comes up with working video in less than a second or two of being started. On a PC the aspect ratio comes out slightly wrong. Video Server E gives 1.400 or 641 x 458 while CCTV_JAR shows 1.157 or 641 x 554. Is there a way to correct this? Also, the video quality level appears to be on "medium." Again, can this be easily changed? TIA The code wasn't setting the quality so I guess I've been lucky to be getting high, so I've made a change to force this to High, and I'll get this change released soon. As for the aspect ratio I've been very care to use the same 640x552 panel size as in the java applet. I just tried an aspect ratio of 1.4 and it looked like somebody had trodden on my car!!!!! Thanks for the feedback. Steve Share this post Link to post Share on other sites
Kiwi 0 Posted July 3, 2008 Thanks for checking on that, Steve! Also, I used "javaw.exe" instead of "java.exe" as the JRE to eliminate the pop-up text window on a PC. Share this post Link to post Share on other sites
Steve Evans 0 Posted July 3, 2008 From the shape of the green "live" dot, I can see that the aspect ratio should be wider with your system. This is most odd as with an AVC761 I get round green dots with my application, not horizontally squished ones. The 782 is a model 1 with MPEG4 at frame resolution, whereas the 761 is a model 4 and MJPEG at frame. From the manual: Frame: 720 × 480 pixels〈NTSC〉/ 720 × 576 pixels PAL〉 CIF: 352 × 240 pixels〈NTSC〉/ 352 × 288 pixels〈PAL〉 I'm using a PAL system with a pixel ratio of 1.25:1 Kiwi is, I guess, using NeverTwicetheSameColor with a pixel ratio of 1.5:1 Now, of course I don't expect these pixels to necessarily be square, but this could go some way to explain the differences seen. I'll look into this further. Steve Share this post Link to post Share on other sites
Steve Evans 0 Posted July 3, 2008 Hi Kiwi, Looking at the problem of aspect ratio I've had to dig deeper into the applet code on which this application is based. I've modified it so that the image aspect ratio is determined by that of the received images rather than by the fixed 642x554 ratio previously in use. The images returned by my ACV761 are 640x276 - so much for frame resolution of 720x576. No, the 276 isn't a mistake! This is clearly crude de-interlacing by requiring upscaling to 640x552! PM me with your email address and I'll send you a version to try that will hopefully preserve the aspect ratio. If it works for you I'll post it back for wider use. Cheers, Steve Share this post Link to post Share on other sites
Steve Evans 0 Posted July 7, 2008 The Mac OS X 10.5.4 update I've just installed appears to have fixed the issue with opening the directory browser interface using Firefox which is good news. I shall keep refining this application though, as it has certain advantages, including the potential to add network backup which I'll turn my attention to when I get time. Steve Share this post Link to post Share on other sites
fradi 0 Posted July 29, 2008 hi, thanks for your interest. I have an avtech avc781 with 4 channels and the program java cctv.jar it dearly works on my pc. I would like to know if the same program is able' to turn on my pocket pc eten glofiish x800 with mobile windows 6. when I have tried, not and' is possible to compile it because it misses some relative file. jad Would you be prepared to point out me where to withdraw the file or which software can I take for visualizing my avtech on the pocket pc? thanks endless. Share this post Link to post Share on other sites
Kiwi 0 Posted July 29, 2008 I'll try to help as I'm sure Steve is very busy. Presumably you have a suitable Java runtime engine installed and can go to java.com and past the test? If not try here: http://www.superwaba.com.br/en/default.asp As far as I know .jad is a decompiler extension, not really applicable. Share this post Link to post Share on other sites
Steve Evans 0 Posted July 30, 2008 .jad files are associated with mobile applications and are used to package up MIDlets. I have no experience of working with these, although I suspect that it would be possible to re-package the CCTV application. I'm not sure how much effort would be involved. See http://developers.sun.com/mobility/learn/midp/lifecycle/#jadsnjars for details. It looks as if the MIDlet simply uses requires the definition of a subclass of MIDlet to implement the main entry point interface. I'm afraid this isn't something I have time to look at in any depth at the moment (the wife thinks that fitting the new oak flooring in the lounge is more important!), but I can let you have a copy of the source to play around with yourself if you like. Steve Share this post Link to post Share on other sites
Flat Stanley 0 Posted October 30, 2008 what a great app!! thanks for your hard work. I'm moving over to using macs in my office and this is one of the last pieces in the puzzle. Because I'm eternally optimistic I thought I might mention the two 'extras' that would make this app purrrrfect for me.... 1. remembering the hostname and password (and even perhaps the option to auto login!) 2. the ability to toggle between the current controls and a slim line version that only shows the camera buttons. ie, A nice clean interface for watching live. Thanks again!! Regards, Stan Share this post Link to post Share on other sites
Steve Evans 0 Posted October 30, 2008 Option 1 is effectively there as the java application takes hostname, port, username and password from the command line. Using the Jar Bundler application from Apple's X-Code (under Developer/Applications/Utilities) you can create applications that will automatically invoke using your parameters of choice. This is how I run mine - a single click on the dock and I'm in. I can see the benefit of option 2, but to be honest, it's not something I really needed. If I revisit the app, I'll certainly look at revamping the control panel aspect of it. Steve Share this post Link to post Share on other sites
Flat Stanley 0 Posted October 31, 2008 Thanks Steve. There is a JavaApplicationStub executable in the CCTV.app package. I can launch CCTV from the shell with this file. Can I pass the attributes to this file?? I have developer tools installed on my machine at home, so I can try using Jar Bundler this evening but I've never used it before and I've no experience coding in Java. Looking at the docs for Jar Bundler, I need to know the.... fully qualified name of the application’s main class??? it all looks a bit scary to me! a shell script would be a lot easier! Regards Jonathan Share this post Link to post Share on other sites
Flat Stanley 0 Posted October 31, 2008 So, I got home and tried using jar bundler and its incredibly easy!! For those that want to do the same thing, 1. right click on CCTV and select 'show package contents' 2. open the contents folder 3. drag and drop the resources folder to your desktop whilst holding alt 4. open jar bundler 5. click choose and browse to desktop/resources/java 6. select CCTV.jar 7. in arguments to main put your parameters in this format 192.168.1.x 80 username password 8. click choose icon and browse to desktop/resources 9. select cctv.icns 10. click create application and choose were to save your new app voila! you're done! Thanks again steve!! Share this post Link to post Share on other sites
Steve Evans 0 Posted October 31, 2008 See the instructions for modifying the CCTV.app/Contents/Info.plist file to include an Arguments clause on page 1 of this post if you want to avoid running the Jar Bundler yourself. As I've already run it to create the CCTV.app, it's probably easier for you to click on the CCTV application, select Show Package Contents, and then perform the above edit to automatically connect to a given machine. You can even have multiple copies of the app (yeah, I know that doesn't scale well) to access more than one machine. Steve Share this post Link to post Share on other sites
Steve Evans 0 Posted October 31, 2008 LOL! How's about that for timing! Share this post Link to post Share on other sites
Flat Stanley 0 Posted October 31, 2008 hah! yeah thats typical. Actually, your way is much better!! That'll teach me to always read the whole thread before posting - i didn't even notice those previous instructions... Regards, Jonathan Share this post Link to post Share on other sites
scwtim 0 Posted November 10, 2008 Great app! How would you change it so that you can apply this app to the 8 and 16 channel AVtech DVRs? Tim Share this post Link to post Share on other sites
Steve Evans 0 Posted November 10, 2008 Hi Tim, I have no way to test any DVR other than mine, but the basic operation of the app is to have the motion JPEG feed from the device displayed on the left, with buttons on the right, each of which is configured to send a specific code to the DVR when clicked. For example the following line of code causes the code 23 to be sent when '1' is clicked. cctvButtons.add(new CctvButton(cctvLayout, c, "1", 23)); It would be trivial to add additional codes, if known, but, like I say, I'm not able to do this without hardware to test against. I'm happy to let you have the source code, which you should find easy enough to modify according to your needs. Steve Share this post Link to post Share on other sites
Steve Evans 0 Posted November 10, 2008 Sorry, Tim, I appreciate that unless you're a software engineer, or at least a hacker!, my last reply won't be very helpful. I've just taken a look at the web interface that my DVR spits out, and clearly the missing codes are there to see, but I don't know if they are necessarily correct for an 8 or 16 channel machine. If you have a 16 channel machine I can talk to over the net, I'll happily try these additional codes for you, and let you have the result. Steve Share this post Link to post Share on other sites