Using VLC, is it possible to encode from 30 to 40 webcams on one computer?

I am an IT guy for a small network of preschools. Each school talk has about 30-40 Axis IP webcams, ranging from older Axis 205,206 models to Axis M1011. These cameras allow parents to register on the website to view their classrooms for babies throughout the day. IP cameras are located on the local network and are broadcast on port 80. Each school has one public IP address, on which there is an HTTP server with a reverse proxy server. We directly serve MJPEG from Axis webcams, basically rewriting the URL to allow the client to view the application directly using Cam through the Axis API.

This worked great for years and even worked on the iPhone until recently. In fact, it still works on the iPhone, but only when connected to Wi-Fi. When iPhone is connected via 3G, the MJPEG stream no longer works. The carrier is AT & T.

I’ve done a lot of research in the last few days, and I know that I need to switch to HTTP Live Streaming for Apple devices, so I’m just trying to solve the various puzzle pieces that I have to solve this problem.

My combination of Axis cams can be a problem. The axes 205 and 206 are only MJPEG, but the M1011 can serve h.264, but apparently only through RTSP. I am ready to change the old Axis cameras to M1011, if necessary or useful for a general solution.

From my understanding so far, the first thing I need to figure out is to get my Axis M1011 h.264 (re) 30/40 streams encoded / marked as MPEG-2 files (.m3u8 and .ts).

Question number 1

Is it possible and / or possible to install one computer with a "batch" VLC command line file to start and encode 30 to 40 input streams coming from Axis webcams to MPEG-2, ready for iPhone service? I'm curious about stability, hardware requirements, etc., to handle many webcams. The same computer will have an HTTP server (possibly IIS) and a public IP address, so there is no need to receive MPEG-2 files further than the local computer.

Question number 2

For older Axis models (205, 206), which are only for MJPEG, can VLC be used to encode them in MPEG-2? Do I correctly assume that (re) encoding or repackaging .h264 in MPEG-2 is much less "working" than encoding MJPEG in MPEG-2, or is it about the same amount of CPU, etc.? I installed the latest version of Videolan, and it was easy enough to connect to the Axis M1011.h264 stream via the RTSP URL, so I know it works a lot.

Question number 3

Can anyone use any specific command lines or VLC configurations for both sides of my configuration: Axis M1011.h264 and / or Axis MJPEG as input, and for output - MPEG-2 files (.m3u8 and .ts) , "tagged" in size as required by the Apple iPhone, especially when connecting to 3G.

Question number 4

Finally, if someone has a different approach suggested (another encoder, Media Server, which will work better, etc.), I would also like to hear these suggestions.

+4
source share
2 answers

If you have enough network capabilities to receive the input stream, and enough CPU and RAM power for encoding, this is possible. When using the same machine for multiple instances of vlc or ffmpeg, there are no usage restrictions.

If you have a camera with an input of 512 kbps for 30 streams, you need a network 30x512 = 15 Mbps, which should be quite normal for a modern machine.

The hard part gets 30 transcodes for the iPhone. The output is an MPEG2 TS container, but inside it must have mpeg4 or h.264 encoded content. H.264 encoding is expensive, but requires less bandwidth for the same quality in MPEG4 [ballpark ~ 30% less]

Assuming that you are comfortable viewing 320x240, which for decent quality with mpeg4 should be of decent quality with an output of 256 Kbps. For h.264, you can switch to 192 kbps [base line for 3GS and below]

The problem now is that you have horsepower for transcoding. This is how you check

Take one video file representing your input. Check the input frame rate. Recode it to the result you need. Check the fps you get from ffmpeg for encoding. Pay attention to short-term input speed. Remove 5-10% to handle multiple simultaneous threads. this is the maximum that you get on your machine.

ffmpeg can receive input from an http or rtsp source and produce output that is segmented. See for an understanding of how to use ffmpeg to create segments. You still need to write a small program to create m3u8 files, which I think.

There is nothing trivial here, but you will like it. It can be done.

EDIT: Another thing, you only need to transcode when someone views it. Therefore, at the moment, if someone is not viewing 10 cameras, you do not need to do these transcodes. Therefore, perhaps you should first find out statistically how many cameras are being viewed at a given time. Look at your story. Then you need a less powerful car.

EDIT: if you can handle some programs instead of the command line, look: this

+2
source

ffmpeg may be an alternative for you. This is a cross-platform-based command line, and you can control the quality, format, and stream. The quality of encoding / re-encoding mainly controls the processing speed of your application, so you need to get the bandwidth to extract data from the loop.

+1
source

Source: https://habr.com/ru/post/1433604/


All Articles