rtsp://root:password@192.168.0.90:554/axis-media/media.amp?resolution=640x480&fps=25
Understanding Axis MJPEG Streaming via CGI Axis network cameras utilize the
# Convert MJPEG to H.264 for recording ffmpeg -i "http://root:pass@192.168.1.10/axis-cgi/mjpg/video.cgi?fps=15" \ -c:v libx264 -preset ultrafast -f mp4 output.mp4
One of the simplest ways to display an Axis MJPEG stream in a web application is using an HTML <img> tag. Browsers natively support MJPEG streams through the multipart/x-mixed-replace mechanism. axis cgi mjpg
Before the widespread adoption of H.264 and H.265, Motion JPEG (MJPEG) was the de facto standard for network video due to its simplicity and low computational overhead. Axis network cameras exposed a CGI (Common Gateway Interface) API, allowing HTTP clients to request MJPEG streams. The /axis-cgi/mjpg/video.cgi endpoint remains a critical feature for integration with legacy systems, custom applications, and low-latency requirements.
When a camera requires digest authentication, you cannot simply embed user:password@ in the URL. Instead, your HTTP client must handle the digest challenge-response handshake.
The most basic URL to request an MJPEG stream looks like this: rtsp://root:password@192
To enable this, send a parameter update request:
if not cap.isOpened(): print("Error: Could not open video stream.") exit()
This approach is convenient but sends credentials in plaintext (Base64-encoded, which is not secure). Always use HTTPS when implementing basic authentication in production. Axis network cameras exposed a CGI (Common Gateway
curl --request GET --anyauth --user "root:password" "http://192.168.0.90/axis-cgi/mjpg/video.cgi"
Almost all modern web browsers, media players, and coding languages can naturally parse a sequence of JPEG images. Disadvantages of MJPEG