FFmpeg on the use of plug-flow, the understanding live directory

    According to previous blogger blog " in the windows set up, configure nginx streaming media server, and push the stream rtmp stream, pull flow test " build a good nginx streaming media server, there may be some friends have a blog there were plug-flow test instruction: "ffmpeg -i video3.mp4 -f flv rtmp : //127.0.0.1/live/test1" in the "live" Some do not understand. "Live" is actually a virtual directory, the directory and the windows in the traditional directory is not the same, it can be understood as a module flow path push of a streaming media server or virtual path, but the actual streaming media server is not exist this directory, because it is virtual. In fact, this directory is used to bypass the area, pledged to push the flow of address; plug-flow address is how much, how much you have to pull the stream address. Such as plug-flow instruction is "ffmpeg -i video3.mp4 -f flv rtmp: //127.0.0.1/live/test1", using ffplay instruction stream would have to pull "ffplay rtmp: //127.0.0.1/live/ test1 ", and the address can be seen pulling plug flow stream is the corresponding address.

    During the testing, it may also find some friends, when push flow instruction in "live" directory to another directory, plug flow will fail. For example input command at the command prompt: "ffmpeg -i video3.mp4 -f flv rtmp: //127.0.0.1/mydir/test1", plug flow will fail (but the input instruction "ffmpeg -i video3.mp4 -f flv rtmp: //127.0.0.1/live/test1 "can successfully plug flow) as shown below:

 

Cause of the problem is: push the stream directory is actually set in nginx configuration file, the default is "live". Change directory command plug-flow situation has not changed in the configuration file directory of plug flow, the flow will naturally push failed. As shown below, with a profile in nginx.conf nginx conf directory.

 

打开该配置文件,我们可以看到有“ application live ”这一行内容。该行表示nginx的推流虚拟目录为“ live ”。所以我们的推流指令格式就只能为:ffmpeg -i “文件名” -f flv rtmp://“nginx所在电脑的IP地址”/live/“推流子目录”。

 

要想在推流指令中使用其它推流目录,比如改为使用“ mydir ”。我们可以更改配置文件nginx.conf为如下所示:

 

更改配置文件后,重启nginx,在命令提示符中输入指令:“ ffmpeg -i video3.mp4 -f flv rtmp://127.0.0.1/mydir/test1 ”,我们发现推流成功了,如下图所示:

 

发布了54 篇原创文章 · 获赞 55 · 访问量 12万+

Guess you like

Origin blog.csdn.net/u014552102/article/details/103093607