Configure rotation
This guide shows you how to correct the image orientation on an Axis camera.
Prerequisites
You need:
- An Axis camera:
<ip>to replace in commands - Camera user credentials with operator or administrator privileges:
<user>and<pass>to replace in commands ffplayandcurl
How to check if the rotation is correct
View the live stream to verify the current orientation:
ffplay -rtsp_transport http "rtsp://<user>:<pass>@<ip>/axis-media/media.amp?camera=1"
How to use auto rotation
Some devices can automatically determine their rotation. Check if the parameter ImageSource.I0.AutoRotationEnabled exists:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=list&group=ImageSource.I0.AutoRotationEnabled"
If the parameter doesn't exist, it returns:
# Error: Error -1 getting param in group 'ImageSource.I0.AutoRotationEnabled'
If it does exist, it shows whether it's enabled:
ImageSource.I0.AutoRotationEnabled=yes
To enable auto rotation:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=update&ImageSource.I0.AutoRotationEnabled=yes"
To disable auto rotation:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=update&ImageSource.I0.AutoRotationEnabled=no"
How to set rotation manually
Check current rotation
Read the current rotation value from ImageSource.I0.Rotation:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=list&group=ImageSource.I0.Rotation"
Example output:
ImageSource.I0.Rotation=0
Check available rotations
The image source only supports fixed rotation values. Read the list of supported values:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=list&group=Properties.Image.Rotation"
Example output:
Properties.Image.Rotation=0,90,180,270
Update the rotation
Set the rotation for the first image source to 90 degrees:
curl -s --anyauth -u '<user>:<pass>' "http://<ip>/axis-cgi/param.cgi?action=update&ImageSource.I0.Rotation=90"
This returns OK. Verify the result by viewing the stream again:
ffplay -rtsp_transport http "rtsp://<user>:<pass>@<ip>/axis-media/media.amp?camera=1"