OpenWrt Forum Archive

Topic: What setup for dedicated video streaming?

The content of this topic has been archived on 17 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.


I am curious to know, if anyone has done any OpenWRT benchmarking for remote video streaming from a UVC webcam over LAN. I'm talking about things like CPU usage, memory usage and bandwidth requirements vs video format, resolutions and framerate. There's also a question what software to use for streaming (i.e. mjpg_streamer, ffserver and gstreamer).

Thing is I have a number of DIY surveillance cameras (TP-Link TL-MR2030, WR703n, VoCore, SoM9331, etc) that have mostly limited resources so I'd like to minimize the CPU/memory usage and bandwidth, but keep a reasonably good video quality, resolution and frame rate. I'll be streaming on a 10/100 Ethernet to a dedicated linux video capture server.

Thanks in advance!

You have to choose between CPU usage or bandwidth.

The problem of routers to broadcast video signal is it isn't fast enough to use a good video encoding format (like h264 / mp4).

Most routers are only capable of broadcast usb webcam video using mjpeg (one jpg per frame). It's a waste of bandwidth, but the router simply can't encode in a better video codec in real time.

Not the answer you may be looking for … 150930.pdf
See page 5.  This is about a 50% or more boost in resources over the devices that have been made in the past.
Not available today, but supposedly shortly.

So, can you better quantify from experience what you get now on what device, and what you consider good? 
What are you using for cameras?

Just for reference this is the gl.inet camera that should work with their firmware (they have this configured already for camera support, but what it does I do not know) … rettyPhoto[product-gallery]/2/  Unfortunately they do not state FPS.

Bleh! So technically it means that transcoding is out of the question for existing hardware and that in turn means that I can either use mjpeg with current webcams or get a better camera that supports x264 output by default. And to lower bandwidth I can also reduce the frame rate and the resolution.

From technical perspective, how powerful of a CPU would I need to do transcoding to x264 for a full HD resolution with 30 fps? Would a Raspberry Pi be able to handle it. What about an Allwinner A20 device like a Cubieboard or PcDuino3?


So technically it means that transcoding is out of the question for existing hardware

I did not say that, but I believe I have read it elsewhere on the forum

how powerful of a CPU would I need to do transcoding to x264 for a full HD resolution with 30 fps?

I expect that there is a level at which the transcoding will not work at all, but at some point it's going to be a matter of speed. … Bench.html … p;oe=utf-8

I think you want a real PC for this, but you should ask in the respective forums.  I do not think you will get a good answer here.  Not a broad enough base.  This is one of the more powerful devices (embedded) for OpenWRT, but it will only run one core on the firmware.

On my APU I run voyage, which is a downsized debian. Works like a charm. Very solid HW.,  Also has the advantage to have access to newest (debian-) drivers, like for LTE-modem etc. So, for more CPU-/RAM-demanding apps a very good choice.

As luck would have it, I just happen to have that exact device in my possession, although I am planning to use it as my main gateway/firewall/IPS with pfSense on it. the video capturing server hardware is not an issue, but unfortunately I cannot use such large boards for tiny surveillance cameras. I'll run some tests to see how far I can push software transcoding in regards to video resolution and frame rate on existing hardware, but I also found an interesting camera module that supports h264 output by default. … 67763.html

Hello again.

I have managed to perform some benchmarking, if anyone is interested. I've used a USB UVC HD camera module from AliExpress (search for "usb camera module" and you'll find camera chips on a PCB), but I suppose an appropriate webcam should also apply here. I tested it on a TP-Link TL-MR3020 router (4M flash, 32M RAM, ar9331@400MHz) with OpenWRT CC on it. As an addition I had to install mjpg-streamer and kmod-video-uvc packages. Next I connected the router to a laptop via two ethernet cables and a gigabit switch in-between.  Finally, I ran mjpg-streamer from command line via a serial shell and passed on various parameters to the input module. While the program was running I opened firefox on the laptop and pointed it towards the IP of the router so that the video stream was displayed.

The bandwidth was measures using iptraf on the laptop and cpu/memory was measured on the router itself via a serial cable by using the "top" command. During measurements I moved the camera around a bit from dark to light places and from places with no motion (wall) to heavily swinging the camera around to get lots of "motion". Meanwhile I measured the minimum and maximum values I could get on the counter. Here are the results:

Resolution: 640x480

  • FPS = 1, CPU = 10 - 20%, mfree = 11.8k, BW = 36 - 56 kB/s

  • FPS = 5, CPU = 3 - 3%, mfree = 11.7k, BW = 130 - 290 kB/s

  • FPS = 10, CPU = 5 - 20%, mfree = 11.7k, BW = 280 - 580 kB/s

  • FPS = 20, CPU = 14 - 24%, mfree = 11.7k, BW = 560 - 1120 kB/s

  • FPS = 30, CPU = 10 - 27%, mfree = 11.8k, BW = 690 - 1440 kB/s

