Webcam stream flipped

In OctoPrint, I have the webcam set to flip horizontally + vertically (to achieve a 180 degree rotation). It looks fine within the OctoPrint interface, but when I go to /webcam/?action=stream the stream reflects the unmodified webcam video (i.e. it's upside down for me)
I prefer to be able to use the full-screen video feed, since the video feed embedded within the OctoPrint interface is so small that it's hard to see when the print of a small part has failed catastrophically.
(on that note, it would be nice if there were an easy way to open the full-sized video feed from directly within OctoPrint...)

I'm using the latest Octoprint on an RPi3 with the official Raspberry Pi cam, which is mounted in an enclosure from thingiverse that happens to mount it upside down.

Yep. OctoPrint doesn't control the webcam stream, it can only modify it when it displays it itself. Can't change this. If you happen to be using a Raspicam, the driver for that in the bundled webcam server supports rotation and flipping, see

https://discourse.octoprint.org/t/available-mjpg-streamer-configuration-options/1106

Sadly the USB webcam driver doesn't.

1 Like

I am using the RPicam, so the config change worked great - and so does the plugin. Two problems solved - thanks!

Mark my post as the solution then please -> :marksolved:

That helps others with the same issue find it faster. :slight_smile:

if you are using chrome, you can right-click -> inspect the stream. Then add the following atribute to the image tag: style="transform:rotate(180deg);"

Sigh, I worked through this some time ago, worked through the process and got the stream flipped vertically. I don't know what happened, but on a recent power cycle (I think I forgot to soft shutdown the Pi) to do some printer modification it came back up flipped again. I guess I'll have to reinvest 30 minutes getting this fixed again later, but for now I was curious about the last post for quick flipping it in Chrome. That post assumed a lot, it was not obvious how to do this but I wanted to share the answer and that it works as a quick fix.
Capture

The key was to right click on the image, inspect, and then insert only transform:rotate(180deg);
into the existing img style as shown in my screenshot. It does work! Not a good solution, but a workaround.

Faster solution than trying to find the right element to inspect.

open dev tools and go into the console and execute the following

document.getElementById('webcam_container').style.transform = 'rotate(180deg)';

(you can change 180 to 90 or -90 if needed)

Hmmm, sounds cool but that didn't work for me just now. It says VM17:1 Uncaught TypeError: Cannot read property 'style' of null
at :1:44

And you ran it on the control page?

Also there is a way to do this, it's called out in this ticket, but how to do it isn't clear

If you shell in to your octopi, you can change it.

  1. ssh <username>@<host> (eg: ssh pi@octoprint.local), it'll ask for your password. This user, pass, and host were made when you create your octopi image. I think by default it might be pi and raspberry.
  2. sudo vi /boot/octopi.txt (will require the same password as above)
  3. press o to open a new line for editing
  4. paste camera_usb_options="-rot 180" to the document and press ESCAPE to get out of edit mode.
  5. type :wq to save
  6. type exit

should be good. Mabe a restart.