Answer the question
In order to leave comments, you need to log in
How to display video camera in HTML?
Hey All!
it is required to implement a webcast
for work, it was advised to use NGINX-RTMP
, it is necessary to display the image through HTML5 without using Flash
, and here I ran into the question of
whether I understand correctly:
- NGINX-RTMP outputs video only in FLV format
- FLV is not viewed using HTML5, Flash is needed -player
If I'm wrong in my statement, then how to correctly configure the output of the stream from the camera in the format supported by HTML5?
what i use
nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1936;
application webcam {
live on;
}
}
}
ffmpeg -f video4linux2 -i /dev/video0 -f mpeg rtmp://localhost:1936/webcam
...
<video src="rtmp://localhost:1936/webcam"></video>
...
GET rtmp://localhost;1936/webcam net::ERR_UNKNOWN_URL_SCHEME
Answer the question
In order to leave comments, you need to log in
Turn on HLS in this module and it will be displayed normally. not a difficult procedure, just register a couple of parameters in the applet, including hls and specifying the folder where to throw it:
application vottehls {
live on;
hls-on;
hls_path /tmp/hls;
hls_fragment 5s;
exec_pull ffmpeg -i rtsp://address:554/Streaming/Channels/2 -c copy -f flv rtmp://localhost:1935/vottehls/st14;
}
in the WEB part of the config write something like:
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
Create a folder for this case, for example:
cd /tmp/
mkdir hls
chmod 777 hls
Restart nginx and start the stream, the RTMP applet will work and the files in the folder will start to come to life and the playlist file in the .m3u8 format and display it.
I also advise you to look towards the HTML5 version of the uppod player
very elementary, only the mobile menu needs to be finalized, otherwise it is completely clumsy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question