Motion - Mjpeg Proxy Resizer Recompressor CGI

Python MJPEG Proxy, resizer and recompression CGI


This CGI proxy can resize and recompress a mjpeg stream. It is very handy when you have webcams or streaming softwares like motion.

Sometimes you need to record the stream using a big size not suitable for streaming over the net. Other times you need a proxy because the webcams are deep into your local lan. This software solves both problems at once using a web sever as front door.


You can download the software from:

Direct link to 0.0.1 version: (Unix) (Windows)

Setting it up

This software is made in Python, you can download it from:

You will need an aditional library installed on your system, it is called Python Image Library; you can get it from here:

This proxy is a CGI, so you will need a web server to run it. It will work on any know web server as long as it supports the CGI interface (Almost every web sever supports it).

CGI Parameters

This is the list of parameters that configure the CGI. Please write them in lowercase. You can check some examples at the end of the list.

The current parameter list is:

host="localhost", port=8080, width=352, height=288, quality=80, frames=0, resize="NEAREST", optimize=True, progressive=True, smooth=True, buffer_rx=131072, buffer_tx=65536, timeout=60

host Default: localhost Required

The proxy will connect to this hostname, it expects to find a MJPEG server on that hostname.

port Default: 8080 Required

The proxy will connect to this port, it expects to find a MJPEG server on that port.

width Default: 352 Optional

The width of the resized MJPEG stream.

height Default: 288 Optional

The height of the resized MJPEG stream.

quality Default: 80 Optional

The quality of the recompressed MJPEG stream. Lower numbers mean more JPEG compression and less file size, less image quality too.

frames Default: 0 Optional

Number of frames to serve before closing the connection. Use 0 to serve frames continuously.

resize Default: NEAREST Optional

This setting configures the resizing filter. There are four types of filters:

ANTIALIAS Best results - More CPU
NEAREST Worst results - Less CPU

optimize Default: 1 Optional

This boolean setting enables or disables the JPEG file size optimization.

progressive Default: 1 Optional

Setting this to True (1) creates progressive JPEGs, standard JPEGs are created when it is set to False (0).

smooth Default: 1 Optional

Smooth the output JPEG when set to True (1), does not smooth the output when setting to False (0).

buffer_rx Default: 131072 Optional

The receive buffer in bytes, it is better to keep this value high.

buffer_tx Default: 65536 Optional

The transmit buffer in bytes, keep this value moderately high.

timeout Default: 65536 Optional

The timeout when connecting to the MJPEG server.

showconf Default: Optional

If this option is present, the CGI will show you the active configuration.


Basic example, hostname and port to connect to:


Set the MJPEG server host and port and resizing size:


Resize using antialiasing:


Resize using antialiasing and no smooth, serve only 128 frames:


Looking the current configuration, just append &showconf=1:


Comments and Bug Reports

The documentation has errors , it took me hours of trying different combinations to make it work and when It did it had decode errors like crazy, all in all not usable. Now the links are all dead anyway

-- JimAnthony - 14 Feb 2007

Someone who can post this file anywhere? I would appreciate it very much!

-- MartijnBakker - 11 Feb 2008

RelatedProjectsForm edit

ProjectSummary This CGI proxy can resize and recompress a mjpeg stream.
ProjectStatus Stable
ReleaseVersion 0.0.1
ProjectSubmitter JuanCarlosRodrigo
Topic revision: r4 - 11 Feb 2008, MartijnBakker
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.