Webcam stream image rotation

I have the webcam (mounted inverted and have the appropriate rotation selected.) setup and everything works great via the web page. If I look at the webcam stream in another browser tab the image is the inverted view. This causes issues with viewing the camera via Home Assistant or any other third party. Is there a way for the raw stream and snapshot to also be rotated?

Comments

  • We indeed rotate inside browser for simple reason that we only get the raw stream from the webcam. 

    What you want is I guess mjpg_streamer to rotate it already. You can change the parameter for all webcams in file /usr/local/Repetier-Setup/etc/webcam.conf there are 2 parameter dependent on cam type
    # Extra paremeter for pi module when started.
    WEBCAM_PICAM_PARAMS=""
    # Extra parameter for usb module when started.
    WEBCAM_USB_PARAMS=""

    where you can add extra parameter. -rot 180 should rotate on camera side I think. You can also google mjpg_streamer options for more control.

  • I have tried what you suggested and either I'm not doing something right or it isn't working.

    I changed the following:
    # Extra paremeter for pi module when started.
    WEBCAM_PICAM_PARAMS=""
    # Extra parameter for usb module when started.
    WEBCAM_USB_PARAMS="" to this: # Extra paremeter for pi module when started.
    WEBCAM_PICAM_PARAMS="-rot 180"
    # Extra parameter for usb module when started.
    WEBCAM_USB_PARAMS="-rot 180"
    I've rebooted the server several times. In another thread I found where it was recommended to use: ps aux | grep mjped To see the used parameter This is the result: bditter@repetier:/usr/local/Repetier-Setup/etc $ ps aux | grep mjpeg bditter 2424 0.0 0.0 7444 568 pts/0 S+ 08:22 0:00 grep --color=auto mjpeg Am I doing something wrong with the configuration?
  • Then it is not supported by your webcam and you need to rotate the image on the website like we do. Not all usb webcams support it. See help output of input_uvc plugin in mjpg_streamer:

    mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so --help"

    MJPG Streamer Version.: 2.0 --------------------------------------------------------------- Help for input plugin..: UVC webcam grabber --------------------------------------------------------------- The following parameters can be passed to this plugin:
     [-d | --device ].......: video device to open (your camera) [-r | --resolution ]...: the resolution of the video device,                          can be one of the following strings:                          QQVGA QCIF CGA QVGA CIF PAL                          VGA SVGA XGA HD SXGA UXGA                          FHD                          or a custom value like the following                          example: 640x480 [-f | --fps ]..........: frames per second                          (camera may coerce to different value) [-q | --quality ] .....: set quality of JPEG encoding [-m | --minimum_size ].: drop frames smaller then this limit, useful                          if the webcam produces small-sized garbage frames                          may happen under low light conditions [-e | --every_frame ]..: drop all frames except numbered [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave                          it up to the driver using the value "auto" [-t | --tvnorm ] ......: set TV-Norm pal, ntsc or secam [-u | --uyvy ] ........: Use UYVY format, default: MJPEG (uses more cpu power) [-y | --yuv  ] ........: Use YUV format, default: MJPEG (uses more cpu power) [-fourcc ] ............: Use FOURCC codec 'argopt',                          currently supported codecs are: RGB24, RGBP [-timestamp ]..........: Populate frame timestamp with system time [-softfps] ............: Drop frames to try and achieve this fps                          set your camera to its maximum fps to avoid stuttering [-timeout] ............: Timeout for device querying (seconds) [-dv_timings] .........: Enable DV timings queriyng and events processing ---------------------------------------------------------------
     Optional parameters (may not be supported by all cameras):
     [-br ].................: Set image brightness (auto or integer) [-co ].................: Set image contrast (integer) [-sh ].................: Set image sharpness (integer) [-sa ].................: Set image saturation (integer) [-cb ].................: Set color balance (auto or integer) [-wb ].................: Set white balance (auto or integer) [-ex ].................: Set exposure (auto, shutter-priority, aperature-priority, or integer) [-bk ].................: Set backlight compensation (integer) [-rot ]................: Set image rotation (0-359) [-hf ].................: Set horizontal flip (true/false) [-vf ].................: Set vertical flip (true/false) [-pl ].................: Set power line filter (disabled, 50hz, 60hz, auto) [-gain ]...............: Set gain (auto or integer) [-cagc ]...............: Set chroma gain control (auto or integer) ---------------------------------------------------------------
Sign In or Register to comment.