当前位置:网站首页>Playing RTSP streaming video on Web pages (webrtc)
Playing RTSP streaming video on Web pages (webrtc)
2022-06-26 06:08:00 【Qi_ z】
The environment required
node.js + FFmpeg
In this way, the client only needs to pass video Label can be played
ffmpeg download link :https://pan.baidu.com/s/1ntOVSpxmtHO861V-dT5Kyg?pwd=nx7y
Extraction code :nx7y
FFmpeg Environmental installation
1. install FFmpeg Dependence yasm
yum Way to install yasm, It can also be done through Download - The Yasm Modular Assembler Project Download and install
yum install yasm -y
# compile
./configure
# install
make && make install
2. install FFmpeg
wget obtain ffmpeg, It may not download , It is suggested to use the ffmpeg-4.1.8.tar.bz2 Manually upload to the server
wget https://ffmpeg.org/releases/ffmpeg-4.1.8.tar.bz2
# decompression
tar -xjvf ffmpeg-4.1.8.tar.bz2
# Go to unzip directory
cd ffmpeg-4.1.8
# compile
./configure
# install
make && make install
3. Verify that the installation was successful
Input ffmpeg command , Check whether the console has output , If yes, it means installation ffmpeg success .
NodeJS Environmental installation
1. NodeJS The installation steps for are ignored ..
2. install rtsp2web plug-in unit
# Create a directory , Directory name cannot be rtsp2web, Enter the directory and execute the following command to install rtsp2web plug-in unit
npm init --yes
npm i rtsp2web
3. establish index.js, And run , Run the command node index.js
// index.js
const RTSP2web = require('rtsp2web')
// The port number occupied by the long connection of the server ; The port number can be customized
const port = 9999
new RTSP2web({
port
})
At this point, the video transcoding service installation is complete .
Here we provide Open rtsp flow Available for testing :
rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4
verification html Play live video
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no,viewport-fit=cover">
<script src="https://jsmpeg.com/jsmpeg.min.js" charset="utf-8"></script>
<title> Play rtsp</title>
</head>
<body>
<canvas id="canvas" style="width: 600px; height: 600px;"></canvas>
</body>
<script>
// Change it to yours rtsp flow
var rtsp = 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4'
window.onload = () => {
// location by node The service address where the service is located , Port is rtsp2web Set the port
new JSMpeg.Player("ws://localhost:9999/rtsp?url="+btoa(rtsp), {
canvas: document.getElementById("canvas")
})
}
</script>
</html>
Will be html copy Open it on the desktop to see the effect .
边栏推荐
- Sql语法中循环的使用
- 适配器模式
- Operator priority, associativity, and whether to control the evaluation order [detailed explanation]
- Level signal and differential signal
- Gram matrix
- MySQL-06
- C generic speed
- E-commerce seeks growth breakthrough with the help of small program technology
- Tortoise and rabbit race example
- Tencent's 2022 school recruitment of large factories started with salary, and the general contracting of cabbage is close to 40W!
猜你喜欢
Redis underlying data structure
Ribbon load balancing service call
How to use the tablet as the second extended screen of the PC
小程序第三方微信授权登录的实现
Bingc (inheritance)
卷妹带你学jdbc---2天冲刺Day2
E-commerce seeks growth breakthrough with the help of small program technology
Adapter mode
Pytorch (network model)
Redis底层数据结构
随机推荐
"= =" difference from "equals"
numpy. log
05. basic data type - Dict
Getting started with Python
Static proxy mode
Library management system
Adapter mode
工厂方法模式、抽象工厂模式
类和对象的学习
Tencent's 2022 school recruitment of large factories started with salary, and the general contracting of cabbage is close to 40W!
Overloading and overriding
Ribbon load balancing service call
Day4 branch and loop
Record how to modify the control across threads
[intra group questions semester summary] some reference questions for beginners
kolla-ansible部署openstack yoga版本
MySQL-07
04. basic data type - list, tuple
[C language] deep analysis of data storage in memory
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications