Node-media-server win environment installation frame test stepping pit record

01

  Because the teacher’s project needs a lot of streaming media modules, I came into contact with Node-Media-Server, a streaming media server, a component developed by the Chinese, and SRS before it. Record the problems and effects.
  The notebook is win7, and there was a problem with the version of nodejs before. Here is a song , when win7 installs nodejs, it will pop up a pop-up reminder because of the version problem: Insert picture description here
  I just encountered this point for the first time, and everyone has other problems. I didn’t see it either. After checking it, I learned that the version above v12.16.2 does not support win7, so I found the 12.16.2 version.

官网:https://nodejs.org/en/download/
win7 安装版:https://nodejs.org/dist/v12.16.2/node-v12.16.2-x64.msi
win7 便携配置版:https://nodejs.org/dist/v12.16.2/node-v12.16.2-win-x64.zip

Direct installation means normal installation, and portable configuration means that after decompressing like tomcat, you can configure the environment variables to use. The installation is that he configures the path environment variable himself, and installs the npm management tool by the way. There are two types of tutorials, and one search can have them.

02

1. The node-media-server streaming media server is used to convert the stream format or do some operations on the video stream and push the stream address out.

2. ffmpeg push streaming tool, push the video or video stream you need to convert to the streaming media server, this step is the push streaming.

3. Pulling the stream means pulling the video stream from the streaming media server and playing it in a player such as vlc with a fixed format url. Playing with a video player means pulling the stream.

03

node-media-server is developed based on nodejs and needs to be installed with npm first. However, I had a lot of problems in this step, which wasted time.

01 First execute his installation command under cmd

npm install node-media-server

From then on, I have a problem.
(https://img-blog.csdnimg.cn/20210312173459959.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3B1YmxpY3N0YXRpY2ZpbmFs,size_16,color_FFFFFF,t_70#pic_center)
There is no formal tutorial on hand, and there are almost no tutorials for downloading in win. I found out that there is no such package.json. Various attempts to push to the C drive, execute again under the root of D drive, execute under the root directory of nodejs, and execute under nodejs\node_module still have this problem.

The sentence I found npm init -f did not work even after execution.
Insert picture description here
Try npm install node-media-server -g, but also try npm install node-media-server-save, and = just solve the various searches. Try the commands back and forth, switch back and forth to the mentioned directories and keep trying these commands.
Each time it is executed, the installation progress changes, almost the same.

However, an unexpected surprise happened

Suddenly I took a look at my nodejs/node_module directory. There have been many changes and many more things. When nodejs was installed before, there was only the npm folder. Now as shown in the figure, there are
Insert picture description here
many more folders, including node-media-server of course. I discovered how to install nms suddenly. The inexplicable ones were installed, and they were hit and hit by mistake.

It is suspected that the description in this post has worked

https://segmentfault.com/q/1010000012930521

04

The configuration file app.js of nms streaming media server
Insert picture description here

app.js
const NodeMediaServer = require('node-media-server');
This is the initial display of the app.js file
Then change the first line of const NodeMediaServer = require('./'); the file in quotation marks to node-media-server.
Go to the nms directory, execute node app.js
Insert picture description here
and the result shown above is the startup success. Because the 8000 port is configured for http in app.js, so here is to use
localhost:8000/admin to access. The login page account and password are both admin (of course, this is configurable in the app.js file).
Insert picture description here
This is to access the homepage. By default, the machine is configured with memory and other tests. To exit the visit, press ctrl+c under cmd.
Some parts are similar to toncat

At this point , the local installation and deployment of node-media-server plus access to the homepage are successful.

05

The next step is to test push and then pull (play) the local machine's video and audio files.
There are many ways to push streaming, here I use the ffmpeg tool, process tutorials are available, searchable. Here is the result of playing with vlc (media-open network stream-input url).
Insert picture description here
Note that here, a section of the readme file in nms should be added to the ffmpeg configuration to set the push and pull
Insert picture description here
ffmpeg configuration as shown in the figure.
Insert picture description here

06

Next, install nms to the remote server, windows server r2 2012, using win's mstsc to operate remotely.
Because nodejs has been installed for this before, the following figure is the version,
Insert picture description here
so I started to install nms directly, but it is always the problem as shown in the figure. I tried similar methods in my local, but it didn't work. So again
Insert picture description here
, the methods in the following posts have been tested, but they still failed

https://segmentfault.com/q/1010000012930521
http://www.bubuko.com/infodetail-2742157.html

I feel that this thing is not so common, and there are not many tutorials that make mistakes. I will do this first, and then I will look at it later.

Guess you like

Origin blog.csdn.net/publicstaticfinal/article/details/114700106