Видеотрансляция
Перейти к навигации
Перейти к поиску
add-apt-repository ppa:jonathonf/ffmpeg-4
HLS:
ffmpeg -fflags nobuffer \ -use_wallclock_as_timestamps 1 \ -rtsp_transport tcp \ -i "rtsp://" \ -fflags "+igndts +genpts" \ -avoid_negative_ts "make_zero" \ -vsync 0 \ -copyts \ -vcodec copy \ -movflags frag_keyframe+empty_moov \ -an \ -hls_flags delete_segments \ -f hls \ -segment_list_flags live \ -hls_time 1 \ -hls_list_size 3 \ -segment_format mpegts \ -segment_list /srv/stream/index.m3u8 \ -segment_list_type m3u8 \ -segment_list_entry_prefix /stream/ \ /srv/stream/index.m3u8
HTML01:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
</head>
<body>
<video-js id="my_video_1" class="vjs-default-skin" controls preload="auto" width="704" height="576">
<source src="/stream/index.m3u8" type="application/x-mpegURL">
</video-js>
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
<script>
var player = videojs('my_video_1');
</script>
</body>
</html>
HTML02:
<html>
<head>
<title>Заголовок</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script>
<video id="video"></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('/stream/index.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
</script>
DASH
DASH:
ffmpeg \ -use_wallclock_as_timestamps 1 \ -i "rtsp://" \ -fflags "+igndts +genpts" \ -avoid_negative_ts "make_zero" \ -an -c:v copy \ -b:v 2000k \ -f dash \ -window_size 5 \ -extra_window_size 0 \ -min_seg_duration 2000000 \ -remove_at_exit 1 /srv/stream2/manifest.mpd
HTML01
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
</head>
<body>
<h1>Video.js Example Embed</h1>
<video-js id="my_video_1" class="vjs-default-skin" controls preload="auto" width="704" height="576">
<source src="/stream2/manifest.mpd" type="application/dash+xml">
</video-js>
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
<script>
var player = videojs('my_video_1');
</script>
</body>
</html>
HTML02
<!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="/stream2/manifest.mpd" type="application/dash+xml"></video>
</div>
</body>
</html>