It was decided to use FFmpeg and FFserver. Note. FFserver only works with Linux. The solution uses the python code from here , as suggested by Ryan .
The stream is as follows:
- Launch the FFserver background process using the desired configuration (mjpeg in this case).
- FFmpeg input - mmst stream, output stream to the local host.
- Run the python script to open the localhost stream and decode frame by frame.
Run ffserver
ffserver -d -f /etc/ffserver.conf
On the second terminal run, FFmpeg
ffmpeg -i mmst://194.90.203.111/cam2 http://localhost:8090/cam2.ffm
Python code. In this case, the code will open a window with a video stream.
import cv2, platform import numpy as np import urllib import os cam2 = "http://localhost:8090/cam2.mjpeg" stream=urllib.urlopen(cam2) bytes='' while True:
ffserver.config -
Port 8090 BindAddress 0.0.0.0 MaxClients 10 MaxBandWidth 50000 CustomLog - #NoDaemon <Feed cam2.ffm> File /tmp/cam2.ffm FileMaxSize 1G ACL allow 127.0.0.1 ACL allow localhost </Feed> <Stream cam2.mjpeg> Feed cam2.ffm Format mpjpeg VideoFrameRate 25 VideoBitRate 10240 VideoBufferSize 20480 VideoSize 320x240 VideoQMin 3 VideoQMax 31 NoAudio Strict -1 </Stream> <Stream stat.html> Format status # Only allow local people to get the status ACL allow localhost ACL allow 192.168.0.0 192.168.255.255 </Stream> <Redirect index.html> URL http://www.ffmpeg.org/ </Redirect>
Please note that ffserver.config requires more fine-tuning, but they work quite well and create a frame very close to the original one, with a slight freezing of the frame.
NoamR source share