How to rotate camera using mjpg-streamer-experimental?
I've successfully installed mjpg-streamer-experimental from here I just can't figure out how to set the parameter I need in order to rotate my camera 180 degrees (I have my webcam mounted upside down for a custom mount I made).
I'm using a Logitech C270. I've been searching online for hours for a solution to this issue and just can't find what I'm looking for. Doesn't help that I'm not very proficient when it comes to this stuff.
Would really appreciate some help!
Edit: Having now installed Octopi myself, I have found that they made it easy to rotate the image right from the interface. If you open the "Settings" and look under "Webcam & Timelapse", there are settings for flipping the image horizontally or vertically and for rotating 90 degrees.
There are a few ways to rotate the image of which I am aware. You can do it via the input plugin, the client, or post-processing.
The "input_uvc" and "input_raspicam" plugins both have options to rotate the image. If you are using one of these plugins see the documentation at input_uvc or input_raspicam (it is worth noting that the input options may not be supported by all cameras). You should be able to run the command like the following to get a stream that is rotated 180 degrees:
mjpg_streamer -i 'input_uvc.so -rot 180'
I'm not sure how you are handling the stream, but it is possible that your client can perform the rotation. For example, if you are using VLC you can set the angle of rotation by doing something like this:
- Open the “Tools” menu and select “Effects and Filters”
- In the “Adjustments and Effects” window, on the “Video Effects” tab, select the “Transform” check box
- Select a rotation from the dropdown menu and then click “Close”.
Finally, if you are saving the stream and are only concerned with rotating it afterwards, you can post-process it with a utility like ffmpeg. See this post as an example and look for "Rotate" in the accepted answer.
If your stream is being rendered via a browser you may be able to add some CSS3 formatting to the video element. For example, you could add an ID of "videoElement" to the stream and then add the following to your CSS:
-webkit-transform:rotateZ(180deg); /* Safari and Chrome */
-moz-transform:rotateZ(180deg); /* Firefox */
I get the following error when running the command you posted above: libv4l2: error setting pixformat: Device or resource busy Unable to set format: 1196444237 res: 640x480 Init v4L2 failed !! exit fatal i: init_VideoIn failed I seem to get that error when setting any parameters. I'm running Octoprint, if that makes any difference. There doesn't seem to be a rotate option in Octoprint.
I had experience with mjpg-streamer directly, not with octoprint. Sorry that I couldn't help. But I do have a spare RPi and camera laying around, and now I am interested to try out octoprint. It appears that Octoprint is an HTML interface, so you could probably edit the markup to use CSS3's transform rotateX. That would rotate the image at the client end (browser). BTW, googling for your error code did have some potentially useful information as well.
I appreciate your response nonetheless. Information just seems extremely sparse on this particular fork of mjpg-streamer. Searching for that error just gets me a bunch of people that have non-working webcams while mine works perfectly, I just need to rotate it 180 degrees. Very irritating.