一个基于 Go 语言的自动视频推流工具
Go to file
2024-11-20 18:41:02 +08:00
.github/workflows feat: log level config 2024-10-29 03:35:21 +08:00
config adjust: code structure 2024-10-29 17:11:14 +08:00
constant feat: log level config 2024-10-29 03:35:21 +08:00
logger adjust: code structure 2024-10-29 17:11:14 +08:00
model adjust: code structure 2024-10-29 17:11:14 +08:00
server prevent exiting program when close streamer 2024-11-20 18:41:02 +08:00
streamer prevent exiting program when close streamer 2024-11-20 18:41:02 +08:00
utils adjust: code structure 2024-10-29 17:11:14 +08:00
.gitignore feat: log level config 2024-10-29 03:35:21 +08:00
.goreleaser.yaml feat: log level config 2024-10-29 03:35:21 +08:00
docker-compose.yaml feat: log level config 2024-10-29 03:35:21 +08:00
Dockerfile adjust: code structure 2024-10-29 17:11:14 +08:00
go.mod feat: log level config 2024-10-29 03:35:21 +08:00
go.sum feat: log level config 2024-10-29 03:35:21 +08:00
LICENSE feat: log level config 2024-10-29 03:35:21 +08:00
main.go prevent exiting program when close streamer 2024-11-20 18:41:02 +08:00
README.md modify: README 2024-10-29 17:12:49 +08:00

Liver streamer

一个基于 Go 语言的自动视频推流工具。

功能特点

  • 🎥 支持自动循环推流指定文件夹中的视频文件
  • 🎮 提供 Web 控制面板实时监控推流状态
  • ⚙️ 灵活的视频编码和推流参数配置
  • 🎯 支持视频片段截取推流(指定开始和结束时间)
  • 🔄 支持手动切换当前推流视频

配置

示例

除了 input 和 output 部分,其余都是可选的

{
  "input": [
    "./videos",
    {
      "path": "./video1.mp4",
      "start": "00:01:00",
      "end": "01:00:00"
    },
    {
      "path": "./video2.mkv",
      "start": "10s",
      "end": "100s"
    }
  ],
  "play": {
    "-c:v": "libx264",
    "-preset": "medium",
    "-crf": 23,
    "-maxrate": "1000k",
    "-bufsize": "2000k",
    "-vf": "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2",
    "-r": 30,
    "-c:a": "aac",
    "-b:a": "128k",
    "-ar": 44100,
    "-f": "flv"
  },
  "output": {
    "rtmp_server": "rtmp://live-push.example.com/live",
    "stream_key": "your-stream-key"
  },
  "log": {
    "level": "info"
    "show_ffmpeg_output": true
  },
  "server": {
    "addr": ":8080",
    "token": "your-access-token"
  }
}

play 参数占位符

{{filename}}: 视频文件名(不包含后缀)
{{filepath}}: 视频路径

示例:

{
  "play": {
    "-vf": "drawtext=text='{{filename}}':x=5:y=5:fontsize=24:fontcolor=white:borderw=2:bordercolor=black"
  }
}