Resolution: 800x600

  • FPS = 1, CPU = 4 - 12%, mfree = 10.3k, BW = 36 - 110 kB/s

  • FPS = 5, CPU = 2 - 12%, mfree = 10.1k, BW = 200 - 450 kB/s

  • FPS = 10, CPU = 3 - 9%, mfree = 10.3k, BW = 400 - 970 kB/s

  • FPS = 20, CPU = 5 - 21%, mfree = 10.2k, BW = 650 - 1540 kB/s

  • FPS = 30, CPU = 9 - 20%, mfree = 10.3k, BW = 1025 - 2210 kB/s

Resolution: 1280x720

  • FPS = 1, CPU = 1 - 11%, mfree = 6.7k, BW = 75 - 120 kB/s

  • FPS = 5, CPU = 6 - 14%, mfree = 6.6k, BW = 420 - 560 kB/s

  • FPS = 10, CPU = 10 - 20%, mfree = 6.7k, BW = 785 - 1080 kB/s

  • FPS = 20, CPU = 12 - 27%, mfree = 6.4k, BW = 1250 - 1920 kB/s

  • FPS = 30, CPU = 19 - 32%, mfree = 6.5k, BW = 1600 - 3200 kB/s

Resolution: 1280x1024

  • FPS = 1, CPU = 2 - 9%, mfree = 3.4k, BW = 120 - 240 kB/s

  • FPS = 5, CPU = 9 - 14%, mfree = 3.5k, BW = 640 - 1060 kB/s

  • FPS = 10, CPU = 14 - 19%, mfree = 3.6k, BW = 1230 - 1850 kB/s

  • FPS = 20, CPU = 18 - 27%, mfree = 3.7k, BW = 1800 - 1780 kB/s

  • FPS = 30, CPU = 20 - 29%, mfree = 3.7k, BW = 1940 - 3100 kB/s

Resolution: 1920x1080

  • FPS = 1, CPU = 6 - 11%, mfree = 1.1k, BW = 180 - 250 kB/s

  • FPS = 5, CPU = 9 - 13%, mfree = 1.0k, BW = 760 - 1140 kB/s

  • FPS = 10, CPU = 10 - 17%, mfree = 1.2k, BW = 1440 - 1915 kB/s

  • FPS = 20, CPU = 14 - 21%, mfree = 0.9k, BW = 1600 - 2320 kB/s ***

  • FPS = 30, CPU = 17 - 26%, mfree = 0.9k, BW = 1680 - 2700 kB/s ***

Notice: I skipped the 1024x768 resolution because I had some problems with auto-lighting, as the camera didn't automatically adjust to the proper exposure. This only happened at resolution 1024x768, all others worked properly.

Comments: CPU usage was very low throughout the tests. Memory usage apparently increased with the resolution, but not the frame rate. The bandwidth increased with resolution as well as framerate and seems like very high for some streams. I've noticed that the bandwidth didn't increase proportional to the amout of motion applied to the camera. Instead it seemed to be dependent on what kind of surface the camera was recording i.e. a single-color plain wall showed the lowest bandwidth requirements while a heavily painted door (lots of pictures and graffiti) gave the highest results. In addition, most settings seem to perform quite well except at the final two measurements (full-hd resolution @ 20 to 30 fps) which gave a bit choppy playback (some frames were dropped and the video wasn't smooth). *** These tests were performed on mjpg-streamer with MJPG video format that the camera supported. I also wanted to perform benchmarks with ffmpeg/ffserver and gstreamer, but it would appear that the router does not have sufficient flash memory space to support these applications.

Conclusion: Apparently MJPEG truly is a waste of bandwidth, so if you plan to stream high resolution/framerate MJPEG from many cameras, perhaps get a secondary set of ethernet cables that are exclusively used for video streaming, so that your daily browsing habits/downloads don't interfere with the video stream. Either that or get some other camera that is capable in streaming in a better format i.e. h264. I have yet to test transcoding from YUYV/MJPEG to h264 on a more powerful hardware and compare the results.

Best regards,
~ Fragment

Thanks for this very interesting and valuable information!

Some questions:

1) What USB VID:PID does this camera module have?
2) Have you tested this module with fswebcam (stillpictures for timelapse)?
3) Does this work with fswebcam at 1920x1080?
4) At 1920x1080: Are there any error messages in the logs when the stream is choppy?
5) There are lots of different cameramodules when I search on aliexpress. Can you point out the one you have?

Thank you Fragment, I think your benchmark results should be added to OpenWRT wiki.

A idea to save bandwith (without use h264) could be the next:
-In webcams for surveillance purposes a simple method to save bandwith could be a "motion detector", i.e: a process comparing pixels of the frames that it only send new frames when a significant number of pixels change from one frame to the next frame.

The package of "ffmpeg" is available in openwrt to test encoding speed (with low resolution and low frame rates could be useful). Also, I going to test x264 in OpenWRT (in AR9331 based routers).

(Last edited by KHAN85 on 19 Oct 2015, 00:19)


