Results 1 to 12 of 12

Thread: Adjust JPEG compression on display.jpg

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2004
    Location
    Grimstad, Norway
    Posts
    19

    Adjust JPEG compression on display.jpg

    I have an Asus WL-500g with a Logitech Quickcam Pro 4000 webcam. The picture (http://your.routers.ip.addr:7776/display.jpg) is heavy compressed, and the quality is poor. Does it exist any options to change the JPEG compression? Is it possible if I compile the firmware myself, or do i just have to edit a config file? Or is it not possible at all?

    The plan is to get a picture with super quality in 320x240, resize it up to 400x300 and compress it before it's uploaded to my hosts FTP server. This upload process is handeled by an external server, running linux.

    I have also noticed that the quality of the stream on port 7777 is relatively good. No lossy compression like the JPEG picture. Can I use my external linux box to capture a picture from this stream and use that picture instead? What type of stream is it? I have STF, but could only find a stream viewer for Windows, not any for linux.

    And at last a question to Oleg (or somebody else who knows): Will it (in the future) be possible to capture pictures with a higher resolution than what's possible today? Just dreaming of 640x480...

    Thanks.

  2. #2
    Join Date
    May 2004
    Location
    Moscow, Russia
    Posts
    50
    On 1927-CR4 I am currently using pwc and pwcx taken from this thread. For my Phillips ToUCam it allows 640x480 resolution with low FPS.

    usage looks smthg like this in post-mount

    Code:
    insmod videodev.o
    ln -s /dev/v4l/video0 /dev/video
    insmod pwc.o power_save=0
    ...
    For that driver setpwc program exists to change camera settings including compression settings.

    As a sample of working setup please find attached "bird portrait", taking by motion detection software, running on asus box.

    So it goes
    Roofcat
    Attached Images Attached Images  

  3. #3
    Join Date
    Dec 2004
    Location
    Grimstad, Norway
    Posts
    19

    Do you have to use palantir?

    Do you have to use Palantir, or can you use the built-in program?

  4. #4
    Join Date
    May 2004
    Location
    Moscow, Russia
    Posts
    50
    Quote Originally Posted by Muffe
    Do you have to use Palantir, or can you use the built-in program?
    No and No!

    Since I use it as burglar monitoring and hopefully recording (I hate that surveil-something word, never managed to spell it correctly ) I use motion software if my wl-500g box booted from USB drive, or mvc (simpler motion detector) if wl-500g is booted from internal flash.

    In both cases files are scp-ed to remote Unix computer using wl-500g ssh, cron and shell scripts. On Unix computer another cron job creates movies from separate frames using mencoder.

    And back to thread subject - I've tried to play with quality of jpeg using motion software config options, but found that jpeg quality becomes too low for extreme lighting conditions (we kinda have a lot of snow here in winter and bright sun in spring

    So it goes
    Roofcat

  5. #5
    Join Date
    Dec 2004
    Location
    Grimstad, Norway
    Posts
    19
    Sorry for asking so many silly questions, but i don't have a lot of experience with this unit.

    I do not want any motion detection, I just want to capture one picture every 60. second, and publish this on the internet. The way it is done now is that my linux server sends a HTTP request to the WL-500g in port 7776 for display.jpg. It is stored on my computer, and the original is tranfered via FTP together with a resized copy to my webhost. Then is the copy on my computer deleted. This is done by a cron job executing a shell script every 60. second (if somebody is intrested in the script, please PM me).

    What I want is something that can do the same job, with or without the help of my computer. I just want 640x480 pictures uploaded to my host every minute or any other apropriate interval.

    I also need help to install the files provided by Tom here. I have extracted the data.tar.gz and have the files stored on my computer (running Linux), but what do I have to do now to reach my goal? It's not too much helpfiles og manuals attached, so it's a bit difficult for a newbee to understand it.

    One off-topic question: Why is the image you supplied mirrored?

    Thanks.

  6. #6
    Join Date
    May 2004
    Location
    Moscow, Russia
    Posts
    50

    draft version of step-by-step guide of Hires picture

    Quote Originally Posted by Muffe
    I do not want any motion detection, I just want to capture one picture every 60. second, and publish this on the internet. The way it is done now is that my linux server sends a HTTP request to the WL-500g in port 7776 for
    display.jpg. It is stored on my computer, and the original is tranfered via FTP together with a resized copy to my webhost. Then is the copy on my computer deleted. This is done by a cron job executing a shell script every
    60. second (if somebody is intrested in the script, please PM me).

    What I want is something that can do the same job, with or without the help of my computer. I just want 640x480 pictures uploaded to my host every minute or any other apropriate interval.

    I also need help to install the files provided by Tom here. I have extracted the data.tar.gz and have
    the files stored on my computer (running Linux), but what do I have to do now to reach my goal? It's not too much helpfiles og manuals attached, so it's a bit difficult for a newbee to understand it.
    Below there was a request for step by step instruction, so here it goes.

    I assume you have ASUS wl-500g, with custom software (Oleg's FW 1.9.2.7 CR4 or higher), you have web camera, supported by pwc driver. My configuration uses USB flash drive and while writing this HOWTO I realize that my configuration will not work without it, since size of all files to store is larger than 64K - maximum of flashfs to store. So you will also need USB flash drive supported by ASUS software or arrange dynamic load of gzipped archive from UNIX computer in post-boot. Anyway:

    1. You need to download ipkg file provided by Tom here, uncompress and untar it, locate data.tar.gz extracted from package, uncompress and untar it. You may do this on other computer and then scp files to asus box, or do all on asus box, provided it is connected to Internet and you can ssh to it from your desktop. In the later case it looks smthg like (below I assume you've got USB flashdrive mounted in ASUS as /mnt):

    Code:
    [admin@router mnt]$ wget http://tom.stoeveken.com/programme/philips-webcam/philips-webcam_0.1_mipsel.ipk
    Connecting to tom.stoeveken.com[213.203.199.171]:80
    philips-webcam_0.1_m 100% |*****************************|   191 KB    00:00 ETA
    [admin@router mnt]$ tar zxpvf philips-webcam_0.1_mipsel.ipk
    ./debian-binary
    ./data.tar.gz
    ./control.tar.gz
    [admin@router mnt]$ tar zxpvf data.tar.gz
    .
    ./www
    ./www/CamClient.class
    ./www/CamClient.html
    ./www/CamMonitor.class
    ./www/CamMonitor.html
    ./www/offline.jpg
    ./bin
    ./bin/mvc
    ./bin/setpwc
    ./bin/camsrv
    ./lib
    ./lib/modules
    ./lib/modules/2.4.20
    ./lib/modules/2.4.20/pwc.o
    ./lib/modules/2.4.20/pwcx.o
    [admin@router 1]$ls -la
    drwxr-sr-x    5 admin    root         1024 May 18 01:06 .
    drwxr-xr-x    5 admin    root        13312 May 18 01:04 ..
    drwxr-sr-x    2 admin    root         1024 May 18 01:06 bin
    -rw-r--r--    1 1000     1000          399 Dec 23 21:46 control.tar.gz
    -rw-r--r--    1 1000     1000       195859 Dec 23 21:46 data.tar.gz
    -rw-r--r--    1 1000     1000            4 Dec 23 21:46 debian-binary
    drwxr-sr-x    3 admin    root         1024 May 18 01:06 lib
    -rw-r--r--    1 admin    root       196314 May 18 01:05 philips-webcam_0.1_mipsel.ipk
    drwxr-sr-x    2 admin    root         1024 May 18 01:06 www
    [admin@router mnt]$
    Now you have all files necessary for the task inside the Asus box. To save space you may delete some files downloaded and extracted.
    Code:
    [admin@router mnt]$ rm philips-webcam_0.1_mipsel.ipk
    [admin@router mnt]$ rm control.tar.gz
    [admin@router mnt]$ rm data.tar.gz
    [admin@router mnt]$ rm debian-binary
    [admin@router mnt]$ rm -rf www
    [admin@router mnt]$ rm bin/camsrv
    [admin@router mnt]$ ls -lR
    .:
    drwxr-sr-x    2 admin    root         1024 May 18 01:13 bin
    drwxr-sr-x    3 admin    root         1024 May 18 01:06 lib
    
    ./bin:
    -rwxr-xr-x    1 admin    root       109948 Dec 13 23:07 mvc
    -rwxr-xr-x    1 admin    root        23020 Dec 22 16:10 setpwc
    
    ./lib:
    drwxr-sr-x    3 admin    root         1024 May 18 01:06 modules
    
    ./lib/modules:
    drwxr-sr-x    2 admin    root         1024 May 18 01:06 2.4.20
    
    ./lib/modules/2.4.20:
    -rw-r--r--    1 admin    root        69036 Dec 22 20:40 pwc.o
    -rw-r--r--    1 admin    root        59310 Dec 22 20:40 pwcx.o
    All these files will be necessary for out task, so it is better to keep it on USB flash drive.

    2. Switch off webcam support in web interface of ASUS.

    3. Create /usr/local/sbin/post-mount file with following lines in it.
    Code:
    #!/bin/sh
    # device init
    insmod videodev.o
    # v4l device support
    ln -s /dev/v4l/video0 /dev/video
    # create "canonical" v4l device
    insmod /mnt/lib/modules/2.4.20/pwc.o size=vga fps=4 power_save=0
    # install pwc 
    # size= defines image size to capture
    # fps=	defines frames per second
    # power_save= is some magic
    insmod /mnt/lib/modules/2.4.20/pwcx.o
    # install compression module
    
    #Now lets sleep a bit...
    sleep 30
    # ... and start webcam software. 
    
    /mnt/bin/mvc -D -d /dev/video -t -w 2 -s 640x480 -c 70 -O /mnt/tmp/ -o -l /mnt/log/mvc.log
    #
    # this is my configuration, yours may vary
    # -D     Start mvc as a Daemon.
    # -d device   Specify v4l device (default: /dev/video0).
    # -w delaytime              Specify interval for each capture(seconds), Default: 0.5 second.
    # -s XxY Specify the image capture size,  default  320x240.  
    # -c value
    #              Specify threshold of block color difference. Range [0-765]  Usu-
    #              ally, 30-200 is a better value for common use. More smaller more
    #              sensitive. Default value is 50
    #  Probably if you don't need motion detect at all -c 765 will switch it off 
    # -O directory
    #              Specify  base  directory  for  output images. default is current
    #              dir.
    # -o     Don't create sub-directories for output. Use  this  option,  all
    #              image files will be put on one directory.
    # -l logfile
    #              Specify the logfile name to be used in daemon mode.  default  is
    #              null.
    #
    # And now lets get Pid of mvc to kill it later.
    # pid extraction
    
    ps | grep "mvc " | grep -v 'grep' | sed -e 's/ admin.*//' -e 's/^ *//' >/var/run/mvc.pid
    Let me stress again - basically this is my setup, using USB flashdrive to store data. Probably it is possible to start rcamd from flash instead of mvc, thus saving space and eliminating the need in usb flashdrive but I've never tried.

    And don't forget to save resulting config (flashfs save && flashfs commit && flashfs enable)

    4. Now we should arrange periodic image capture from mvc. To achieve this we will use USR1 signal, which cause mvc to save captured image (details may be found in http://www.turbolinux.com.cn/~merlin/mvc/README)

    I use cron, but I only do 30 mins captures. So in my case I created shell script with following lines
    Code:
    kill -USR1 `cat /var/run/mvc.pid`
    sleep 5
    # file processing follows...
    and add cron job to execute this script each half an hour (1 minute in your case). In file processing section I just scp file to remote computer to web accessible directory.

    Another way of doing the same is running infinite loop in the end of post-mount with smthg similar to:
    Code:
     while true; do sleep 1800; killall -USR1 mvc; sleep 5; scp <scp instructions go here> ; done
    (In this case you even do not need pid extraction in post-mount)

    Probably I've missed some (important?) details here, but basically this is one of the possible ways to accomplish the task.

    HTH
    Roofcat
    One off-topic question: Why is the image you supplied mirrored?
    Because my Phillips camera provides me with mirrored image and I could not find simple way to config it the other way around. And I found difficult to flip it mentally all the time.

  7. #7
    Join Date
    Dec 2004
    Location
    Sheffield, UK
    Posts
    2
    Is there any chance you guys could draft up an 'how to' from start to finish of the above solution?

    Thanks.

Similar Threads

  1. open jpeg files from alert email in linux
    By xlephant in forum WL-500g Q&A
    Replies: 2
    Last Post: 10-07-2004, 13:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •