Download rtmp live stream based on electron and ffmpeg

background

Use electron to encapsulate a downloader, and the bottom layer uses ffmpeg to download the live stream.

Support the merge function of single download files.

technology

  • electron
  • ffmpeg
  • child_process.spawn
  • electron-packager

core

Bale

Use electron-packagerto package

{
    
    
    "package": "electron-packager ./"
}

test

You can use the nginx rtmp plug-in to forward the stream

Specific placement: https://www.jianshu.com/p/cf74a34af15d

rtmp {
  server {
    listen 1935;

    application rtmplive {
        live on;
        max_connections 1024;
    }
    application hls {

        live on;
        hls on;
        hls_path /usr/local/var/www/hls;
        hls_fragment 1s;

   }

  }

}

Then use ffmpeg to push the stream

ffmpeg -re -i [你的视频文件的绝对路径] -vcodec copy -f flv rtmp://localhost:1935/abcs/room

Then use the client to download the stream.

Screenshot

Insert picture description here

github

https://github.com/bosscheng/electron-download

Guess you like

Origin blog.csdn.net/wancheng815926/article/details/105953527