<p><strong>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 &quot;Settings&quot; and look under &quot;Webcam &amp; Timelapse&quot;, there are settings for flipping the image horizontally or vertically and for rotating 90 degrees.</strong></p>
<hr />
<p>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.</p>
<p>The &quot;input_uvc&quot; and &quot;input_raspicam&quot; plugins both have options to rotate the image. If you are using one of these plugins see the documentation at <a href="https://github.com/jacksonliam/mjpg-streamer/blob/master/mjpg-streamer-experimental/plugins/input_uvc/README.md" rel="nofollow noreferrer">input_uvc</a> or <a href="https://github.com/jacksonliam/mjpg-streamer/blob/master/mjpg-streamer-experimental/plugins/input_raspicam/README.md" rel="nofollow noreferrer">input_raspicam</a> (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:</p>
<pre><code>mjpg_streamer -i 'input_uvc.so -rot 180'
</code></pre>
<p>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:</p>
<ul>
<li>Open the “Tools” menu and select “Effects and Filters”</li>
<li>In the “Adjustments and Effects” window, on the “Video Effects” tab, select the “Transform” check box</li>
<li>Select a rotation from the dropdown menu and then click “Close”.</li>
</ul>
<p>Finally, if you are saving the stream and are only concerned with rotating it afterwards, you can post-process it with a utility like <code>ffmpeg</code>. See this <a href="https://superuser.com/questions/578321/how-to-rotate-a-video-180-with-ffmpeg">post</a> as an example and look for &quot;Rotate&quot; in the accepted answer.</p>
<p>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 <code>videoElement</code> to the stream and then add the following to your CSS:</p>
<pre><code> #videoElement {
    transform: rotateZ(180deg);
    -webkit-transform:rotateZ(180deg); /* Safari and Chrome */
    -moz-transform:rotateZ(180deg); /* Firefox */ 
}
</code></pre>
<p>With respect to Octoprint, it appears that Octoprint is an HTML interface, so you could probably edit the markup to use CSS3's transform <code>rotateX</code>. That would rotate the image at the client end (browser). BTW, googling for your error code did have some potentially useful information as well.</p>

CC BY-SA 4.0
2017-10-28T20:36:23.680Z
2021-07-14T07:26:01.770Z
2021-07-14T07:26:01.770Z
GiF
<p>From the <code>help</code> for input plugin &quot;<strong>raspicam</strong>&quot;, the following parameters can be passed to this plugin:</p>
<pre><code>[-fps | --framerate]...: set video framerate, default 5 frame/sec
[-x | --width ]........: width of frame capture, default 640
[-y | --height]........: height of frame capture, default 480
[-quality].............: set JPEG quality 0-100, default 85
[-usestills]...........: uses stills mode instead of video mode
[-preview].............: Enable full screen preview
[-timestamp]...........: Get timestamp for each frame
</code></pre>
<pre><code>-sh : Set image sharpness (-100 to 100)
-co : Set image contrast (-100 to 100)
-br : Set image brightness (0 to 100)
-sa : Set image saturation (-100 to 100)
-ISO : Set capture ISO
-vs : Turn on video stablisation
-ev : Set EV compensation
-ex : Set exposure mode (see raspistill notes)
-awb : Set AWB mode (see raspistill notes)
-ifx : Set image effect (see raspistill notes)
-cfx : Set colour effect (U:V)
-mm : Set metering mode (see raspistill notes)
-rot : Set image rotation (0-359)
-stats : Compute image stats for each picture (reduces noise for -usestills)
-drc : Dynamic range compensation level (see raspistill notes)
-hf : Set horizontal flip
-vf : Set vertical flip
</code></pre>
<p>The <strong>-rot</strong> parameter can rotate the image.</p>

CC BY-SA 4.0
2021-07-13T11:16:43.897Z
2021-07-13T11:59:10.190Z
2021-07-13T11:59:10.190Z
BgWebDesign
<p>I've successfully installed <code>mjpg-streamer-experimental</code> from <a href="https://github.com/jacksonliam" rel="nofollow noreferrer">jacksonliam</a>/<a href="https://github.com/jacksonliam/mjpg-streamer" rel="nofollow noreferrer"><strong>mjpg-streamer</strong></a>.</p>
<p>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).</p>
<p>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.</p>
<hr />
<p>If I run the command suggested in GiF's <a href="https://3dprinting.stackexchange.com/a/4823/4762">answer</a>:</p>
<pre><code>mjpg_streamer -i 'input_uvc.so -rot 180'
</code></pre>
<p>I get the following error:</p>
<pre><code> libv4l2: error setting pixformat: Device or resource busy Unable to set format: 1196444237 res: 640x480 Init v4L2 failed !! exit fatal i: init_VideoIn failed 
</code></pre>
<p>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.</p>
<p>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.</p>
<hr />
<p>I would <em>really</em> appreciate some help!</p>

<octoprint>
How to rotate camera using mjpg-streamer-experimental?
John Abraham
# How to rotate camera using mjpg-streamer-experimental?

(Asked by: username_0 on 2017-10-28)

I've successfully installed mjpg-streamer-experimental from jacksonliam/mjpg-streamer.
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.

If I run the command suggested in GiF's answer:
mjpg_streamer -i 'input_uvc.so -rot 180'

I get the following error:
 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.
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.

I would really appreciate some help!

**Tags:** octoprint

---

## 2 answers

### Answer by username_1 on 2017-10-28. Score: 6

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:
 #videoElement {
    transform: rotateZ(180deg);
    -webkit-transform:rotateZ(180deg); /* Safari and Chrome */
    -moz-transform:rotateZ(180deg); /* Firefox */ 
}

With respect to 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.


---

### Answer by username_2 on 2021-07-13. Score: 2

From the help for input plugin "raspicam", the following parameters can be passed to this plugin:
[-fps | --framerate]...: set video framerate, default 5 frame/sec
[-x | --width ]........: width of frame capture, default 640
[-y | --height]........: height of frame capture, default 480
[-quality].............: set JPEG quality 0-100, default 85
[-usestills]...........: uses stills mode instead of video mode
[-preview].............: Enable full screen preview
[-timestamp]...........: Get timestamp for each frame

-sh : Set image sharpness (-100 to 100)
-co : Set image contrast (-100 to 100)
-br : Set image brightness (0 to 100)
-sa : Set image saturation (-100 to 100)
-ISO : Set capture ISO
-vs : Turn on video stablisation
-ev : Set EV compensation
-ex : Set exposure mode (see raspistill notes)
-awb : Set AWB mode (see raspistill notes)
-ifx : Set image effect (see raspistill notes)
-cfx : Set colour effect (U:V)
-mm : Set metering mode (see raspistill notes)
-rot : Set image rotation (0-359)
-stats : Compute image stats for each picture (reduces noise for -usestills)
-drc : Dynamic range compensation level (see raspistill notes)
-hf : Set horizontal flip
-vf : Set vertical flip

The -rot parameter can rotate the image.


---

