When ZLMeidiaKit implements streaming (FFmpeg pushes rtmp stream), it is rejected when it is not 127.0.0.1 and requires authentication.

Scenes

The open source streaming media server ZLMediaKit runs on Windows, configures it, pulls the stream on demand (pulls the camera rtsp video stream) and uses the http-flv webpage to play:

The open source streaming media server ZLMediaKit runs on Windows, configures it, pulls the stream on demand (pulls the camera rtsp video stream) and uses the http-flv webpage to play_Overbearing Rogue Temperament Blog-CSDN Blog

On the basis of building ZLMediaKit above.

ZLMediaKit implements Rtmp streaming server on Windows and simulates rtmp push and http-flv pull:

ZLMediaKit implements Rtmp streaming media server on Windows and simulates rtmp push and http-flv pull stream playback - Programmer Sought

Use FFmpeg to implement rtmp simulation streaming.

But the address when streaming is 127.0.0.1

ffmpeg.exe -re  -stream_loop -1 -i D:\2.mp4 -vcodec libx264 -acodec aac -f flv rtmp://127.0.0.1:1935/hls/123456123_2
pause

However, if 127.0.0.1 is changed to the actual IP address, the streaming will fail due to the default authentication.

Note:

Blog:
https://blog.csdn.net/badao_liumang_qizhi 

accomplish

1. If authentication needs to be retained, pass the sercet parameter when streaming.

ffmpeg.exe -re -i D:\test\1.mp4 -vcodec libx264 -acodec aac -f flv rtmp://10.229.36.31:1935/hls/123456123_0?secret=8725c73f7-bb6b-4889-你自己的sercet

The location of the secret is as follows:

 

2. Turn off the authentication when streaming

We push the stream to the ZLM streaming media server. To use authentication, the HOOK of the ZLM service must be enabled, and enable must be set to 1 in the configuration file.

[hook]
admin_params=secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
enable=0
on_flow_report=
on_http_access=
on_play=
on_publish=http://127.0.0.1:18080/index/hook/on_publish
on_record_mp4=
on_record_ts=
on_rtsp_auth=
on_rtsp_realm=
on_server_started=http://127.0.0.1:18080/index/hook/on_server_started
on_shell_login=http://127.0.0.1:18080/index/hook/on_shell_login
on_stream_changed=http://127.0.0.1:18080/index/hook/on_stream_changed
on_stream_none_reader=http://127.0.0.1:18080/index/hook/on_stream_none_reader
on_stream_not_found=http://127.0.0.1:18080/index/hook/on_stream_not_found
timeoutSec=20

Therefore, changing the enable of the hook to 0 can directly push the stream without passing the secret parameter.

 

 

3. Follow the official streaming authentication process

Self-implementation, no longer implemented here.

ZLMediaKit implements streaming authentication · ZLMediaKit/ZLMediaKit Wiki · GitHub

 

 

Supongo que te gusta

Origin blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/130306830
Recomendado
Clasificación