Feature #741

Add option to run in low-res mode

Added by Hammel 6 months ago. Updated 6 months ago.

Status:ClosedStart date:17 Feb 2020
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:Webcam
Target version:PiBox - 1.1.0 - Upgrades
Severity:03 - Medium

Description

The UI needs to default to low-res mode (5 or 10 fps) with an option to run at high-res (30fps).
This means an additional Message Action type for MT_STREAM: MA_START_LOW.
This implies the following:
  • handleStream: adds msgAction case for MA_START_LOW that is the same as MA_START, but passes the msgAction value to spawnStream.
  • spawnStream: accepts msgAction type argument.
  • spawnStream: uses msgAction argument to select the FPS and builds command with that.

If I do this then I can use the media system as a web cam at the house, using an ssh tunnel to the Pi's. Using the phone at 30fps works but is really, really slow and falls behind quickly. I think slowing down the frame rate (and maybe the video size) would help.

Associated revisions

Revision 296698a8
Added by Hammel 6 months ago

RM #741: Support low-res and hi-res modes for webcam. Fix quit to properly exit the webcam on the server. Fix dialog call when improperly seting pw for users.

Revision 361fba87
Added by Hammel 6 months ago

RM #741: Make every request for the webcam kill any existing webcam process first. Allow request for either hi-res or low-res webcam.

Revision 475a8608
Added by Hammel 6 months ago

RM #741: Disable externally configured webcam command in favor of internal command usage, which will allow for using either hi- or low-res options.

Revision d2f28f86
Added by Hammel 6 months ago

RM #741: Increase frame rate by 1/sec for slightly better images. Apparently the phone can handle this.

History

#1 Updated by Hammel 6 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

The description only mentions what should be done with piboxd. I need to map out what piboxwww has to have changed too.

  1. webcam(): default to low-res (action=3 instead of 1)
  2. webcam.tmpl: add hires() function that adds res=high to URL.
  3. webcam.tmpl: change reload() function to pass res=low in URL.
  4. webcam(): Use $_GET["res"] to determine if action should be 1 instead of 3.

Also, the "Reload" button should now say "High Res" and add a new button that says "Low Res" in webcam.tmpl.

That should allow hi vs low resolution when requesting the stream from piboxd.

#2 Updated by Hammel 6 months ago

  • % Done changed from 10 to 20

This will likely work, but there is an underlying bug that needs to be fixed first: The use of TAG to add state doesn't work. This means that "Quit" or restarting at a different resolution doesn't work. The backgrounded mjpeg-streamer process keeps running.

The simple fix (but not ideal) is to stop associating the request with the tag. Every new inbound request kills the currently running process before restarting it with a new config.

Now working on implementing that fix.

#3 Updated by Hammel 6 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 20 to 100

Done. High and low res options work on the web interface. Console interface is always hi res. Switching resolution or device will always restart the server so only one person at a time can view it. Low-res works much better on my phone over 4G (i think, maybe 3G?).

Tested, committed to both repos (piboxd and piboxwww) and pushed.

Closing issue.

Also available in: Atom PDF