I tried to do some more tests on the same hardware, but with a different camera. This time I used my Logitech HD Pro C920 webcam (vid=046d, pid=082d). While the camera mostly worked, I've had a lot of problems running it on the mr3020 router. A lot of times the playback in the browser was very choppy (***) and there were frequent frame drops at certain resolutions/framerates while other settings appeared to work fine. In particular I've found out that the camera had particularly difficult time recording the painted graffiti door that I recorded in previous tests (it resulted in highest bandwidth).

While turning the camera across the room I got mostly nice results, but when I pointed it towards the painted door, the frame rate plummeted and the camera simply stopped recording. However when I pointed it away from the door, it started responding again. I've also seen some artifacts on the screen when the camera was quickly moved from a dark place to a very bright light source and vice-versa. Finally, I was unable to get a satisfactory frame rates with the full HD resolutions. At one point the software even segfaulted, so the results aren't included.

Resolution: 640x480

  • FPS = 1, CPU = 0 - 10%, mfree = 12.3k, BW = 28 - 81 kB/s

  • FPS = 5, CPU = 0 - 10%, mfree = 11.9k, BW = 89 - 270 kB/s ***

  • FPS = 10, CPU = 1 - 9%, mfree = 12.5k, BW = 220 - 930 kB/s

  • FPS = 20, CPU = 1 - 11%, mfree = 12.3k, BW = 440 - 1260 kB/s

  • FPS = 30, CPU = 5 - 16%, mfree = 12.4k, BW = 960 - 1360 kB/s

Resolution: 800x600

  • FPS = 1, CPU = 3 - 10%, mfree = 10.9k, BW = 30 - 110 kB/s

  • FPS = 5, CPU = 0 - 3%, mfree = 10.5k, BW = 129 - 330 kB/s ***

  • FPS = 10, CPU = 5 - 10%, mfree = 11.0k, BW = 320 - 1120 kB/s

  • FPS = 20, CPU = 6 - 16%, mfree = 11.0k, BW = 600 - 1270 kB/s

  • FPS = 30, CPU = 10 - 20%, mfree = 10.9k, BW = 700 - 1930 kB/s

Resolution: 1280x720

  • FPS = 1, CPU = 1 - 10%, mfree = 7.1k, BW = 70 - 200 kB/s ***

  • FPS = 5, CPU = 5 - 8%, mfree = 7.0k, BW = 275 - 1010 kB/s

  • FPS = 10, CPU = 0 - 12%, mfree = 6.9k, BW = 385 - 1860 kB/s

  • FPS = 20, CPU = 9 - 27%, mfree = 6.9k, BW = 1000 - 2400 kB/s

  • FPS = 30, CPU = 10 - 27%, mfree = 6.9k, BW = 1070 - 1900 kB/s ***

Resolution: 1920x1080

  • FPS = 1, CPU = 2 - 10%, mfree = 0.9, BW = X ***

  • Not performed due to extremely poor response and performance.

tmo26 wrote:

1) What USB VID:PID does this camera module have?
2) Have you tested this module with fswebcam (stillpictures for timelapse)?
3) Does this work with fswebcam at 1920x1080?
4) At 1920x1080: Are there any error messages in the logs when the stream is choppy?
5) There are lots of different cameramodules when I search on aliexpress. Can you point out the one you have?

1) The one I used in my first tests was vid=05a3, pid=9230.
2) No, but I take it that the module should work with fswebcam without any problems, as it supports UVC.
3) I haven't tested it, but the camera supports full HD, so I'm guessing it should.
4) I didn't see any.
5) I don't know exactly. It's a HD module I bought from Ailipu Tech, and it doesn't support h264.

KHAN85 wrote:

Thank you Fragment, I think your benchmark results should be added to OpenWRT wiki.

I think these tests are too specific to be of any value to the Wiki, but you can at least see how much bandwidth the MJPG stream eats up. I'll see, if I can get some more results by using other codecs for comparison.

Best regards,

I too have several webcams (C920's and others) that I'm using with mjpg-streamer, and I'd love to somehow get them to  use h264 instead.

I don't think there's an easy way to stream h264 directly from cameras that natively support it with OpenWrt, which is a shame. For legacy cameras it'd be great to be able to at least do software encoding at a really low framerate (e.g. 1-2 fps), though I'm not sure if that's possible on a router.

For h264 encoding you'd probably have to use something like a raspberry pi because AFAIK it has hardware h264 encoding although I'm not sure it's well supported.

(Last edited by Magnetz on 5 Nov 2015, 23:22)

Hi Fragment,
  Thank you for your experiment data & info.  I followed the site you provided and purchased the same module, ELP-USBFHD01M w/ vid=05a3, pid=9230, as you did, but I can't set the fps to 1, 3 or 5 for 640x480 or 320x240. It always reset it to 60 or event 120.1 fps after my setting w/ mjpg_streamer or v4l2-ctl.

  Could you instruct me how you configure the frame rate per sec for this module?
By the way, I also bought a AR0330 H.264 module, but it only provides "-r" option to record it to local storage media and has no options to stream it out.

The discussion might have continued from here.