Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.
A linux server, such as Ubuntu
Apache web server installed, running, and reachable via its ip address
Latest version of Ffmpeg installed
An ip camera that is reachable from the server
Get root access.
sudo su
Make a new directory in /dev/shm. This is crucial because we will be constantly writing files and do not want to target the hard drive.
mkdir /dev/shm/mpeg-dash
Create a symlink from /dev/shm/mpeg-dash to the public directory where apache serves files.
ln -s /dev/shm/mpeg-dash /var/www/html
Create an html file that contains the necessary code to display the mpeg-dash video.
cat > /var/www/html/mpeg-dash/index.html << EOF
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.dashjs.org/latest/dash.all.min.js"></script>
<style>
video {
width: 640px;
height: 480px;
}
</style>
<body>
<div>
<video data-dashjs-player autoplay controls src="manifest.mpd" type="application/dash+xml"></video>
</div>
</body>
</html>
EOF
Run ffmpeg with the correct parameters to connect to your ip camera and generate the mpeg-dash video files.
ffmpeg -i rtsp://ip_cam_address:554/user=user_password=password_channel=1_stream=0.sdp -an -c:v copy -b:v 2000k -f dash -window_size 4 -extra_window_size 0 -min_seg_duration 2000000 -remove_at_exit 1 /var/www/html/mpeg-dash/manifest.mpd
Open an mpeg-dash compatible browser such as Chrome, Firefox, Safari, or IE11(Windows 8+ only).
Enter the address to the directory on your server. http://YOUR_SERVER_IP_ADDRESS/mpeg-dash/
in my case it is not giving any output. gets stuck.